EMA close to lows and Highs
Forums › ProRealTime English forum › ProBuilder support › EMA close to lows and Highs
- This topic has 6 replies, 3 voices, and was last updated 1 year ago by JS.
-
-
07/01/2023 at 11:24 AM #217109
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
07/01/2023 at 12:13 PM #217112Hi,
Something like this…
EMA High-Low-Middle1234567x=20 // Period = x-CandlesEMAHigh=ExponentialAverage[x](High)EMALow=ExponentialAverage[x](Low)EMAMiddle=(EMAHigh + EMALow)/2Return EMAHigh as "EMAHigh" coloured("Green"), EMALow as "EMALow" coloured("Red"), EMAMiddle as "EMAMiddle" coloured("Blue")07/01/2023 at 7:09 PM #21714007/03/2023 at 8:32 AM #217162Hi 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
07/03/2023 at 9:06 AM #217164Hi,
You could try something with the EMA plus the standard deviation…
Stay Close123SCH=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)07/04/2023 at 7:54 PM #21727307/04/2023 at 8:18 PM #217275You can turn this into a “CounterTrend” trading system…
Stay Close CounterTrend TS123456789101112DefParam CumulateOrders=FalseSCH=ExponentialAverage[PeriodHigh](High)+Std[PeriodHigh](High)SCL=ExponentialAverage[PeriodLow](Low)-Std[PeriodLow](Low)If High > SCH thenSellShort 1 contract at MarketEndIfIf Low < SCL thenBuy 1 contract at MarketEndIf -
AuthorPosts
Find exclusive trading pro-tools on