If (date-date[1])=1 OR (date[1]-date[2])=1 Then
a=1 // 1 signals Daily timeframe
Endif
If (date-date[1])=7 OR (date[1]-date[2])=7 Then
a=7 // 7 signals Weekly timeframe
Endif
If (date-date[1])=30 OR (date[1]-date[2])=30 Then
a=30 // 30 signals Monthly timeframe
Endif
If (date-date[1])=299 OR (date[1]-date[2])=299 Then
a=100 // 100 signals Quarterly timeframe
Endif
If (date-date[1])>9500 Then
a=200 // 200 signals Annual timeframe
Endif
If (a=100) Then
Q12= Average[12](close)
Elsif (a=30) Then
M10= Average[10](close)
M40= Average[40](close)
Elsif (a=7) Then
W10= Average[10](close)
W40= Average[40](close)
Elsif (a=1) Then
D50= Average[50](close)
D200= Average[200](close)
EndIf
return Q12 COLOURED(0,0,255) AS "12 Quarter SMA",M10 COLOURED(230,230,250) AS "10 Month SMA",M40 COLOURED(0,0,255) AS "40 Month SMA", W40 COLOURED(0,0,255) AS "40 Week SMA",W10 COLOURED(230,230,250) AS "10 Week SMA", D50 COLOURED(230,230,250) AS "50 Day SMA", D200 COLOURED(0,0,255) AS "200 Day SMA"