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 Nicholewatkinsi, Yesterday, 10:53 PM
          0 responses
          6 views
          0 likes
          Last Post Nicholewatkinsi  
          Started by dward123, 01-02-2024, 09:59 PM
          4 responses
          175 views
          0 likes
          Last Post Lancer
          by Lancer
           
          Started by ETFVoyageur, Yesterday, 04:00 PM
          2 responses
          19 views
          0 likes
          Last Post ETFVoyageur  
          Started by AaronKTradingForum, Yesterday, 03:44 PM
          1 response
          14 views
          0 likes
          Last Post AaronKTradingForum  
          Started by Felix Reichert, 04-26-2024, 02:12 PM
          11 responses
          80 views
          0 likes
          Last Post Felix Reichert  
          Working...
          X