One of the gurus uses the 5min, 15min, and 60min 20 Bar EMA on a 5min chart. It is mind-boggling to me because I always thought of EMA as being linked to the chart itself, i.e. if 20EMA is plotted on 5mins, then it will be a 5min 20EMA.
Now how do I plot the 5/15/60min 20EMA on a 5min chart in ThinkOrSwim?
Sample code for Tradestation below if it helps:
Now how do I plot the 5/15/60min 20EMA on a 5min chart in ThinkOrSwim?
Sample code for Tradestation below if it helps:
Code:
Inputs :
length( 20 ) ,
SessionEndTime (1315 {PST US Session}) ;
If CurrentBar = 240 Then valuel = Xaverage( C, 240 ) •
If CurrentBar > 240 Then
Begin
- 30 ) / 100 )
If FracPortion( ( Time
= O or Time —
SessionEndTime Then
Begin
valuel
value2
Plotl (
End
Else
Begin
value2
Plotl (
End;
End ;
= valuel [I] + (2 / (
= valuel ;
valuel ,
"60 min EMA"
length + I
) ) * ( C — valuel [I] ) ;
= valuel + (2 / ( length + 1 ) )
value2 ,
"60 min EMA" ) ;
*
valuel [1] ) ;
Note: Adjust 1315 to match session end time for your time zone. 1315 is for Pacific Standard Time.