SMA200 up for down trend for easylanguage

dumpforjunk

Newbie
Messages
2
Likes
0
Is the following code correct for defining a up and down SMA200 trend: ?


if Average(C, 200) > Average(C[1], 200) then
upTrend = True;
if Average(C, 200) <= Average(C[1], 200) then
downTrend = True;


Thanks for any help
 
maybe I should have used a different variable name than "trend" but I just wanted to know if the code I posted is correctly calculating rising and declining (upTrend, downTrend) 200 day simple moving average.

Thanks
 
Is the following code correct for defining a up and down SMA200 trend: ?


if Average(C, 200) > Average(C[1], 200) then
upTrend = True;
if Average(C, 200) <= Average(C[1], 200) then
downTrend = True;


Thanks for any help

the [1] should be at the end,
otherwise TradeStation has to recalculate the formula each time.

see this:
Code:
if Average(C, 200) > Average(C, 200)[1] then
upTrend = True;
if Average(C, 200) <= Average(C, 200)[1] then
downTrend = True;
 
Top