Pivot Reversal Strategy
Author: Ayjahsun1
Creation Date: 5/20/2020 8:35 PM
profile picture

Ayjahsun1

#1
Can someone please create this Pivot Reversal Strategy for me as an indicator?

strategy("Pivot Reversal Strategy", overlay=true)

leftBars = input(4)
rightBars = input(2)

swh = pivothigh(leftBars, rightBars)
swl = pivotlow(leftBars, rightBars)

swh_cond = not na(swh)

hprice = 0.0
hprice := swh_cond ? swh : hprice[1]

le = false
le := swh_cond ? true : (le[1] and high > hprice ? false : le[1])

if (le)
strategy.entry("PivRevLE", strategy.long, comment="PivRevLE", stop=hprice + syminfo.mintick)

swl_cond = not na(swl)

lprice = 0.0
lprice := swl_cond ? swl : lprice[1]


se = false
se := swl_cond ? true : (se[1] and low < lprice ? false : se[1])

if (se)
strategy.entry("PivRevSE", strategy.short, comment="PivRevSE", stop=lprice - syminfo.mintick)

//plot(strategy.equity, title="equity", color=color.red, linewidth=2, style=plot.style_areabr)
profile picture

Eugene

#2
For someone out there who might be interested in coding this for you, it's odd not to find clear trading rules in English nor any reference to the origin and trading platform in your request. Just give it a thought.
profile picture

Ayjahsun1

#3
Here is some more information if anyone is able to help i found this stratergy on tradingview.

This “trading signals” indicator plots buy and sell signals points entries when the price breaks the last pivot High/Low levels.

These levels are defined by price tops and bottoms found after the price made:

highest high with “leftP” candles on its left and “rightP” candles on its right
lowest low with “leftP” candles on its left and “rightP” candles on its right
The levels are marked with dark grey dots on the charts.

The signals are given during the candlestick formation and not afterwards.
profile picture

Eugene

#4
This should make it a bit more clear but I am still at a loss as to how these pivots differ from what is called swings or fractals. From your description (re: bars on the left and on the right) this should rather be the latter. Correct me if I'm wrong but (floor trader) pivots are nothing like what you describe:

Pivot Levels
Floor Trader Pivots

Before anything else, I recommend that you exhaust Wealth-Lab's built-in and extra tools for pivots and swings. Search existing strategies for keywords like "swing", "fractal" and "pivot":

Search the Wiki (if it doesn't work see this: post #21)
Search the Forum
Search strategies

You should find lots of examples among existing solutions developed to highlight and backtest the fractals, swings and pivots.

P.S. Zigzag is somewhat related but defines peaks and troughs with respect to a reversal amount rather the number of bars to the left/right.
profile picture

Ayjahsun1

#5
Thank you!
profile picture

Eugene

#6
Glad I could be of assistance.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).