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 trilliantrader, 04-18-2024, 08:16 AM
          4 responses
          18 views
          0 likes
          Last Post trilliantrader  
          Started by mgco4you, Today, 09:46 PM
          1 response
          10 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by wzgy0920, Today, 09:53 PM
          0 responses
          10 views
          0 likes
          Last Post wzgy0920  
          Started by Rapine Heihei, Today, 08:19 PM
          1 response
          10 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by Rapine Heihei, Today, 08:25 PM
          0 responses
          10 views
          0 likes
          Last Post Rapine Heihei  
          Working...
          X