Im new to metatrader and have a question about syntax. I have created a variable int uRSI_b, that will assume the values 0 or 1 depending on the RSI value on my chart. I want this variable to work like a switch, where it turns to 1 if the RSI-value goes above a certain value. However, I want it to stay at 1 even if the RSI-value goes back below this value, and only set back to 0 once I've entered a trade. I was therefore thinking I'd wanted to make uRSI_b dependant on the barcount, so that I can write something along the lines of
if(iRSI>75) uRSI_b(current bar) = 1; else uRSI_b(current bar)=uRSI_b(previous bar)
is this possible?
otherwise, if I don't initiate the integer when I declare it, if iRSI goes above 75 and I have only written:
if(iRSI>75) uRSI_b = 1;
what will be the value of uRSI_b at the next bar if iRSI goes below 75? will it stay at 1?