I am trying to use Bardate in the following script but I am not getting the correct date. I am applying this to a PPO(1,10) monthly chart. Attached is the file.
V1 = CLOSE() CrossesBelow -5;
V2 = CLOSE() CrossesAbove 0;
V3 = SIGNALAFTER(V1,V2);
BARDATE(V3)
thanks
optuma-bardate.owb (27.1 KB)
Hi Jamie,
It looks like it’s using the last date for the SIGNALAFTER function, so instead try using this SWITCH function with PPO() instead of CLOSE():
V1 = PPO(BAR1=1, BAR2=10) < -5;
V2 = PPO(BAR1=1, BAR2=10) > 0;
V3 = SWITCH(V1,V2) ChangeTo 1;
V4 = SWITCH(V1,V2) ChangeTo 0;
V5 = BARDATE(V3);
V6 = BARDATE(V4);
IF(V5>V6,V5,V6)
