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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        67 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        36 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        59 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        62 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        53 views
        0 likes
        Last Post CarlTrading  
        Working...
        X