EMA close to lows and Highs

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #217109 quote
    Aragorna
    Participant
    Junior

    Goodmnorning to everyone,

    I need a help about an indicator I’m trying to build.I’d like to code two EMAs that are the closest possibile to the lows and the highs of X candles before (that don’t overlap the price), and a middle line between this two. How can I do?

    thank’s in advance

    Alessio

    #217112 quote
    JS
    Participant
    Senior

    Hi,

    Something like this…

     

    x=20 // Period = x-Candles
    EMAHigh=ExponentialAverage[x](High)
    EMALow=ExponentialAverage[x](Low)
    
    EMAMiddle=(EMAHigh + EMALow)/2
    
    Return EMAHigh as "EMAHigh" coloured("Green"), EMALow as "EMALow" coloured("Red"), EMAMiddle as "EMAMiddle" coloured("Blue")
    #217140 quote
    phoentzs
    Participant
    Master

    A little tip… try using open and close instead of high and low. 😉

    #217162 quote
    Aragorna
    Participant
    Junior

    Hi JS, thank you for your answer. I’m looking for a different approach. I’d like to consider the argument of the EMA as something to calculate, for example, every 5 or 10 bars, not an input at the beginning. The goal is to stay closer possible to the lows (or highs, it depends on the case) of X bars, without crossing the price ( keeping the lowest distance between EMA and Price, the leastest possible). my idea is , on a high number of bars it’ll stay close to the swing lows (for example 500 bars), on short number of candles it’ll stay close to the lows. Hope to be clear

    Alessio

    #217164 quote
    JS
    Participant
    Senior

    Hi,

    You could try something with the EMA plus the standard deviation…

    SCH=ExponentialAverage[10](High)+Std[10](High)
    SCL=ExponentialAverage[10](Low)+Std[10](Low)
    Return SCH as "Stay Close High" coloured("Green")Style(DottedLine,3), SCL as "Stay Close Low" coloured("Red")Style(DottedLine,3)
    #217273 quote
    JS
    Participant
    Senior

    I meant, of course:

    SCL=ExponentialAverage[10](Low) – Std[10](Low)

    (not +)

    #217275 quote
    JS
    Participant
    Senior

    You can turn this into a “CounterTrend” trading system…

     
    DefParam CumulateOrders=False
    
    SCH=ExponentialAverage[PeriodHigh](High)+Std[PeriodHigh](High)
    SCL=ExponentialAverage[PeriodLow](Low)-Std[PeriodLow](Low)
    
    If High > SCH then
    SellShort 1 contract at Market
    EndIf
    
    If Low < SCL then
    Buy 1 contract at Market
    EndIf
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.

EMA close to lows and Highs


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Aragorna @aragorna Participant
Summary

This topic contains 6 replies,
has 3 voices, and was last updated by JS
2 years, 7 months ago.

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