Can someone help me with bool logic

 
I'm not sure how to ask this question.
Is there such a thing as a mostly common practice to extend the return=true even after the initial trigger is no longer true ? 

bool up_fib()
   {
      {
      //Print(A_low()," ",B_high()," up_fib"); 
      if(A_low() && B_high())
         {
         fibhigh=A+(B-A)*fibo_retrace;
         //Print("UP A,B,C ",fibhigh);
         if(marketprice<=fibhigh)// && alert_time != btime)         
            {
            //SendNotification("Potential Buy "+(Symbol())+ " at or below "+ DoubleToString(fibhigh, 5) +" Buy bullish engulfing candle or tweezer bottoms");
            //alert_time=btime;
            upfib=true; //this static bool is used to keep Object color green, instead of going black when this function returns false. 
            return(true);
            }
          }                     
     }
    return(false);                 
   }

So in short - I want to extend the return of true.

My solutions was to use another global bool = upfib.
Then once this bool function is triggered also upfib=true. Then I can continue to use upfib=true until I change it with a another condition outside of this bool function. 
This functions as expected but seems indirect.

Is there something that is a more common practice for extending bool return to remain true once triggered and until another condition occurs. Or do I have to use another bool external from this bool like I have done ? 
I say indirect because I really can't use this bool function as my condition for my Objects anymore. I have to use upfib instead which works perfectly.
However, it just seems strange to get that result by having to put it outside and inside of another bool this way.  

So I thought to ask if this is a known topic that has a mostly common case use of code already. I don't want to reinvent the wheel if such a common type of use case already exists. 

Thanks.  


 

 
Agent86:
I'm not sure how to ask this question.
Is there such a thing as a mostly common practice to extend the return=true even after the initial trigger is no longer true ? 

So in short - I want to extend the return of true.

My solutions was to use another global bool = upfib.
Then once this bool function is triggered also upfib=true. Then I can continue to use upfib=true until I change it with a another condition outside of this bool function. 
This functions as expected but seems indirect.

Is there something that is a more common practice for extending bool return to remain true once triggered and until another condition occurs. Or do I have to use another bool external from this bool like I have done ? 
I say indirect because I really can't use this bool function as my condition for my Objects anymore. I have to use upfib instead which works perfectly.
However, it just seems strange to get that result by having to put it outside and inside of another bool this way.  

So I thought to ask if this is a known topic that has a mostly common case use of code already. I don't want to reinvent the wheel if such a common type of use case already exists. 

Thanks.  


 

What I can the code is : when the condition is fulfilled , it will return true . Otherwise it return false as you have return is as false. 
 
Yip Sin Hang #:
What I can the code is : when the condition is fulfilled , it will return true . Otherwise it return false as you have return is as false. 

So no other way then to extend it's condition met ? Just true or false and can be nothing else. 
This is why I used a duel bool if there is such a thing. 

Where the bool itself is the trigger for the condition itself, but the bool within the bool is the condition that remains true until an external condition is met that will make it false. 

While the 1st bool with either be true or false, then bool within the bool will either continue to be true or false even after the 1st bool condition is true. Then the bool within the bool will remain true while itself will have an external condition that makes it true or false until the 1st bool returns to false once again. 

I really couldn't thing of anything else but figured I would ask if there is a more direct method to this madness ? 
Thanks for the reply. 

 
Agent86 #:

So no other way then to extend it's condition met ? Just true or false and can be nothing else. 
This is why I used a duel bool if there is such a thing. 

Where the bool itself is the trigger for the condition itself, but the bool within the bool is the condition that remains true until an external condition is met that will make it false. 

While the 1st bool with either be true or false, then bool within the bool will either continue to be true or false even after the 1st bool condition is true. Then the bool within the bool will remain true while itself will have an external condition that makes it true or false until the 1st bool returns to false once again. 

I really couldn't thing of anything else but figured I would ask if there is a more direct method to this madness ? 
Thanks for the reply. 

your understanding or articulation is lacking.

A boolean value is only ever going to be TRUE or FALSE, depending upon how you set it. 

There is no boolean within the boolean, I think you are meaning a boolean variable within your function that also returns a boolean value...

You need to create logical code to resolve your clearly defined requirements. 

Trust this helps.

 
Thanks all. 

I got it now. 
And Yes as you see by the code snip it is a bool variable within a bool function that I ended up with. This complicates my original design of using these bools. 
As my code became more complex was reluctant to ditching this bool function to create a more complex function instead of a bool. 
Likely because it takes me so much time to write something that I didn't want to ditch the almost working bool function.  

It was a good idea when it was simple true / false.  Now that I need more complex conditions I have to ditch the bool and create a better code. 

Thanks again. 


 
Reason: