salut ;
je veux convertir ce code de cet indicateur pour pouvoir automatiser mes trading apres avec prorealtime
//@version=4
study(“METHOD SIGNALS”, overlay=true)
// author: METHOD
// last updated: 2024-04-23
leftBars = input(2)
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]
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 opposite signal is also on
se_filtered = se and not le
le_filtered = le and not se
// Filter consecutive entries
prev = 0
prev := se_filtered ? 1 : le_filtered ? -1 : prev[1]
se_final = se_filtered and prev[1] == -1
le_final = le_filtered and prev[1] == 1
plotshape(se_final, color=color.blue, text="BUY NOW!", style=shape.triangleup, location=location.belowbar)
plotshape(le_final, color=color.red, text="SELL NOW!", style=shape.triangledown, location=location.abovebar)
alertcondition(se_final, "BUY!", "")
alertcondition(le_final, "SELL!", "")