imzeeshan

Distance to MA

Summary:

Calculate the distance of the price to a moving average. Also be able to identify if the average distance is decreasing or increasing based on signal line.

Details
Length: The moving average length to measure against.
Source: The price input source use to measure the distance from.
Signal Length: The average of distance between Source and MA.

If the average is increasing the color of the signal line will be green and if it is decreasing then it will be red.
發布通知: The indicator now has the ability to show distance and signal as a percentage from the moving average.


Quadrant top left shows distance and signal line from the MA in terms of dollar amount.

Quadrant top left shows distance and signal line from the MA in terms of percentage.

Quadrant bottom left shows distance from MA in terms of dollar amount and signal line from the MA in terms of percentage. This is perhaps the most important measure of strength and also can be an indicator for overbought or oversold levels.

Quadrant bottom right shows distance from MA in terms of percentage and signal line from the MA in terms of dollar amount.
開源腳本

秉持真正的TradingView精神,該腳本的作者將其開源發佈,因此交易者可以理解和驗證它。為作者加油!您可以免費使用它,但是在發佈中重複使用此程式碼受網站規則的約束。您可以把它加入到常用以在圖表上使用它。

想在圖表上使用此腳本?

評論

Thanks, loving this!
100 代幣
回覆
Simple yet awesome. I'm going to borrow some of your code for my indicator if you don't mind :)
+1 回覆
imzeeshan tommyf1001
@tommyf1001, Thanks. Absolutely, go ahead. Happy trading.
回覆
Very nice. How can I calculate if two emas distance is below a certain percentage? Basically, I am trying to find the
emaDifference = ema(src, 5) - ema(src, 100)
then add an indicator if the percentage is low so it shows if the emas are too close to each other up or down market.
Thanks.
回覆
imzeeshan BertMan
@BertMan, You can switch (mark as checked) on 'Show Dist as %'. So now Plot #1 shows all values in %. Then create an alert on the indicator's Plot #1 value to be 'Less than' the % that you want it to be lower.
回覆
BertMan imzeeshan
@imzeeshan, thanks, will try that.
回覆
Nailed it!
回覆
Nice script!!! I m looking to get better signal with it because I see that it s not taking the wick of the candle in consideration when calculating do you know how can I add this on the scris. Thank you and keep up the great work.
回覆
@FonF0n, You can change the 'Source' to 'ohlc4' to consider the average of open-high-low-close or 'hl2' i.e. average of high & low. Is that what you meant to ask? Thanks for the thumbs up.
回覆
Very nice!!!
回覆