Tradestation Indicator Pine Script Version 3
Pivot Reversal Strategy Alerts by Kozlod
See attachment for code and screen
First it will be necessary to program 2 new functions: pivothigh and pivotlow
Pivot High :Pivot Point Highs are determined by the number of bars with lower highs on either side of a Pivot Point High.
Pivot Point Lows are determined by the number of bars with higher lows on either side of a Pivot Point Low
didi059 – Please paste the code into your post rather than attaching a screen image of your code. This will make it more readable for others. Also providing an attachment of the original source code helps. This makes it easier for others to help you with your request.
//@version=3
study("Kozlod - Pivot Reversal Strategy Alerts", overlay=true)
//
// author: Kozlod
// date: 2018-03-11
//
////////////
// INPUTS //
////////////
leftBars = input(4)
rightBars = input(2)
/////////////
// SIGNALS //
/////////////
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])
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])
// Filter out signals if oposite signal is also on
se_filt = se and not le
le_filt = le and not se
// Filter out consecutive signals
prev = 0
prev := se_filt ? 1 : le_filt ? -1 : prev[1]
se_final = se_filt and prev[1] == -1
le_final = le_filt and prev[1] == 1
// Plot Signals
plotshape(se_final, color = red, text = "se")
plotshape(le_final, color = green, text = "le")
// Create cistom alserts
alertcondition(se_final, "se", "se")
alertcondition(le_final, "le", "le")
I made a complete new code based on this “strategy” (pinescript is from Tradingview, not tradestation).
It is now available in the library: Pivot Reversal Strategy Alerts
Dear Nicolas
Thank you for this work and sorry for the lapsus (this what happens when you are tired…)
May be the administrator can correct the title…
Title changed as requested!