PRICE Vs MOVING AVERAGE

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #208784 quote
    ivan66
    Participant
    New

    Hi Nicolas, I would ask if already exist or in case do not exist if is it possible to create an indicator that calculate for any candle,  the distance between price and a  pre-definite moving average (Exponential or simple). In this way we could have a new simple indication of overbought or oversold. Thanks for your help and regards, Ivan

    coincatcha thanked this post
    #208787 quote
    JS
    Participant
    Senior

    Hi Ivan,

    Maybe this is a start…

    Period=14
    Type=0 //0=SMA 1=EMA
    MA=Average[Period,Type](Close)
    
    For i=0 to Period-1
    If Close[i]>MA[i] then
    xUp=Close[i]-MA[i]
    Else
    xDown=MA[i]-Close[i]
    EndIf
    Next
    
    AvgxUp=Average[Period](xUp)
    AvgxDown=Average[Period](xDown)
    
    DrawHLine(70)Coloured("Red")
    DrawHLine(30)Coloured("Green")
    
    OBOS=100-(100/(1+AvgxUp/AvgxDown))
    
    Return OBOS as "OBOS"
    ivan66, coincatcha and Nicolas thanked this post
    #208908 quote
    coincatcha
    Participant
    New

    I had wondered about this too, being new to code and all.

    Managed to get this to work on a FTSE counter trend long scalp 5min. See where it goes.

    Thanks!

    JS thanked this post
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

PRICE Vs MOVING AVERAGE


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
ivan66 @ivan66 Participant
Summary

This topic contains 2 replies,
has 3 voices, and was last updated by coincatcha
3 years ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 01/30/2023
Status: Active
Attachments: 1 files
Logo Logo
Loading...