Reply

Trying to create a new databank column and need help

2 replies

tmantrader

Subscriber, bbp_participant, customer, community, sq-ultimate, 5 replies.

Visit profile

1 week ago #276117

I attempted to create a databank indicator, it compiled, but then I was locked out of the system after I exited SQX and went back in because when compiling snippets there was some type of dependency problem – very frustrating. Can you tell me what I need to do to correct this code?

AvgWnAvgLs
******************
`
package SQ.Columns.Databanks;

import com.strategyquant.lib.*;
import com.strategyquant.datalib.*;
import com.strategyquant.tradinglib.*;

public class AvgWnAvgLs extends DatabankColumn {

public AvgWnAvgLs() {
super(“AvgWn/AvgLs”,
DatabankColumn.Decimal2, // value display format
ValueTypes.Maximize, // whether value should be maximized / minimized / approximated to a value
0, // target value if approximation was chosen
0, // average minimum of this value
100); // average maximum of this value

setWidth(80); // defaultcolumn width in pixels
setTooltip(“Avg. Win / Avg. Loss”);
setDependencies(“Avg. Win”, “Avg. Loss”);
}

@Override
public double compute(SQStats stats, StatsTypeCombination combination, OrdersList ordersList, SettingsMap settings, SQStats statsLong, SQStats statsShort) throws Exception {
double avgwn = stats.getDouble(“Avg. Win”);
double avgls = stats.getDouble(“Avg. Loss”);
double avgwn_avgls = SQUtils.safeDivide(avgwn, avgls);

/* round and return the value. It will be saved into stats under the key “AvgWn2AvgLs” */
return round2(avgwn_avgls);
}
}

Tom C

0

tomas262

Administrator, sq-ultimate, 899 replies.

Visit profile

1 week ago #276164

Hello,

the problem is you are referering incorrectly to certain stats such as setDependencies(“Avg. Win”, “Avg. Loss”);

It should be correctly referred as “AvgLoss” or “AvgWin”

1

tmantrader

Subscriber, bbp_participant, customer, community, sq-ultimate, 5 replies.

Visit profile

1 week ago #276166

Thank you Tomas.  Is there a reference or place where I can see the variable names of all of these columns?

 

Thanks,

 

Tom C

Tom C

0

Viewing 3 posts - 1 through 3 (of 3 total)