Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Drawing ATR (day) on minute chart during backtest

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

    Drawing ATR (day) on minute chart during backtest

    Good morning.
    It seems that I read all about it but it does not work for me. I think I give up.
    I need to draw ATR(day) on minute backtest chart.
    1.I create new indicator MyATR(it should be done?):
    publicclass MyATR : Indicator
    protectedoverridevoid Initialize()
    {Add(new Plot(Color.FromKnownColor (KnownColor.Black)PlotStyle.Line, "Plot0"));
    Add(PeriodType.Day,1);}
    protectedoverridevoid OnBarUpdate()
    {Plot0.Set(ATR(BarsArray[1],1)[0]);}


    Very beautiful:The text that you have entered is too long (13907 characters)!!!??? Please shorten it to 10000 characters long.
    OK.To be continued...

    Last edited by CRUISE; 07-13-2011, 06:33 AM.

    #2
    2.In my strategy:
    publicclass B1variableTPSLatr : Strategy
    protectedoverridevoid Initialize()
    Add(PeriodType.Day, 1);
    Add(MyATR(
    1));
    MyATR(
    1).Plots[0].Pen.Width = 3;
    MyATR(
    1).Plots[0].Pen.Color = Color.Black;
    MyATR(
    1).PanelUI = 2;

    protectedoverridevoid OnBarUpdate()
    MyATR(1).Value.Set(BarsArray[1][0]);
    3.Absolutely nothing.I tried different ways. Panel2 is empty. MyATR uses min1 instead of day.I think I need help NinjaTrader support.
    Thank You in advance.
    Last edited by CRUISE; 07-13-2011, 06:21 AM.

    Comment


      #3
      Hello,

      Thanks for the forum post!

      You cannot set a indicator value from a strategy which is what the line in OnBarUpdate is attempting to do.


      protectedoverridevoid OnBarUpdate()
      MyATR.Plot0[0];


      The above would output the value of your indicator MyATR which would be the daily series ATR value.

      However, before you do anything in the strategy. Have you checked the output of your indicator by it self(MyATR)? Does it output correctly? We need to narrow down the area of the problem.
      BrettNinjaTrader Product Management

      Comment


        #4
        1.Thank You for the blazing swift reply.
        2.I used this way because I found the example on this forum:"SampleStrategyPlot.zip".If You interesting - please look.There is : Strategy->OnBarUpdate->Set value to the indicator.
        What the difference - I can't understand.
        3.But OK.I just want to do the very simple thing: to draw an ATR(day) on a minute backtesting chart BEFORE doing anything in my strategy. Because NT7 is MTF.And I see that for this simple task no clear examples.
        4.Now I try to use Your way.But if it still not working,I don't know what to do.I guess I'll coming back.
        Thank You.

        Comment


          #5
          Hello,

          First please check your indicator make sure your getting correct value for ATR in the chart. Then we will go from there. Please let me know.

          Also the strategyPlot example only pertains to not using a second indicator and ploting data to the chart from the strategy itself. You would not need this example since you created and indicator to do your plotting.

          -Brett
          BrettNinjaTrader Product Management

          Comment


            #6
            1.Thank You. I combined together DAY1,MIN1,original ATR(day1) on one chart. And appreciate your humor.The panel with original ATR is empty too.I think this is due to resolution.Data box shows the correct values."MyATR" works too with the same results, but if attached to daily bars only. If I attached to another timeframe it returns nothing.It is normal?
            2.I see that ATR is useless in my case.It will work in RT maybe,but not in backtest.I'm going to be replaced by CurrentDayOHL.What You think?

            Comment


              #7
              Hello,

              ATR will work in backtest as well there should be no need to use the CurrentDayOHC. However you do need to make sure you backtest a large enough time frame to load enough daily data to calculate your ATR. This means with a 14 period ATR requires at least 14 days of daily data to do this. Which would mean loading 14 days of minute data as well.

              If you do not have access to that daily data then you can do what you suggested to get out of multi time frame programming and just use the minute data and calculate your own.

              Let me know if I can be of further assistance.
              BrettNinjaTrader Product Management

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              661 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              375 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              110 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              574 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              579 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X