Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

dunno why my plot value does not line up

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

    dunno why my plot value does not line up

    i have indicator that marks values 1
    if(FirstTickOfBar){

    if((High[1]>High[2] ) && (High[2]>High[3] ))
    {HigherHigh.Set(1,1);}
    else
    {HigherHigh.

    if((Low[1]<Low[2] ) && (Low[2]<Low[3] ))
    {LowerLow.Set(1,1);}


    }

    from my strategy, i cannot see this 1 value
    if(FirstTickOfBar)
    {
    Print("value of trending Trending(0).HigherHigh[1] " + Trending(0).HigherHigh[1]);
    if((Trending(0).HigherHigh[1]==1 ) || ((Trending(0).LowerLow[1]==1 ))){

    // Generates an alert
    Alert("high or low", NinjaTrader.Cbi.Priority.High, "Reached threshold", "Alert1.wav", 10, Color.Black, Color.Yellow);



    }

    wheni print it, it seems to print the last prices even through on my indicator i can see it plotted on chart

    #2
    Hi junkone,

    Can you please clarify the code flow here and I will give a run on my side? May be a copy - paste error. You have HigherHigh. sitting by itself and then have an else block and within that an if statement.

    If you want else if, put that on one line: else if ((Low[1]<Low[2] ) && (Low[2]<Low[3] ))
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      sorry. bad cut and paste. here is the indicator running.
      if(FirstTickOfBar){

      if((High[1]>High[2] ) && (High[2]>High[3] ))
      {HigherHigh.Set(1,1);}


      if((Low[1]<Low[2] ) && (Low[2]<Low[3] ))
      {LowerLow.Set(1,1);}


      }

      ihere is the strategy running
      if(FirstTickOfBar)
      {
      Print("value of trending Trending(0).HigherHigh[1] " + Trending(0).HigherHigh[1]);
      if((Trending(0).HigherHigh[1]==1 ) || ((Trending(0).LowerLow[1]==1 ))){

      // Generates an alert
      Alert("high or low", NinjaTrader.Cbi.Priority.High, "Reached threshold", "Alert1.wav", 10, Color.Black, Color.Yellow);



      }

      }

      Comment


        #4
        Thanks for the reply. The reason you're seeing the close value printed is that you're attempting to access your plot at the same time it's set. It's not available from the strategy when you're trying to access. When there are no values set to a plot then it will use close instead.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          i would have thought that indicators are update before the strategy is executed for every tick. the NT internal order of processing is not within my control.
          what is the option that i have.
          i have indicators plotting value at first tick ofbar.
          i have strategy accessing the same indicator value at firsttickofbar.

          how do i manage it.

          Comment


            #6
            The indicators are updating before strategy, but in your case you're setting a value in the past. If there's no need to set one bar back you can set the current value, and then check this in your strategy. You can still use FirstTickOfBar in your indicator if you want it to look at bars prior to the current one. You could also move all the necessary logic into your strategy.
            Ryan M.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by CarlTrading, 03-31-2026, 09:41 PM
            1 response
            152 views
            1 like
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            89 views
            1 like
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            131 views
            2 likes
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            127 views
            1 like
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            107 views
            0 likes
            Last Post CarlTrading  
            Working...
            X