Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Referencing chart time-frame

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

    Referencing chart time-frame

    Hello,

    Is there a way for an indicator to reference the chart time-frame ?
    I would like to have a self-adjusted indicator that references one of its parameters to the specific time frame of the current chart.

    Thanks.

    #2
    bkool,

    do you mean something like this?

    if (Bars.Period.Id == PeriodType.Minute)
    {
    if (myTimeInterval < Bars.Period.Value)
    {...}
    }

    Regards
    Ralph

    Comment


      #3
      Thanks Ralph.

      Not sure though. I use Range bars. In this case - can I use the following?

      if (BarsPeriod.Id == PeriodType.Range)
      {(myRangePeriod == BarsPeriod.Value)}

      if (myRangePeriod = 5)
      {...}

      Comment


        #4
        Yes.

        Regards
        Ralph

        Comment


          #5
          Well,
          I've managed to work it out by adding the following code to the ZigZag indicator in the OnBarUpdate section:
          //-------------------
          // adjust deviationValue according to chart Range-frame
          double myRangePeriod = 0;
          if (BarsPeriod.Id == PeriodType.Range)
          {
          myRangePeriod = BarsPeriod.Value;
          deviationValue = (myRangePeriod +3.045)/31.23;
          //Print ("BarsPeriod.Value =" + BarsPeriod.Value.ToString());
          //Print ("deviationValue = " + deviationValue.ToString());
          }
          //-------------------

          The ratio deviationValue = (myRangePeriod +3.045)/31.23 was observed specifically for the TF contract by comparing various combinations of the two variables.

          Thanks much Ralph.

          bkool
          Last edited by bkool; 05-23-2010, 02:16 PM.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by rtwave, 04-12-2024, 09:30 AM
          2 responses
          20 views
          0 likes
          Last Post rtwave
          by rtwave
           
          Started by tsantospinto, 04-12-2024, 07:04 PM
          5 responses
          68 views
          0 likes
          Last Post tsantospinto  
          Started by cre8able, Today, 03:20 PM
          0 responses
          7 views
          0 likes
          Last Post cre8able  
          Started by Fran888, 02-16-2024, 10:48 AM
          3 responses
          49 views
          0 likes
          Last Post Sam2515
          by Sam2515
           
          Started by martin70, 03-24-2023, 04:58 AM
          15 responses
          115 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Working...
          X