I need some help.
I would like to be able to use the attached indicator (SuperTrendU11.zip) as a stoploss for my strategy. To keep things simple, assume my strategy is a moving average cross over, as the SampleMACrossOver that comes with the NinjaTrader standard package, code below:
protected override void OnBarUpdate() { if (CrossAbove(SMA(Fast), SMA(Slow), 1)) EnterLong(); else if (CrossBelow(SMA(Fast), SMA(Slow), 1)) EnterShort(); }
How could I modify the SuperTrendU11 code in order to generate the plotlines (Uptrend or Downtrend) ONLY when my strategy EnterLong or EnterShort?
This query might not be immediately clear, but if you plot the indicator, you will notice that the plotlines, that I would like to use as stoploss for my strategy are only generated in case of stoploss event (close crossing above/below plotline) that not always coincides with what my strategy is doing. (e.i. strategy could be going long, whilst SuperTrendU11 plots a short stoploss plotline (Downtrend), rather than a new long stoploss plotline (Uptrend) as I would like.
Thanks
Comment