Jim Dean
 Sage
       Posts: 3433
Joined: 3/13/2006
Location: L'ville, GA
User Profile |
Hi, Daniel
You need to do two tests ... the condition for the prior bar vs the condition for the current bar. For example:
if C[1] < SMA(20)[1] and C > SMA(20) then
... code for long crossover actions
elseif C[1] > SMA(20)[1] and C < SMA(20) then
... code for short crossover actions
end if
[Edited by Jim Dean on 12/26/2018 9:30 AM]
|