Hello friends,
If possible can someone help me fix a bug in my coding. I want to create a code using the daily volatility/atr to create a momentum indicator with levels 1,2,3,4 and 5. This is how far i got:
Volatility[10,10] = AverageTrueRange[20](close)
MomentumLevel = close – close[20]
Level1 = 0.5 * Volatility
Level2 = 1 * Volatility
Level3 = 1.5 * Volatility
Level4 = 2 * Volatility
Level5 = 2.5 * Volatility
If Momentum > Level5 Then
MomentumLevel = 5
Else If Momentum > Level4 Then
MomentumLevel = 4
Else If Momentum > Level3 Then
MomentumLevel = 3
Else If Momentum > Level2 Then
MomentumLevel = 2
Else If Momentum > Level1 Then
MomentumLevel = 1
Else
MomentumLevel = 0
EndIf
Return MomentumLevel