Why it acts weird?
Why it acts weird?
08 Aug 2013, 23:43
Hi,
so I am testing very simple robot to see how cAlgo works.
It's logic:
BUY signal -> EMA(10) HasCrossedAbove BollingerBandBottom
SELL signal -> EMA(10) HasCrossedBellow BollingerBandTop
One must stop another and open new position constantly.
I get mixed results from the same backtest. In the first graph you can see that short position is opened correctly, but system misses to close it even 3 times. In the second graph you can see that robot works correctly - it opens short position, closes it as should be, opens long position and closes long as it should be (and open third position).
Could you pls give suggestions if I do smth wrong, if it's some kind of bug or if there is some other explanation?
cAlgo_Fanatic
09 Aug 2013, 15:28
If you could post the code snippet for the logic of positions being triggered that would be helpful.
Two things you should be aware of.
It is not uncommon that the function will return true and by the end of the bar the two series will uncross. Try using the OnBar event with a period of at least one. This way the series will be compared for the last as well as the previous values.
@cAlgo_Fanatic