PRICE Vs MOVING AVERAGE

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #208784 quote
    ivan66ivan66
    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
    JSJS
    Participant
    Master

    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
    Scherm­afbeelding-2023-01-30-om-23.23.52.png Scherm­afbeelding-2023-01-30-om-23.23.52.png
    #208908 quote
    coincatchacoincatcha
    Participant
    Junior

    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.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

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 coincatchacoincatcha
3 years, 8 months ago.

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