Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bars.PercentComplete with PeriodType.Range

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

    Bars.PercentComplete with PeriodType.Range

    Hi Everybody,

    I'm programming an scalping strategy based on range bar (PeriodType.Range) and CalculateOnBarClose = false. These strategy enter in the market after FirstTickOfBar is true and exit the market in the same bar.

    If the order isn't filled after 30% of the complete bar I want to cancel the order. My problem is, according the NT7 help, I can't use the property Bars.PercentComplete with PeriodType.Range...

    Can you suggest me something can I do to simulate this property with range bar?

    Thank you

    Michele

    #2
    Michele, you could then look into keeping custom track of the developing range bar, just store the first tick seen and you have your starting point for the current bar, with BarsPeriod.Value you know what kind of range bar you're working on and thus know when x % of the range is completed.

    Comment


      #3
      Hi Betrand, I do appreciate your very quick help!

      If I have well understood what your mean I can do something like that:

      protected override void OnBarUpdate()
      {
      // 30% on bar complete
      if (BarsPeriod.Value == 0.3)
      {
      Cancel.... ;
      }
      }

      Comment


        #4
        You're welcome, no there would be more to it - the BarsPeriod.Value would just give you access to the range bar period set, so you're strategy could run properly then on any range bar interval. If you compare the target range for the full bar to the currently seen movement, you could calculate at what point to cancel intra bar, that would be the workaround idea.

        Comment


          #5
          Thank you!
          I'm going to try your suggestion.

          Comment


            #6
            Hello Bertrand,

            Unfortunately your suggestion does not solve what I'm looking to do. When I launch the strategy I the parameter data type series range with a value and this BarsPeriod.Value ruturn this range. This information is useless to me.

            Let me ask the question differently: I am looking for an indicator that when the bar is in progress it let me know how much remain before the end. (sorry my English is so poor).

            Thanks for your help.

            Michele

            Comment


              #7
              Originally posted by elechim View Post
              Hello Bertrand,

              Unfortunately your suggestion does not solve what I'm looking to do. When I launch the strategy I the parameter data type series range with a value and this BarsPeriod.Value ruturn this range. This information is useless to me.

              Let me ask the question differently: I am looking for an indicator that when the bar is in progress it let me know how much remain before the end. (sorry my English is so poor).

              Thanks for your help.

              Michele

              Code:
              CalculateOnBarClose = false;
              Code:
              if (BarsPeriod.Id == PeriodType.Range)
              {
              double BarPercentToClose = (1 - (High[0] - Low[0]) * TickSize / BarsPeriod.Value)) * 100;
              }

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              649 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              370 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              109 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              574 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              576 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X