Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=5
- indicator('Gann medians', overlay=true, format=format.price, precision=12, max_bars_back=300)
- method1 = input.string('Median', options=['EMA', 'Median', 'SMA'])
- length1 = input(12)
- mult1 = input.int(1, minval=0, maxval=1)
- method2 = input.string('Median', options=['EMA', 'Median', 'SMA'])
- length2 = input(27)
- mult2 = input.int(1, minval=0, maxval=1)
- method3 = input.string('Median', options=['EMA', 'Median', 'SMA'])
- length3 = input(56)
- mult3 = input.int(1, minval=0, maxval=1)
- //----
- Avg(x, length, method) =>
- sma_1 = ta.sma(x, length)
- ema_1 = ta.ema(x, length)
- percentile_linear_interpolation_1 = ta.percentile_linear_interpolation(x, length, 50)
- method == 'SMA' ? sma_1 : method == 'EMA' ? ema_1 : percentile_linear_interpolation_1
- //----
- a1 = ta.highest(length1) - math.max(close, open)
- b1 = math.min(close, open) - ta.lowest(length1)
- c1 = math.max(close, open) + a1 * mult1
- d1 = math.min(close, open) - b1 * mult1
- a2 = ta.highest(length2) - math.max(close, open)
- b2 = math.min(close, open) - ta.lowest(length2)
- c2 = math.max(close, open) + a2 * mult2
- d2 = math.min(close, open) - b2 * mult2
- a3 = ta.highest(length3) - math.max(close, open)
- b3 = math.min(close, open) - ta.lowest(length3)
- c3 = math.max(close, open) + a3 * mult3
- d3 = math.min(close, open) - b3 * mult3
- //----
- e1 = Avg(c1, length1, method1)
- f1 = Avg(d1, length1, method1)
- g1 = 0
- cross_1 = ta.cross(close, f1)
- g1 := ta.cross(close, e1) ? 1 : cross_1 ? 0 : nz(g1[1])
- e2 = Avg(c2, length2, method2)
- f2 = Avg(d2, length2, method2)
- g2 = 0
- cross_2 = ta.cross(close, f2)
- g2 := ta.cross(close, e2) ? 1 : cross_2 ? 0 : nz(g2[1])
- e3 = Avg(c3, length3, method3)
- f3 = Avg(d3, length3, method3)
- g3 = 0
- cross_3 = ta.cross(close, f3)
- g3 := ta.cross(close, e3) ? 1 : cross_3 ? 0 : nz(g3[1])
- //---
- hilo1 = g1 * f1 + (1 - g1) * e1
- css1 = g1 == 1 ? color.green : color.red
- plot(hilo1, color=css1, style=plot.style_line, show_last=1, linewidth=1, trackprice=true, transp=0)
- hilo2 = g2 * f2 + (1 - g2) * e2
- css2 = g2 == 1 ? color.green : color.red
- plot(hilo2, color=css2, style=plot.style_line, show_last=1, linewidth=1, trackprice=true, transp=0)
- hilo3 = g3 * f3 + (1 - g3) * e3
- css3 = g3 == 1 ? color.green : color.red
- plot(hilo3, color=css3, style=plot.style_line, show_last=1, linewidth=1, trackprice=true, transp=0)
- //end of this part
- use_alt_series = input(defval=false, title='Use alternative source?')
- alt_src = input(defval=close, title='Alternative source:')
- hSR = use_alt_series ? alt_src : high
- lSR = use_alt_series ? alt_src : low
- window = input(defval=14, title='lookback window :')
- percent_of_range_for_trade_zone = input(defval=15.0, title='Percent of the range to use for trade zone') * 0.01
- short_term_top = ta.valuewhen(hSR >= ta.highest(hSR, window), hSR, 0)
- short_term_bot = ta.valuewhen(lSR <= ta.lowest(lSR, window), lSR, 0)
- short_term_resist = ta.change(short_term_top) != 0 ? na : short_term_top
- short_term_suport = ta.change(short_term_bot) != 0 ? na : short_term_bot
- short_term_resist_plot = plot(series=short_term_resist, title='STR', color=color.new(color.fuchsia, 0), linewidth=2, style=plot.style_linebr)
- short_term_suport_plot = plot(series=short_term_suport, title='STS', color=color.new(color.aqua, 0), linewidth=2, style=plot.style_linebr)
- fill(short_term_suport_plot, short_term_resist_plot, color=color.new(color.aqua, 95), title=' Trade Zone ')
- // Calculate entry zone:
- float short_term_resist_trade_limit = na
- float short_term_suport_trade_limit = na
- range_1 = fixnan(short_term_resist) - fixnan(short_term_suport)
- if not na(short_term_resist)
- if not na(short_term_resist_trade_limit[1])
- short_term_resist_trade_limit := short_term_resist_trade_limit[1]
- short_term_resist_trade_limit
- else
- short_term_resist_trade_limit := short_term_resist - range_1 * percent_of_range_for_trade_zone
- short_term_resist_trade_limit
- if not na(short_term_suport)
- if not na(short_term_suport_trade_limit[1])
- short_term_suport_trade_limit := short_term_suport_trade_limit[1]
- short_term_suport_trade_limit
- else
- short_term_suport_trade_limit := short_term_suport + range_1 * percent_of_range_for_trade_zone
- short_term_suport_trade_limit
- short_term_resist_trade_limit_plot = plot(series=short_term_resist_trade_limit, title='', color=color.new(color.red, 0), linewidth=1, style=plot.style_linebr)
- short_term_suport_trade_limit_plot = plot(series=short_term_suport_trade_limit, title='', color=color.new(color.yellow, 0), linewidth=1, style=plot.style_linebr)
- //end of this part
- lookback = input(defval=20, title='# of Candles to Look Back')
- srcAA = 'Close'
- pivothigh_1 = ta.pivothigh(high, lookback, lookback)
- pivothigh_2 = ta.pivothigh(high, lookback, lookback)
- pivot_high = srcAA == 'Close' ? pivothigh_1 : pivothigh_2
- pivotlow_1 = ta.pivotlow(low, lookback, lookback)
- pivotlow_2 = ta.pivotlow(low, lookback, lookback)
- pivot_low = srcAA == 'Close' ? pivotlow_1 : pivotlow_2
- valuewhen_9 = ta.valuewhen(pivot_high, high[lookback], 0)
- valuewhen_10 = ta.valuewhen(pivot_high, high[lookback], 0)
- plot_high = srcAA == 'Close' ? valuewhen_9 : valuewhen_10
- valuewhen_11 = ta.valuewhen(pivot_low, low[lookback], 0)
- valuewhen_12 = ta.valuewhen(pivot_low, low[lookback], 0)
- plot_low = srcAA == 'Close' ? valuewhen_11 : valuewhen_12
- resistance = plot(plot_high, style=plot.style_line, title='Resistance Line', color=color.new(color.orange, 0), show_last=1, linewidth=2, trackprice=true)
- support = plot(plot_low, style=plot.style_line, title='Support Line', color=color.new(color.orange, 0), show_last=1, linewidth=2, trackprice=true)
- //end of this part
- // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
- // © GokhanGoksin
- //study("ENGUL",shorttitle="engulf",overlay=true)
- x = input(title='çizgi/sağ uzat', defval=5)
- z = input(title='kaynak/seç/üst çizgi', defval=open)
- y = input(title='kaynak/seç/alt çizgi', defval=close)
- //****************************************************
- en = close[1] < open[1] and close > open[1] and low[1] > low
- plotshape(en, style=shape.arrowup, location=location.belowbar)
- //****************************************************** enguluf destek
- if en
- li = line.new(time[1], y[1], time + x * (time - time[1]), y[1], xloc=xloc.bar_time, color=color.red, width=2)
- li
- if en
- label.new(time + x * (time - time[1]), y[1], text='\n' + str.tostring(y[1]), xloc=xloc.bar_time, style=label.style_none, size=size.normal, textcolor=color.white, yloc=yloc.price)
- //********************************************************************** direnç
- if en
- line.new(time[1], z[1], time + x * (time - time[1]), z[1], xloc=xloc.bar_time, color=color.blue, width=2)
- if en
- l = label.new(time + x * (time - time[1]), z[1], text='\n' + str.tostring(z[1]), xloc=xloc.bar_time, style=label.style_none, size=size.normal, textcolor=color.white, yloc=yloc.price)
- l
- //end of this part
- // © weeklystockcharts
- // Candle Type w/ only 3-1 Pine Script
- //study("Candle Type w/only 3-1", overlay=true, precision=0)
- // check for 3-1 inside + up buy
- buyx = high[3] < high[2] and low[3] > low[2] and high[1] < high[2] and low[1] > low[2] and high > high[1] and high[1] <= high[2] and low[1] >= low[2] and not(low < low[1])
- plotchar(buyx, title='Inside + Up Buy Label', text='Up', location=location.belowbar, color=color.new(#4CAF50, 0))
- // check for 3-1 inside + dn sell
- sellx = high[3] < high[2] and low[3] > low[2] and high[1] < high[2] and low[1] > low[2] and low < low[1] and low[1] >= low[2] and high[1] <= high[2] and not(high > high[1])
- plotchar(sellx, title='Inside + Up Buy Label', text='Down', location=location.abovebar, color=color.new(color.red, 0))
- //end of this part
- //@version=5
- //indicator(title='Midline with Stationary and MTF Reversals', overlay=true)
- // User inputs
- midline = input.float(title='Midline Value', defval=50)
- show_midline = input(title='Show Midline', defval=true)
- // Calculate Midline
- midline_val = ta.rma(close, 20)
- // Draw Midline
- plot(show_midline ? midline_val : na, title='Midline', color=color.new(color.blue, 0), linewidth=2)
- // Calculate Stationary Reversals
- up = ta.change(midline_val) < 0
- down = ta.change(midline_val) > 0
- // Calculate Cosine Wave Standing Wave Filter
- len = input.int(title="Filter Length", defval=12)
- freq = input.float(title="Filter Frequency", defval=1.0, minval=0.1, maxval=10.0)
- sw = math.sin(freq) * midline_val
- filt = ta.sma(sw, len)
- filtered_reversals = ta.crossover(filt, 0)
- // Draw Filtered Reversals
- plotshape(filtered_reversals and up, title='Filtered Stationary Up Reversal', style=shape.triangleup, location=location.belowbar, color=color.new(color.green, 0), size=size.small)
- plotshape(filtered_reversals and down, title='Filtered Stationary Down Reversal', style=shape.triangledown, location=location.abovebar, color=color.new(color.red, 0), size=size.small)
- // Multi-Timeframe Reversals
- mtf_tf1 = input.timeframe(title='MTF Timeframe 1', defval='D')
- mtf_tf2 = input.timeframe(title='MTF Timeframe 2', defval='W')
- // Calculate MTF Reversals
- mtf_reversal1 = request.security(syminfo.tickerid, mtf_tf1, filtered_reversals and up)
- mtf_reversal2 = request.security(syminfo.tickerid, mtf_tf2, filtered_reversals and up)
- // Draw MTF Reversals
- plotshape(mtf_reversal1 and mtf_reversal2, title='MTF Reversal', style=shape.triangleup, location=location.belowbar, color=color.new(color.yellow, 0), size=size.small)
Advertisement
Add Comment
Please, Sign In to add comment