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

Pivots() for PivotRange.Day

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

    Pivots() for PivotRange.Day

    Hello,
    I have a problem with the indicator Pivots(). When I implement the code from the example to the method AddDataSeries () :
    Code:
    protected override void OnStateChange()
    {
        if (State == State.Configure)
        {
            // Our host needs to have this AddDataSeries included as well that Pivots indicator below has also per default in it's State.Configure
             // This is required since our Pivots indicator below is created in State.DataLoaded and it depends on its AddDataSeries call.
            AddDataSeries(BarsPeriodType.Day, 1);
        }
        else if (State == State.DataLoaded)
        {
            //In this state, we pass the 1 day series to the Pivots indicator and create its instance 
            pivots = Pivots(BarsArray[1], PivotRange.Weekly, HLCCalculationMode.DailyBars, 0, 0, 0, 20);
        }
    }
    I'm coding:
    Code:
    protected override void OnStateChange()
    {
        if (State == State.Configure)
        {
           AddDataSeries(BarsPeriodType.[B][COLOR="Red"]Day[/COLOR][/B], 1);
        }
        else if (State == State.DataLoaded)
        {
           pivots = Pivots(BarsArray[1], PivotRange.[B][COLOR="Red"]Daily[/COLOR][/B], HLCCalculationMode.[B][COLOR="red"]CalcFromIntradayData[/COLOR][/B], 0, 0, 0, 20);
        }
    }
    and I have an error : “Daily bars require the use of Weekly or Monthly Pivot range”
    What should I fix to make this error disappear? I need a day Pivot().
    Help me!
    Thanks!
    Last edited by Kostiantyn; 04-08-2017, 07:22 AM.

    #2
    I solved the problem myself.

    Comment


      #3
      Hello Kostiantyn,

      I am glad you were able to find an answer.

      For anyone following this thread, when using Daily bars as the input series (BarsArray[1] is added with AddDataSeries(BarsPeriodType.Day, 1), the Pivots requires the PivotRange to be PivotRange.Weekly or PivotRange.Monthly.
      Chelsea B.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by wzgy0920, 04-20-2024, 06:09 PM
      2 responses
      26 views
      0 likes
      Last Post wzgy0920  
      Started by wzgy0920, 02-22-2024, 01:11 AM
      5 responses
      32 views
      0 likes
      Last Post wzgy0920  
      Started by wzgy0920, Yesterday, 09:53 PM
      2 responses
      49 views
      0 likes
      Last Post wzgy0920  
      Started by Kensonprib, 04-28-2021, 10:11 AM
      5 responses
      191 views
      0 likes
      Last Post Hasadafa  
      Started by GussJ, 03-04-2020, 03:11 PM
      11 responses
      3,230 views
      0 likes
      Last Post xiinteractive  
      Working...
      X