I have a question about writing my code in ninjascript, I have unlocked the code and am trying to set take profits and stop losses,
What I want to do is to set a take profit of [high[0] - low[0] ]+ 6 ticks and a stop loss to [high[0] - low[0] ]+ 2 ticks.
Here is what I have:
//Take Profits & Stops
SetStopLoss( CalculationMode.Price, (Low[0] -.02));
SetProfitTarget(CalculationMode.Price, (High[0] +.06 + Math.Abs(High[0] - Low[0]) ) );
This was for CL so I used .02 and .06 since they were in "ticks" but I know this is wrong, since it's giving me very bad backtesting results and on the chart it looks odd, as you can see from the photo the take profit triggered below the entry price, which is completely weird.
I'd appreciate some help on how to do this!
Additionally, is there a way to set an ATM in ninjascript where an initial stop loss is set, and then a trail stop is set once a profit trigger has been hit? I've been looking for this in the methods but all I can find is "setstoploss" and "settrailstop" and I found that they cant be used concurrently or the "setstoploss" takes precedence. I want to use a trail stop, but If i use this, then this means I cant set a regular stop loss in case the price goes against me? Is this true?
Thanks so much!
Tim

Comment