Quantum Robot V3
//@version=5indicator('MagicScalpV1', shorttitle='MagicScalpV1', overlay=true)length = input(title='ATR Period', defval=1)mult = input.float(title='ATR Multiplier', step=0.1, defval=3.0)showLabels = input(title='Show Buy/Sell Labels ?', defval=true)useClose = input(title='Use Close Price for Extremums ?', defval=true)highlightState = input(title='Highlight State ?', defval=true)
atr = mult * ta.atr(length)
longStop = (useClose ? ta.highest(close, length) : ta.highest(length)) - atrlongStopPrev = nz(longStop[1], longStop)longStop := close[1] > longStopPrev ? math.max(longStop, longStopPrev) : longStop
shortStop = (useClose ? ta.lowest(close, length) : ta.lowest(length)) + atrshortStopPrev = nz(shortStop[1], shortStop)shortStop := close[1] < shortStopPrev ? math.min(shortStop, shortStopPrev) : shortStop
var int dir = 1dir := close > shortStopPrev ? 1 : close < longStopPrev ? -1 : dir
var color longColor = color.greenvar color shortColor = color.red
longStopPlot = plot(dir == 1 ? longStop : na, title='Long Stop', style=plot.style_linebr, linewidth=2, color=color.new(longColor, 0))buySignal = dir == 1 and dir[1] == -1plotshape(buySignal ? longStop : na, title='Long Stop Start', location=location.absolute, style=shape.circle, size=size.tiny, color=color.new(longColor, 0))plotshape(buySignal and showLabels ? longStop : na, title='Buy Label', text='Buy', location=location.absolute, style=shape.labelup, size=size.tiny, color=color.new(longColor, 0), textcolor=color.new(color.white, 0))
shortStopPlot = plot(dir == 1 ? na : shortStop, title='Short Stop', style=plot.style_linebr, linewidth=2, color=color.new(shortColor, 0))sellSignal = dir == -1 and dir[1] == 1plotshape(sellSignal ? shortStop : na, title='Short Stop Start', location=location.absolute, style=shape.circle, size=size.tiny, color=color.new(shortColor, 0))plotshape(sellSignal and showLabels ? shortStop : na, title='Sell Label', text='Sell', location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.new(shortColor, 0), textcolor=color.new(color.white, 0))
midPricePlot = plot(ohlc4, title='', style=plot.style_circles, linewidth=0, display=display.none, editable=false)
longFillColor = highlightState ? dir == 1 ? longColor : na : nashortFillColor = highlightState ? dir == -1 ? shortColor : na : nafill(midPricePlot, longStopPlot, title='Long State Filling', color=longFillColor, transp=90)fill(midPricePlot, shortStopPlot, title='Short State Filling', color=shortFillColor, transp=90)
changeCond = dir != dir[1]alertcondition(changeCond, title='Alert: CE Direction Change', message='Chandelier Exit has changed direction!')alertcondition(buySignal, title='Alert: CE Buy', message='Chandelier Exit Buy!')alertcondition(sellSignal, title='Alert: CE Sell', message='Chandelier Exit Sell!')
///////////Command
src = input(close, title='Source')kijun_ = input(false, title='Kijunsen Ac/Kapa')tenkan_ = input(false, title='Tenkansen Ac/Kapa')
smaAC = input(false, title='Basit Hareketli Ortalama Ac/Kapa')emaAC = input(false, title='Ustel Hareketli Ortalama Ac/Kapa')
//basit hareketli ortalamalarma200 = ta.sma(src, 200)ma100 = ta.sma(src, 100)ma50 = ta.sma(src, 50)ma20 = ta.sma(src, 20)plot(smaAC ? ma200 : na, color=color.new(color.orange, 0), title='MA200')plot(smaAC ? ma100 : na, color=color.new(color.blue, 0), title='MA100')plot(smaAC ? ma50 : na, color=color.new(color.red, 0), title='MA50')plot(smaAC ? ma20 : na, color=color.new(color.green, 0), title='MA20')
//Ustel hareketli ortalamalarema9 = ta.ema(src, 9)ema21 = ta.ema(src, 21)ema55 = ta.ema(src, 55)ema89 = ta.ema(src, 89)ema144 = ta.ema(src, 144)plot(emaAC ? ema9 : na, color=color.new(color.orange, 0), title='EMA9')plot(emaAC ? ema21 : na, color=color.new(color.blue, 0), title='EMA21')plot(emaAC ? ema55 : na, color=color.new(color.red, 0), title='EMA55')plot(emaAC ? ema89 : na, color=color.new(color.green, 0), title='EMA89')plot(emaAC ? ema144 : na, color=color.new(color.aqua, 0), title='EMA144')
//ichimoku // degerleri degistirmek isteyen // isaretlerini kaldirsinconversionPeriods = 9 //input(9, minval=1, title="Conversion Line Length")basePeriods = 26 //input(26, minval=1, title="Base Line Length")laggingSpan2Periods = 52 //input(52, minval=1, title="Lagging Span 2 Length")displacement = 26 //input(26, minval=1, title="Displacement")donchian(len) =>math.avg(ta.lowest(len), ta.highest(len))conversionLine = donchian(conversionPeriods)baseLine = donchian(basePeriods)leadLine1 = math.avg(conversionLine, baseLine)leadLine2 = donchian(laggingSpan2Periods)plot(tenkan_ ? conversionLine : na, color=color.new(#0496ff, 0), title='Tenkansen')plot(kijun_ ? baseLine : na, color=color.new(#991515, 0), title='Kijunsen')//CommandAUTO = "Auto"DAILY = "Daily"WEEKLY = "Weekly"MONTHLY = "Monthly"QUARTERLY = "Quarterly"YEARLY = "Yearly"BIYEARLY = "Biyearly"TRIYEARLY = "Triyearly"QUINQUENNIALLY = "Quinquennially"DECENNIALLY = "Decennially"
TRADITIONAL = "Traditional"FIBONACCI = "Fibonacci"WOODIE = "Woodie"CLASSIC = "Classic"DEMARK = "DM"CAMARILLA = "Camarilla"
kind = input.string(title="Type", defval="Traditional", options=[TRADITIONAL, FIBONACCI, WOODIE, CLASSIC, DEMARK, CAMARILLA])pivot_time_frame = input.string(title="Pivots Timeframe", defval=AUTO, options=[AUTO, DAILY, WEEKLY, MONTHLY, QUARTERLY, YEARLY, BIYEARLY, TRIYEARLY, QUINQUENNIALLY, DECENNIALLY])look_back = input.int(title="Number of Pivots Back", defval=15, minval=1, maxval=5000)is_daily_based = input.bool(title="Use Daily-based Values", defval=true, tooltip="When this option is unchecked, Pivot Points will use intraday data while calculating on intraday charts. If Extended Hours are displayed on the chart, they will be taken into account during the pivot level calculation. If intraday OHLC values are different from daily-based values (normal for stocks), the pivot levels will also differ.")show_labels = input.bool(title="Show Labels", defval=true, inline="labels")position_labels = input.string("Left", "", options=["Left", "Right"], inline="labels")
var DEF_COLOR = #FB8C00var arr_time = array.new_int()var p = array.new_float()p_show = input.bool(true, "P ", inline="P")p_color = input.color(DEF_COLOR, "", inline="P")var r1 = array.new_float()var s1 = array.new_float()s1r1_show = input.bool(true, "S1/R1", inline="S1/R1")s1r1_color = input.color(DEF_COLOR, "", inline="S1/R1")var r2 = array.new_float()var s2 = array.new_float()s2r2_show = input.bool(true, "S2/R2", inline="S2/R2")s2r2_color = input.color(DEF_COLOR, "", inline="S2/R2")var r3 = array.new_float()var s3 = array.new_float()s3r3_show = input.bool(true, "S3/R3", inline="S3/R3")s3r3_color = input.color(DEF_COLOR, "", inline="S3/R3")var r4 = array.new_float()var s4 = array.new_float()s4r4_show = input.bool(true, "S4/R4", inline="S4/R4")s4r4_color = input.color(DEF_COLOR, "", inline="S4/R4")var r5 = array.new_float()var s5 = array.new_float()s5r5_show = input.bool(true, "S5/R5", inline="S5/R5")s5r5_color = input.color(DEF_COLOR, "", inline="S5/R5")pivotX_open = float(na)pivotX_open := nz(pivotX_open[1], open)pivotX_high = float(na)pivotX_high := nz(pivotX_high[1], high)pivotX_low = float(na)pivotX_low := nz(pivotX_low[1], low)pivotX_prev_open = float(na)pivotX_prev_open := nz(pivotX_prev_open[1])pivotX_prev_high = float(na)pivotX_prev_high := nz(pivotX_prev_high[1])pivotX_prev_low = float(na)pivotX_prev_low := nz(pivotX_prev_low[1])pivotX_prev_close = float(na)pivotX_prev_close := nz(pivotX_prev_close[1])
get_pivot_resolution() =>resolution = "M"if pivot_time_frame == AUTOif timeframe.isintradayresolution := timeframe.multiplier <= 15 ? "D" : "W"else if timeframe.isweekly or timeframe.ismonthlyresolution := "12M"else if pivot_time_frame == DAILYresolution := "D"else if pivot_time_frame == WEEKLYresolution := "W"else if pivot_time_frame == MONTHLYresolution := "M"else if pivot_time_frame == QUARTERLYresolution := "3M"else if pivot_time_frame == YEARLY or pivot_time_frame == BIYEARLY or pivot_time_frame == TRIYEARLY or pivot_time_frame == QUINQUENNIALLY or pivot_time_frame == DECENNIALLYresolution := "12M"resolution
var lines = array.new_line()var labels = array.new_label()
draw_line(i, pivot, col) =>if array.size(arr_time) > 1array.push(lines, line.new(array.get(arr_time, i), array.get(pivot, i), array.get(arr_time, i + 1), array.get(pivot, i), color=col, xloc=xloc.bar_time))
draw_label(i, y, txt, txt_color) =>if show_labelsoffset = ' 'labels_align_str_left= position_labels == "Left" ? txt + offset : offset + txtx = position_labels == "Left" ? array.get(arr_time, i) : array.get(arr_time, i + 1)array.push(labels, label.new(x = x, y=y, text=labels_align_str_left, textcolor=txt_color, style=label.style_label_center, color=#00000000, xloc=xloc.bar_time))
Stampa ArticoloHai trovato utile questa risposta?
Leggi anche
Powered by WHMCompleteSolution