TradingView
racer8
18 Th09 2020 20:15

ATR Pivot Point Index [racer8] 

Euro Fx/U.S. DollarFXCM

Mô tả

Description:

ATR Pivot Point Index (ATR_PPI) is based on the theory of mean reversion.
I was inspired to create this indicator after watching a particular YouTube video on the UKspreadbetting channel.
In this video, the trader being interviewed mentioned that he would exit when price is too far from the moving average.
In other words, he exits when he thinks price will revert back to the moving average (mean reversion).
I'm not sure what period moving average he used, so I set it to the standard 14 periods.

I wanted to quantify his strategy so that the user can consistently exit a trade at a fixed distance away from the moving average.
For this indicator, this distance is in ATR units.
This strategy of exiting is known as the mean reversion exit strategy.
Alternatively, if the user wishes to, this indicator can also be used as an entry indicator (Trend entry strategy).
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Parameters:
1. Sma Period - controls length of moving average (Affects histogram).
2. Atr Period - controls length of Atr, doesn't have much affect on indicator (Affects histogram).
3. Atr Pivot Point Level - controls horizontal line, it determines how far away in Atr units you want to exit/enter from the sma for every trade.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Interpreting signals:

(Trend entry strategy) When histogram is...
Green - enter long
Red - enter short
Purple - No signal

(Mean reversion exit strategy) When histogram is...
Green - exit long
Red - exit short
Purple - No signal
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Calculation:
Distance = Absolute value of (current close - moving average(14))
ATR_units = Distance / ATR(14) ...........Plot as histogram.
Add horizontal line set at (2)*ATR .......Plot line.
Is histogram > line?
Yes, histogram color is green/red.
No, histogram color is purple.

Note: For mean reversion exit strategy, I recommend HIGHER Atr Pivot Point Level values. Vice versa for trend entry strategy.
Enjoy :)

Phát hành các Ghi chú

Minor fix of code.

Phát hành các Ghi chú

...
Changed ATR Pivot Point Level to a default value of 1 instead of 2.
Changed consolidation color from purple to gray :D

Phát hành các Ghi chú

>>>
- Changed consolidation color to indigo. Indigo is a rich color between blue and violet on the visible spectrum, it's a dark purplish blue.
- "ATR pivot point level" is now called "ATR level".

Phát hành các Ghi chú

>>>
Added a simple moving average for the histogram.

Phát hành các Ghi chú

>>>
Added option to show baseline (moving avg of histogram).

Phát hành các Ghi chú

Added bar colors.

Phát hành các Ghi chú

All values are now to 2 decimal places.
Bình luận
UnknownUnicorn16251912
Hello, nice work on mean reversion. I believe these are what institutions trade on. May I know if you can kindly update this script with alert conditions based on different colors of plot?

co = ATR_units>=x? (close>=avg? (ATR_units>ATR_units[1]? color.lime:color.teal):(ATR_units>ATR_units[1]? color.red:color.maroon)):#673ab7
plot(ATR_units,color=co,linewidth=2,style=plot.style_histogram,transp=0)
plot(ATR_units,color=co,linewidth=2,style=plot.style_line,transp=0)
burgercrisis
I plan on backtesting , possibly as part as a system with these basic rules:
Purple after green: enter short
Purple after red: enter long
could include additional rules such as
first green: enter long
first red: enter short
to reduce losses from choppy areas
or even:
3 dark greens : enter short
3 dark reds: enter long
etc
looks good

edit: another signal I'm seeing:

two peaks, same color, recent one is smaller, trade in opposite direction of color like above strats.

Example: Red peak, purple, smaller red peak, go long.
Green peak, purple, smaller green peak, go short.
racer8
@burgercrisis, GL & HF with it! Interesting rules I got to say!
burgercrisis
@racer8, I was just checking against chart visually and noticing some patterns. In time I shall know the capability of such rules
racer8
From now on, I'll be putting "racer8" in the indicator titles.
That way, it will be way easier to find all my indicators in the public library.
I hope you fellas enjoy this one...it's got lots of colors!
zschonn
@racer8, Fan of your probablity indicator, but now found this one is better than that one. Wish you the best for your future inventions. Many thanks
Thêm nữa