Hello all,
I tried writing a simple strategy code as I'm learning the basics. These parameters seemed simple to code, but the backtest shows a ton of incorrect buys and missed trades. Would someone please help me understand where I went wrong?
Parameters
. Daily timeframe
. Buy when Open of daily candle is above close of prior daily candle
. Sell on close of daily candle (essentially Market-on-Close
------------------------------------------------------------------------------------
def buy = open > close[1];
addOrder(OrderType.BUY_TO_OPEN, buy, open[-1], 10000 / close [1]);
addOrder(OrderType.sell_to_close, open[-1]);
------------------------------------------------------------------------------------
I tried writing a simple strategy code as I'm learning the basics. These parameters seemed simple to code, but the backtest shows a ton of incorrect buys and missed trades. Would someone please help me understand where I went wrong?
Parameters
. Daily timeframe
. Buy when Open of daily candle is above close of prior daily candle
. Sell on close of daily candle (essentially Market-on-Close
------------------------------------------------------------------------------------
def buy = open > close[1];
addOrder(OrderType.BUY_TO_OPEN, buy, open[-1], 10000 / close [1]);
addOrder(OrderType.sell_to_close, open[-1]);
------------------------------------------------------------------------------------
Last edited by a moderator: