Your use of that boolean variable is the way, but you need to separate the structure controlling what's happening on the main MACD from what's happening on the second. Additionally, toy need to specify when the boolean variable is changed into 'false' again.
O