How can I create new DatabankColumn,and get crosscheck info?
2 replies
Eckal
4 years ago #278981
Hi
I have create new DatabankColumn class with name :SQCrossCheck,but how can I get the CrossCheck info in method :getCrossCheckComputedValue
Thanks.
package SQ.Columns.Databanks;
import com.strategyquant.lib.*;
import com.strategyquant.datalib.*;
import com.strategyquant.tradinglib.*;
import com.strategyquant.lib.L;
import com.strategyquant.tradinglib.DatabankColumn;
import com.strategyquant.tradinglib.ResultsGroup;
import com.strategyquant.tradinglib.ValueTypes;
import com.strategyquant.tradinglib.results.SpecialValues;
public class SQCrossCheck extends DatabankColumn {
public SQCrossCheck() {
super(“SQCrossCheck”,
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(“SQCrossCheck”);
/* If this new column is dependent on some other columns that have to vbe computed first, put them here.
Make sure you don’t creat circular dependency, such as A depends on B and B depends on A.
Columns (=stats values) are identified by the name of class)
*/
//setDependencies(“DrawdownPct”, “NumberOfTrades”);
}
//————————————————————————
public String getValue(ResultsGroup results, String resultKey, byte direction, byte plType, byte sampleType) throws Exception {
//if(results.subResult(resultKey).containsKey(SpecialValues.Timeframe)) {
// return results.subResult(resultKey).getString(SpecialValues.Timeframe);
//}
//String aaa=results.specialValues().getString(SpecialValues.Timeframe, NOT_AVAILABLE);
return getCrossCheckComputedValue(results,111);
}
}
0
Mark Fric
4 years ago #279037
Hello. You are not supposed to do it like this.
Databank columns should be configurable in view, so you can edit their source data – see the attached screenshot. This will then load the correct result from ResultsGroup.
If you still want to do it your way then check this article: https://strategyquant.com/doc/programming-for-sq/working-with-resultsgroup/
All crosscheck results are stored in the ResultsGroup as separate Result objects. You can call subResult(resultKey) to get the result you want, from that you can get the stats.
If you don’t know the result key for your cross check you can use getResultKeys() to get all result keys in the ResultsGroup.
Mark
StrategyQuant architect
0
Eckal
4 years ago #279076
hello,Mark Fric
Thank you for your reply. I’ll look at the document again.
0
Viewing 2 replies - 1 through 2 (of 2 total)