Hi everyone,
I would like to use the MACD index and state the following if expressions in one loop, ie for every time t. First, I get the MAC index as follows
[macdvec, nineperma] = macd(y); 1) if macdev(t)>nineperma(t) then MACD(t)=1 2) if macdev(t)<nineperma(t) then MACD(t)=0 3) if macdev(t-1)<nineperma(t-1) and macdev(t)=nineperma(t) then MACD(t)=1 4) if macdev(t-1)>nineperma(t-1) and macdev(t)=nineperma(t) then MACD(t)=0
How can I state several if statements into a single loop?
Thanks a lot in advance
Best Answer