Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Data Series Variable

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

    Data Series Variable

    Code:
    #region Variables
    ....
    private DataSeries myDataSeries;
    private DataSeries myDataSeries2;
    private DataSeries myDataSeries3;
    ....
    
     protected override void OnBarUpdate()
            {
    
    .....
    
    myDataSeries.Set(PriorDayOHLC().PriorClose[0] -PriorDayOHLC().PriorLow[0]);
    		myDataSeries2.Set(PriorDayOHLC().PriorHigh[0] -PriorDayOHLC().PriorClose[0]);
    			
    myDataSeries3.Set(Math.Max(myDataSeries[0], myDataSeries2[0]));
    			
    						
    double MaxOffsetAvg = SMA(myDataSeries3, 3)[0];
    			
    Print(myDataSeries3[0]);
    			
    
    					
    				
    
    ....

    What my script should do.

    -Calculate yesterday's Close-Low and Close-High range
    -Take the higher value of both and calculate the 3 day moving average


    Script is compiling but no output, template of the script is running with other strategies.
    Last edited by markus1000; 10-09-2012, 01:12 PM.

    #2
    Hello Markus1000,

    Thank you for your post.

    Have you tried using the Print() method to Print out each DataSeries Class as well as the SMA?
    Is the output on the Output Window correct for each DataSeries Class and the SMA?

    I look forward to assisting you further.
    Last edited by NinjaTrader_PatrickH; 10-09-2012, 02:50 PM.

    Comment


      #3
      Originally posted by markus1000 View Post
      Code:
      #region Variables
      ....
      private DataSeries myDataSeries;
      private DataSeries myDataSeries2;
      private DataSeries myDataSeries3;
      ....
      
       protected override void OnBarUpdate()
              {
      
      .....
      
      myDataSeries.Set(PriorDayOHLC().PriorClose[0] -PriorDayOHLC().PriorLow[0]);
              myDataSeries2.Set(PriorDayOHLC().PriorHigh[0] -PriorDayOHLC().PriorClose[0]);
                  
      myDataSeries3.Set(Math.Max(myDataSeries[0], myDataSeries2[0]));
                  
                              
      double MaxOffsetAvg = SMA(myDataSeries3, 3)[0];
                  
      Print(myDataSeries3[0]);
                  
      
                          
                      
      
      ....
      What my script should do.

      -Calculate yesterday's Close-Low and Close-High range
      -Take the higher value of both and calculate the 3 day moving average


      Script is compiling but no output, template of the script is running with other strategies.
      How do you mean no output? What output are you expecting?

      Any errors on your log?

      Comment


        #4
        Originally posted by koganam View Post
        How do you mean no output? What output are you expecting?

        Any errors on your log?
        Im expecting myDataSeries3 to be printed in the output file.

        When i tried to print the other dataseries, i get messages like this

        Error on calling 'OnBarUpdate' method for strategy 'BetterBreakout/d65a7e818de943efbb6bf0bdcb61ff46': Object reference not set to an instance of an object

        Comment


          #5
          Hello markus1000,
          Have you created instance of the DataSeries
          Code:
          protected override void OnStartUp()
          {
            myDataSeries = new DataSeries(this);
            myDataSeries2 = new DataSeries(this);
            myDataSeries3 = new DataSeries(this);
          }
          JoydeepNinjaTrader Customer Service

          Comment


            #6
            Originally posted by NinjaTrader_Joydeep View Post
            Hello markus1000,
            Have you created instance of the DataSeries
            Code:
            protected override void OnStartUp()
            {
              myDataSeries = new DataSeries(this);
              myDataSeries2 = new DataSeries(this);
              myDataSeries3 = new DataSeries(this);
            }
            http://www.ninjatrader.com/support/h...?onstartup.htm
            ok thank you output is printing. should i put it before or after protected override void Initialize() or doesnt it matter

            Comment


              #7
              Hello markus1000,
              Its a method so you can put it anywhere you like.
              JoydeepNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

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