Do you watch for the 61.8% ADR retracements?
Re: XARD - Simple Trend Following Trading System
15821- These users thanked the author XXXX for the post (total 2):
- Curioso, LorenzoNexus
nil desperandum
Do you watch for the 61.8% ADR retracements?
Hello XXXX,
Code: Select all
//@version=5
indicator("Semafor", overlay=true, max_labels_count=300)
repaint = input(true, "Allow Drawing Of Unconfirmed Levels")
zigzag(Depth, Deviation, Color, Size, Type) =>
var int lw = 1
var int hg = 1
lw := lw + 1
hg := hg + 1
p_lw = -ta.lowestbars(Depth)
p_hg = -ta.highestbars(Depth)
lowing = lw == p_lw or low - low[p_lw] > Deviation*syminfo.mintick
highing = hg == p_hg or high[p_hg] - high > Deviation*syminfo.mintick
lh = ta.barssince(not highing)
ll = ta.barssince(not lowing)
down = lh > ll
lower = low[lw] > low[p_lw]
higher = high[hg] < high[p_hg]
if lw != p_lw and (not down[1] or lower)
lw := p_lw < hg ? p_lw : 0
if hg != p_hg and (down[1] or higher)
hg := p_hg < lw ? p_hg : 0
x1 = down ? lw : hg
y1 = down ? low[lw] : high[hg]
lb = down ? label.style_label_up : label.style_label_down
var label point = na
if repaint
point := label.new(bar_index-x1, y1, color=Color, style=label.style_circle, size=Size)
if down == down[1]
label.delete(point[1])
if not repaint and down != down[1]
nx = down ? hg : lw
point := label.new(bar_index-nx, down ? high[nx] : low[nx], color=Color, style=label.style_circle, size=Size)
down != down[1]
var switchOn = false
if input(true, "Large")
switchOn := zigzag(input.int(576, "Depth"), input(5.0, "Deviation"), input(color.red, "Color"), size.large, "Large") or switchOn
if input(true, "Medium")
switchOn := zigzag(input.int(144, "Depth"), input(6.0, "Deviation"), input(color.orange, "Color"), size.small , "Small") or switchOn
if input(false, "Small")
switchOn := zigzag(input.int(36, "Depth"), input(3.0, "Deviation"), input(color.lime, "Color"), size.tiny , "Tiny") or switchOn
alertcondition(switchOn, "Semafor Alert", "New Semafor Level Confirmed")
Hi Dacanba,dacanba wrote: Wed Jun 26, 2024 2:01 pm I have been working on tradingview, one of the good things about this platform is that you can immediately backtest the strategies.
Thanks to Chatgpt, I was able to convert the Semaphore indicator from version 4 to version 5. The difference between this indicator and Xard's is that you can choose whether or not you want confirmed signals, thereby avoiding many false signals that end up being repainted.
I asked Chatgpt to take it to MT4, but, I haven't had good results.
I leave you the mq4 file in case someone can fix it.
Este es el codigo en TradingviewGreetingsCode: Select all
//@version=5 indicator("Semafor", overlay=true, max_labels_count=300) repaint = input(true, "Allow Drawing Of Unconfirmed Levels") zigzag(Depth, Deviation, Color, Size, Type) => var int lw = 1 var int hg = 1 lw := lw + 1 hg := hg + 1 p_lw = -ta.lowestbars(Depth) p_hg = -ta.highestbars(Depth) lowing = lw == p_lw or low - low[p_lw] > Deviation*syminfo.mintick highing = hg == p_hg or high[p_hg] - high > Deviation*syminfo.mintick lh = ta.barssince(not highing) ll = ta.barssince(not lowing) down = lh > ll lower = low[lw] > low[p_lw] higher = high[hg] < high[p_hg] if lw != p_lw and (not down[1] or lower) lw := p_lw < hg ? p_lw : 0 if hg != p_hg and (down[1] or higher) hg := p_hg < lw ? p_hg : 0 x1 = down ? lw : hg y1 = down ? low[lw] : high[hg] lb = down ? label.style_label_up : label.style_label_down var label point = na if repaint point := label.new(bar_index-x1, y1, color=Color, style=label.style_circle, size=Size) if down == down[1] label.delete(point[1]) if not repaint and down != down[1] nx = down ? hg : lw point := label.new(bar_index-nx, down ? high[nx] : low[nx], color=Color, style=label.style_circle, size=Size) down != down[1] var switchOn = false if input(true, "Large") switchOn := zigzag(input.int(576, "Depth"), input(5.0, "Deviation"), input(color.red, "Color"), size.large, "Large") or switchOn if input(true, "Medium") switchOn := zigzag(input.int(144, "Depth"), input(6.0, "Deviation"), input(color.orange, "Color"), size.small , "Small") or switchOn if input(false, "Small") switchOn := zigzag(input.int(36, "Depth"), input(3.0, "Deviation"), input(color.lime, "Color"), size.tiny , "Tiny") or switchOn alertcondition(switchOn, "Semafor Alert", "New Semafor Level Confirmed")
aaaand it droped...
GOOD CALL