I'm a few weeks into cBots and have gone through about 20 iterations and made about 10 bots from cutting and pasting and figuring out the logic and flow of things but I'm a little stuck as to how best to close trades once the price and thus an open trade crosses a moving average.
My best cBot has a win rate of 75 to 82% on backtest depending on settings and while that's pretty decent, the equity curve has some real stinkers which wipe a lot of the profit away.
Essentially my bot opens trades when moving averages cross and RSI is above or below a line, and it will get stopped by the ATR based take profit. Some of the worst trades are the ones that open immediately after the close of a good trade but then the prices peak and reverse, and goes into loss straight away. With an above 70% win rate I almost can't complain, but these stinkers wipe out what would otherwise be a beautiful equity curve.
I assume that ideally I'm looking for an expression that works OnTick I think? so far, whenever I've added "else if" terms to ClosePositions it seems to have a limited effect on the outcome and when I backtest these awful trades are still there, unclosed. Worst still, if I reverse the polarity of these terms so that the price moving up over a SMA closes a Long rather than a Short, the opposite of what I actually want, it seems to improve the result!
Is there a blanket term that closes all position regardless of Long or Short?
Is there a list of valid terms I can use in these cBot, a directory?
Thanks,
Tom.