I started programming strategies just some days ago and now I have a big problem. So, would you please help me? Excuse me for my poor English, please.
I want to build a strategie where a special candle (1 hour chart) is taken.
If the price goes 1 Pip above the candle, I want to go Long (stoploss 1 Pip below the candle, TakeProfit = candlehigh + the high of the candle).
If the price goes 1 Pip below the candle I want to go short (stoploss 1 Pip above the candle and TakeProfit = candlelow – the high of the candle.
I use NinjaTrader 6.5 (V 7 beta crashes all few minutes) and I learned already that with this version it is not possible to set a LongStopBuy and a ShortStopSell at the same time. So I decided to make two strategies – one for long scenario and one for short scenario.
My problem is to get exactly entry 1 Pip above the candle and to get an exactly stoploss and TakeProfit.
I tried EnterLong() with ExitLong(), but the price is always set at the next candle . It is ot exactly 1 Pip above the candle.
I made it with “if(GetCurrentAsk() > price) EnterLong().
I tried SetStopLoss() and SetProfitTarget , but to get an entry I have to take take EnterLong and it is not an exact entry anymore like above.
And I tried entryOrder = EnterLongStop(…) with stopOrder = ExitLongStop (…) and targetOrder = ExitLongLimit(…). But when the setup is broken because of special circumstances, I want to cancel and start new some candles later. But when I delete entryOrder with CancelOrder(), all entries are deleted, not only this one. There are no entries anymore in backtesting.
I don’t know now what to do. Can you tell me please what is the right way to a solution for my breakout-strategie?
Thanks for your help!
Rainer

Comment