i have gotten something at the moment but it seems to half work. see picture. the red tick is the correct one i am going for but after that there is 3 red crosses which is not what i what the codes to do because it does not meet my uptrend, c1 , macup , and habullcandle15 conditions. here are my codes.
You are triggering an order because of condition at line 10, so I suggest you GRAPH var[n] to see when, how and why it updates its value. I think the problem is located in this variable value.