• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Plot My DataSeries from a Strategy

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

    Plot My DataSeries from a Strategy

    I am basing my trades on a data series I have constructed and stored in a data series "MyOpen".

    If I add the command:
    ADX(14).Panel = 1;
    Add(ADX(14);

    I can plot the ADX in panel 1. However, my trades are based on ADX(MyOpen,14). I would like to plot this rather than the base series.

    I get an error if I try to use the above in the the Initialize section. Anyone know of a solution?

    #2
    A workaround can be just moving the DataSeries calculations into an indicator. The indicator will just return the value of ADX(MyOpen, 14). This way you can add it to your strategy with no problem.

    Something like:
    Code:
    Add(CustomADX(14));
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      The problem is a bit more complex than just adding code to an indicator.

      The MyOpen data series is a calculated open from a 1 minute bar added to the Strategy that is placed on a 30 minute bar chart. I don't think this is possible to do in an indicator.

      What I need to see is the computed ADX in the plot.

      The code I am using to do this in the strategy:
      protected override void Initialize()
      {
      CalculateOnBarClose = true;
      Add(PeriodType.Minute,1);
      }
      protected override void OnBarUpdate()
      if (MyOpen == null)
      {
      MyOpen = new DataSeries(SMA(BarsArray[0], 70));
      }

      if(BarsInProgress == 1 && FirstTickOfBar && FirstBar) //1 min bar
      {
      MyOpen.Set(Closes[1][0]);

      double X = ADX(MyOpen,14);
      FirstBar = false;
      }
      if(BarsInProgress == 0 && FirstTickOfBar) // 30 Min Bar
      {
      FirstBar = true;

      }

      Comment


        #4
        Guy..
        I don't think you can add custom plots from a strategy.
        However some people use draw-line, or draw-dot etc. as a work-around.
        CLunky for sure, but better than nothing

        ATIuser was kind enought to post an example here
        http://www.ninjatrader-support.com/v...ead.php?t=4653

        Comment


          #5
          zoltran is correct. You cannot add a plot from a strategy.
          Josh P.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by chrismcdermut, Yesterday, 01:46 PM
          3 responses
          19 views
          0 likes
          Last Post MojoJojo  
          Started by Bricolico, Yesterday, 09:28 PM
          0 responses
          5 views
          0 likes
          Last Post Bricolico  
          Started by Tradwell385, Yesterday, 08:51 PM
          0 responses
          7 views
          0 likes
          Last Post Tradwell385  
          Started by dvcpro4, Yesterday, 07:08 PM
          0 responses
          22 views
          0 likes
          Last Post dvcpro4
          by dvcpro4
           
          Started by pennywise, Yesterday, 06:40 PM
          0 responses
          8 views
          0 likes
          Last Post pennywise  
          Working...
          X