♥ 0 |
I need help with some code logic. suppose x is the high and y is the low of an indicator. how do I make a variable true if “close crosses above x” and false when “close crosses below y”? The problem if I use “close crosses above x” is that it will only be true for 1 bar and then turn false since it is recalculated at every bar. If I do “close > x” the logic will be wrong when the close is between x and y because once the close crosses x I want it to stay true until it closes below y. I can’t use “close > x and close > y” because once the close falls below x the statement still still turn false. if I do “close > x or close > y” then the problem is I will get a true condition too early. if there was a global variable of some sort that I could manually assign then I wouldn’t have any issues, but because the thinkscript checks conditions every bar, I can’t get my logic to work. Your help is appreciated. Thanks!
to summarize:
Marked as spam
|
Please log in to post questions.