Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

TSSuperTrend

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    TSSuperTrend

    I would like to have three [3] ATR stops on chart with same period but different multipliers
    and color the area between middle and one ATR one color and color area between middle ATR and the other ATR another color.

    How do I do that?

    #2
    Hi rtj4201,

    This can be accomplished with a NinjaScript Strategy.

    First, you will need to set your strategy to allow 3 long or short orders.
    http://www.ninjatrader.com/support/h...rdirection.htm

    Then you will need to submit 3 entry orders. For each of these entry orders use a signal name. In the stop losses for these 3 entry orders use a fromSignalName.
    http://www.ninjatrader.com/support/h.../enterlong.htm
    http://www.ninjatrader.com/support/h...etstoploss.htm

    SetStopLoss("entry1", CalculationMode.Ticks, Instrument.MasterInstrument.Round2TickSize(ATR(5)[0], false);

    Then use DrawRegion to shade the chart between the two prices of the ATR dataseries.

    DrawRegion(string tag, CurrentBar, 0, ATR(5), ATR(10), Color.Black, Color.Grey, 9);

    DrawRegion(string tag, int startBarsAgo, int endBarsAgo, IDataSeries series1, IDataSeries series2, Color outlineColor, Color areaColor, int areaOpacity)
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I may have confused this by saying ATR stop. I meant an ATR line. I intended this to be an indicator not a strategy.

      Can an indicator be done to color areas between middle ATR and outer ATRs with a different color?

      Comment


        #4
        Hi rtj4201,

        Yes, the method is the same, however, you would not submit any orders.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          I have coded something like that, but only uses two distinct SuperTrend indicators. The base indicator is a SuperTrendM11, which uses the (statistical) median one bar ago and the ATR one bar ago. There is no point in including the current value in the calculation as it only increases CPU load and skews the ATR to the downside when used in COBC = false.

          When the two SuperTrends align the region between the stoplines is shows the uptrending or downtrending color, otherwise it is gray.
          Attached Files

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by GussJ, 03-04-2020, 03:11 PM
          11 responses
          3,229 views
          0 likes
          Last Post xiinteractive  
          Started by andrewtrades, Today, 04:57 PM
          1 response
          14 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by chbruno, Today, 04:10 PM
          0 responses
          7 views
          0 likes
          Last Post chbruno
          by chbruno
           
          Started by josh18955, 03-25-2023, 11:16 AM
          6 responses
          440 views
          0 likes
          Last Post Delerium  
          Started by FAQtrader, Today, 03:35 PM
          0 responses
          12 views
          0 likes
          Last Post FAQtrader  
          Working...
          X