Hello:
I've created an efs formula that compares highs and lows on recent price bars in order to find ideal entry points. The efs works great but it is slow compared to other efs formulas I use (according to the performance monitor).
Here's an excerpt of the script. There's a counter to keep track of valid comparisons, and then look for a total count. I tried combining some comparisons together into one if statement using &&, but this slowed the script down considerably. I was wondering whether retrieving the data needed into an array and then comparing the values would be faster than retrieving and comparing the bar values one by one. Are there any other ways to speed up efs performance?
// 3 lower highs on last 3 candles
if (high(-1) > high(0)) {
iScore = iScore+1;
}
if (high(-2) > high(-1)) {
iScore = iScore+1;
}
if (high(-3) > high(-2)) {
iScore = iScore+1;
}
// 2 lower lows on last 2 candles
if (low(-1) > low(0)) {
iScore = iScore+1;
}
if (low(-2) > low(-1)) {
iScore = iScore+1;
}
price keeps above 20 ma
if (low(0) >= sma(20,0)) {
iScore = iScore+1;
}
// valid entry point if all tests are true
if (iScore == 6) {
sSymbol = getSymbol();
Alert.addToList(sSymbol, "valid entry point", Color.blue, Color.grey);
}
**************
Thanks in advance.
jt_trader
I've created an efs formula that compares highs and lows on recent price bars in order to find ideal entry points. The efs works great but it is slow compared to other efs formulas I use (according to the performance monitor).
Here's an excerpt of the script. There's a counter to keep track of valid comparisons, and then look for a total count. I tried combining some comparisons together into one if statement using &&, but this slowed the script down considerably. I was wondering whether retrieving the data needed into an array and then comparing the values would be faster than retrieving and comparing the bar values one by one. Are there any other ways to speed up efs performance?
// 3 lower highs on last 3 candles
if (high(-1) > high(0)) {
iScore = iScore+1;
}
if (high(-2) > high(-1)) {
iScore = iScore+1;
}
if (high(-3) > high(-2)) {
iScore = iScore+1;
}
// 2 lower lows on last 2 candles
if (low(-1) > low(0)) {
iScore = iScore+1;
}
if (low(-2) > low(-1)) {
iScore = iScore+1;
}
price keeps above 20 ma
if (low(0) >= sma(20,0)) {
iScore = iScore+1;
}
// valid entry point if all tests are true
if (iScore == 6) {
sSymbol = getSymbol();
Alert.addToList(sSymbol, "valid entry point", Color.blue, Color.grey);
}
**************
Thanks in advance.
jt_trader
Comment