Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MIN & MAX not triggering

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

    MIN & MAX not triggering

    Hello,

    Can you please help me identify the problem?

    I am trying the following conditions, but there is no trigger.

    Code:
    double VWAPStdDevUp1 = OrderFlowVWAP(VWAPResolution.Tick, Bars.TradingHours, VWAPStandardDeviations.Three, 1, 2, 3).StdDev1Upper[0];
                   
                    MAX1                = MAX(High, 2);
                    MIN1                = MIN(Low, 2);
                    Print(string.Format("High: {0}, Low: {1}",  MAX1[0], MIN1[0]));
                    
                
                    if (CrossAbove(Close, MAX1,1) && Closes[0][0] < VWAPStdDevUp1)​

    #2
    Can you please state what you're trying to do in English?

    I mean, describe your conditions, very specifically, so that
    we can understand what conditional state you're trying to
    capture.

    Comment


      #3
      I am getting the highest High of the last 2 bars. After that,
      I want a long entry once the close price cross above the Highest High and the price is under the 1st upper deviation line

      thanks

      Comment


        #4
        Originally posted by Jorge.andres.o View Post
        I am getting the highest High of the last 2 bars. After that,
        I want a long entry once the close price cross above the Highest High and the price is under the 1st upper deviation line
        Assuming Calculate.OnBarClose ...

        Code:
        if (Close[0] > Math.Max(High[1], High[2]) && Close[0] < VWAPStdDevUp1)
            ...

        Comment


          #5
          Can I calculate it on each tick?

          Comment


            #6
            Hmm, let me see ...

            As a matter of fact, yep, it should work fine.

            Do you understand why?

            Let's review,

            OnPriceChange/OnEachTick:
            Close[0] is close of active bar being built (basically last price seen)
            Close[1] is close of prior bar (basically most recently closed bar)
            Close[2] is close of previous prior bar

            OnBarClose:
            Close[0] is close of most recently closed bar
            Close[1] is close of prior bar
            Close[2] is close of previous prior bar

            So, yep, that if statement I provided should work
            fine for all Calculate settings.

            -=o=-

            Make sure you have a guard for CurrentBar
            somewhere near the top of your OnBarUpdate.

            At the minimum, you'll need,

            Code:
            if (CurrentBar < 2)
                return;
            Make sense?

            Comment


              #7
              You’re awesome thanks a lot for your help with the code

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by NullPointStrategies, Today, 05:17 AM
              0 responses
              53 views
              0 likes
              Last Post NullPointStrategies  
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              130 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              70 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              44 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              49 views
              0 likes
              Last Post TheRealMorford  
              Working...
              X