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 Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            569 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            330 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
            548 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            548 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X