Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Applying indicators to a chart (for backtestring).

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

    Applying indicators to a chart (for backtestring).

    When I run a backtest and click on a Chart tab to view the buys and sells - the indicators I applied to my default chart previously are not there. If I apply the indicators again - then all the buys and sells disappear.

    Is this designed to work this way?

    #2
    If you want indicators to show up during backtesting through the Strategy Analyzer you need to add the indicators to the strategy. Please see the tip on adding indicators to strategies here in the Tip section of the forum.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Works for most indicators.

      I looked at it - very helpful indeed. Got it it to work for volume and a number of other indicators.

      But I can't get to plot current day's high.

      Coding the following doesn't work:
      Add(CurrentDayOHL().CurrentHigh[0]);

      I must be missing something...

      Thanks

      Comment


        #4
        Correct you can't specify only one plot from an indicator. If you are going to add an indicator you have to add the whole thing. What you can do however is change the color of the irrelevant plots to transparent so you don't see them.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Still can't get it to work.

          Thanks.
          But when I code:
          Add(CurrentDayOHL());
          CurrentDayOHL().CurrentLow[0].Plots[0].Pen.Color = Color.Transparent;

          I get an error message. Now if I remove CurrentLow[0] from the above it compiles. But I do not want to show that attribute.

          Also I was able to add Macd:
          Add(MACD(12, 26, 9));

          But can't change each attribute's color. For example:
          Avg color = red, diff color = blue, Macd color = yellow.

          Thanks

          Comment


            #6
            You need to find the Plots[0] value that corresponds with the plot you want to change. 0, 1, 2, etc. You can figure this out by opening up the CurrentDayOHL() indicator and seeing which is assigned to which. The same applies for the MACD.

            Plots[0], Plots[1], etc. is how you would need to reference them to change them.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              It is not the plot[] that's the issue.

              I am aware of the plots. The issue is not the plots[]. I think it is the syntax. No matter which plot I assign I get an error: 'NinjaTrader.Data.DataSeries' does not contain a definition for 'Plots'.
              My code is:
              CurrentDayOHL().CurrentLow[0].Plots[0].Pen.Color = Color.Transparent;

              Now if I remove CurrentLow[0] from the above it compiles. But I specifically do not want to see the CurrentLow.

              It would be off immense help to just be able to have a setting that applies all the default chart attributes to the chart in backtesting.

              To have 4 lines of code just to see one line on a chart is just not efficient.

              Same for MACD. I can plot it but can't seem to be able to change the color of Diff, Avg, Macd.

              I appreciate your help.

              Comment


                #8
                That's right. You don't use CurrentLow. To get access to CurrentLow you need to find the correct Plots[x] that corresponds with it and assign your Color.Transparent to that plot.

                You need to open up CurrentDayOHL() to take a look. CurrentLow is assigned to 2 so you would use Plots[2]. Assign Color.Transparent as demonstrated in the tip to Plots[2].

                These settings are settable for backtesting. You just need to assign them to the correct plot individually. It is as efficient as possible.

                When you do Add() you are adding all plots. You need to access Plots[] to change the colors.
                Josh P.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by fx.practic, 10-15-2013, 12:53 AM
                5 responses
                5,403 views
                0 likes
                Last Post Bidder
                by Bidder
                 
                Started by Shai Samuel, 07-02-2022, 02:46 PM
                4 responses
                95 views
                0 likes
                Last Post Bidder
                by Bidder
                 
                Started by DJ888, Yesterday, 10:57 PM
                0 responses
                7 views
                0 likes
                Last Post DJ888
                by DJ888
                 
                Started by MacDad, 02-25-2024, 11:48 PM
                7 responses
                159 views
                0 likes
                Last Post loganjarosz123  
                Started by Belfortbucks, Yesterday, 09:29 PM
                0 responses
                8 views
                0 likes
                Last Post Belfortbucks  
                Working...
                X