Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Within condition

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

    Within condition

    hi i'm trying to make a logic:

    if XYZ happened within X bars, and XYZ happens, go long/short

    ie: if a bang happens in the last 10 bars and now there is a crossover; go long/short

    how can i make the ''within'' condition

    #2
    Originally posted by calhawk01 View Post
    hi i'm trying to make a logic:

    if XYZ happened within X bars, and XYZ happens, go long/short

    ie: if a bang happens in the last 10 bars and now there is a crossover; go long/short

    how can i make the ''within'' condition
    Use MRO().

    Comment


      #3
      Originally posted by koganam View Post
      Use MRO().

      so would it be:

      if (MRO(delegate {return (XYZ > 10);}, 1, 500)
      {
      golong
      }

      ie: if most recent occurance for XYZ being larger than 10 in the last 500 bars?

      Comment


        #4
        Originally posted by calhawk01 View Post
        so would it be:

        if (MRO(delegate {return (XYZ > 10);}, 1, 500)
        {
        golong
        }

        ie: if most recent occurance for XYZ being larger than 10 in the last 500 bars?
        Pretty much.

        Comment


          #5
          Originally posted by koganam View Post
          Pretty much.

          Code:
                      if ((MRO(delegate {return (ROC(ROCC)[0] >= Threshold);},1,10))
                          && Close[0] < SMA(SMAA)[0]
                          && ToTime(Time[0]) >= ToTime(9, 30, 0)
                          && ToTime(Time[0]) <= ToTime(16, 30, 0))
                      {
                      EnterLong(DefaultQuantity, "");
                      }
          looks fine but doesnt compile :/

          Comment


            #6
            calhawk01, the MRO would not return a true / false back but an int # to work with in your conditions.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            670 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            379 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            111 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            575 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            582 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X