Hi friends,
Having read Yuri Shramenko's X Factor Day trading course, I am interested to code the following as a single paintbar ( indicator) to display the following three conditions combined into one single line plot.
If the closing price of the current bar is above a 8-period simple moving-average of the high, display an 8-prd moving-average of the low
If the closing price of the current bar is below a 8-period simple moving-average of the low, display an 8-prd moving-average of the high
If the closing price of the current bar is between the high and low moving averages, continue to display the current plot
Programming is NOT my forte, and may I request some kind soul to help me out? Here is the code that is found in metastock format:
The formula: prd:=8;
HLd:=If(CLOSE>Ref(Mov(HIGH,prd,SIMPLE), -1), 1, If(CLOSE<Ref(Mov(LOW,prd,SIMPLE),-1), -1, 0));
HLv:=ValueWhen(1,HLd<>0,HLd);
If(HLv=-1, Mov(HIGH,prd,SIMPLE), Mov(LOW,prd,SIMPLE))
Thank you.