Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

if I need to have a bool called from an indicator to stay valid

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

    if I need to have a bool called from an indicator to stay valid

    for 5 bars irrespective of what it may actually be in the indicator for those 5 bars, how do I actually go about achieving that?

    I am asking this question because if I am in a trade and it so happens that I exited that trade 2 bars after the bool became true AND there was an opportunity to enter a new trade but the bool was no longer valid because the position was not flat at the time the bool became valid.

    Regards

    Kay Wai

    #2
    Kay, it sounds like you would then need a second bool that tracks only the bars elapsed since it became valid / true?

    Comment


      #3
      Hi Bertrand,

      would you mind providing an example of what you mean?

      From the little that I understand, if the first bool changes, the second bool would change too, no?

      Regards

      Kay Wai

      Comment


        #4
        Not necessarily Kay, consider the example where for example bool2 flips to 'true' if bool1 is true and then you track the barnumbers and set bool2 to false after your 5 bars. This would not 100% track bool1 but be what seek I believe from my understanding so far.

        Thanks,

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        59 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        143 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        161 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        97 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        276 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X