Hello, I was wondering if anyone could help me with a problem I've been having
I have pretty much my entire indicator coded, however I'm trying to get it to draw buy/sell arrows based on my strategy so I can hook it up to an
Basically I'm saying "if this line touches price then becomes disconnected, then my SMA turns green, place an arrow"
What I originally thought would work is:
int x = 0;
x = 1;
if(x==1 && line != price)
if (x==2 && MA==green)
x = 0;
what's happening is im getting that x = 1, but when the indicator recalculates on every tick its resetting x to 0 due to that original int x = 0;
my question is is there any way to store that event of the line touching (im thinking maybe an array?), so then i can say "it touched, now its not
touching, now MA is green, so place arrow".
Thanks in advance
Put this declaration:
Outside of the OnCalculate() function if you dont want it to be set to zero every time in the loop.