Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Add a variable for Dataseriesvalue

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

    Add a variable for Dataseriesvalue

    Ok. Two things I want to achieve.

    1)
    lets say my dataseries for the current strategy is minute based and at 1 for 1min

    I now wanna use the optimizer for that 1 value, meaning that i can check the performance of the strategy on lets say 1-10 minute timeframe, without having to chance the dataseries manually. but the DataSeries isnt open for optimisation per default.

    I was thinking, if there is a way to have a variable that sets the dataseries value, i could then add it to properties and that way optimize it.

    The second thing I want to do, which is kinda in the same category, is having a value based on my dataseriesvalue. so if the dataseries is pricebased like range bars for example, I could use the value of the range bar to determine the size of various variables for my strategy without having to adjust them manually.

    for example lets say I need the gap between 2 moving av.s to be 10 pips on 20 range bar chart. ofc if im moving down to 5 rangebar this value would be greatly too big and would need to be adjusted to 2,5. if I would have the chance to output the dataseries value somehow, I would be able to just say gap=0,5*dataseriesvalue.

    any ideas
    thanks anyway

    #2
    found "optimize data series" so nvm for 1)

    Comment


      #3
      Hello BigRo,

      Thank you for writing in. To your second question, you can check the data series period value and the period type in code. It is generally recommended not to do this within the Initialize method. Please see our help guide for more information: http://ninjatrader.com/support/helpG...sub=barsperiod

      As an example:
      Code:
      protected override void OnBarUpdate()
      {
          if(CurrentBar == 0)
          {
              switch(BarsPeriod.Id)
              {
                  case PeriodType.Tick:
                      if(BarsPeriod.Value < 500)
                      {
                          //Setup variables a certain way
                      } else {
                          //Setup variables a different way
                      }
                      break;
                 case PeriodType.Second:
                      if(BarsPeriod.Value > 10)
                      {
                          //Setup variables a certain way
                      } else {
                          //Setup variables a different way
                      }
                      break;
                case PeriodType.Day:
                      if(BarsPeriod.Value > 1)
                      {
                          //Setup variables a certain way
                      } else {
                          //Setup variables a different way
                      }
                      break;
              }
          }
      }
      Please let me know if you have any questions or if I may be of further assistance.
      Michael M.NinjaTrader Quality Assurance

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      558 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      324 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      545 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      547 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X