momentum indicator buf

Forums ProRealTime English forum ProBuilder support momentum indicator buf

  • This topic has 2 replies, 3 voices, and was last updated 1 year ago by avatarJS.
Viewing 3 posts - 1 through 3 (of 3 total)
  • #211229

    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

     

    #211232

    Line 1 is not correct, you can’t assign any value to indicators, as they can only return values.

    Else If is not allowed, the correct syntax is Elsif.

    #211251
    JS

    Hi @Banie,

    Hereby your custom code…

     

    1 user thanked author for this post.
Viewing 3 posts - 1 through 3 (of 3 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login