Hello All,
If I have an 'entry' criteria and a 'exit' criteria at the same time my strat will enter and exit at the same candle, how can I force it to at least wait till the next candle before exiting ?
AddOrder(OrderType.BUY_TO_OPEN,
, open[-1],
stock_quantity, Color.GREEN, Color.GREEN);
# I want like a IF here so it will skip the sell if it just bought on this candle
AddOrder(OrderType.SELL_TO_CLOSE,
open[-1], stock_quantity, Color.RED, Color.RED);
I want to make the 'sell to close' only fire if the 'buy to open' has NOT fired for that candle, so it will fire on the next candle. I've simplified my code it actually looks at an RSI but that's irrelevant.
Also does anyone know how to make it so it will only enter or exit orders during normal market hours, and extra bonus plus if you can tell me how to make it exit any current orders at the end of the day.
Thanks for your time,
Michael
If I have an 'entry' criteria and a 'exit' criteria at the same time my strat will enter and exit at the same candle, how can I force it to at least wait till the next candle before exiting ?
AddOrder(OrderType.BUY_TO_OPEN,
, open[-1],
stock_quantity, Color.GREEN, Color.GREEN);
# I want like a IF here so it will skip the sell if it just bought on this candle
AddOrder(OrderType.SELL_TO_CLOSE,
open[-1], stock_quantity, Color.RED, Color.RED);
I want to make the 'sell to close' only fire if the 'buy to open' has NOT fired for that candle, so it will fire on the next candle. I've simplified my code it actually looks at an RSI but that's irrelevant.
Also does anyone know how to make it so it will only enter or exit orders during normal market hours, and extra bonus plus if you can tell me how to make it exit any current orders at the end of the day.
Thanks for your time,
Michael
Last edited by a moderator: