PHP Code:
	
//@version=5
indicator("olimpik forum",overlay=true,max_boxes_count=50,max_labels_count=50,max_lines_count=144,max_bars_back=1000)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
// ~~ Settings {
// ~~ Tooltips
var t1 = "Reverses the orientation of labels and calculations in the Gann Box, offering alternative analytical perspectives."
var t2 = "Extend the drawing of Gann lines or boxes into the future beyond the current last bar to anticipate potential support or resistance levels. This setting is crucial for traders looking to forecast future price movements and prepare for potential market reactions at these extended levels."
var t3 = "Enables or disables the display of the Gann Box. When enabled, the Gann Box will be visible on the chart, illustrating key levels based on selected high and low points. The Gann Box is a fundamental tool in Gann analysis, providing insights into potential support and resistance levels, and enabling traders to identify strategic entry and exit points."
var t4 = "Enables or disables the display of Fibonacci labels within the Gann Box and Gann Fan. Useful for identifying specific Fibonacci retracement levels for support or resistance, these labels help traders to quickly recognize significant percentage levels that are often considered in trading strategies for their potential to indicate reversal points."
var t5 = "Enables or disables the display of Gann Curves. When enabled, it draws curves based on Gann percentages to predict potential market movements. These curves offer a dynamic view of potential support and resistance levels as they adjust to changing market conditions, aiding in the analysis of momentum and trend strength."
var t6 = "Enables or disables the display of Gann Angles. These are diagonal lines that extend from significant price points to provide insights into future support and resistance levels. Gann Angles are a cornerstone of Gann theory, offering a unique perspective on price and time dynamics that can signal significant market movements."
//~~}
//General{
reverse   = input.bool(false,title="Reverse",group="General Settings",tooltip=t1)
Future    = input.bool(true, title="Extend",group="General Settings",tooltip=t2)
//~~}
//Levels
perc = array.from(input.float(25.0,title="",step=.1,inline="1", group="Gann Box")/100,
 input.float(38.2,title="",step=.1,inline="2", group="Gann Box")/100,
 input.float(50.0,title="",step=.1,inline="3", group="Gann Box")/100,
 input.float(61.8,title="",step=.1,inline="4", group="Gann Box")/100,
 input.float(75.0,title="",step=.1,inline="5", group="Gann Box")/100)
//Curve{
showCurve = input.bool(true, title="Show Curves",group="Gann Curves",tooltip=t5)
cperc = array.from(input.bool(true,"25%",inline="c1",group="Gann Curves"),
 input.bool(true,"38.2%",inline="c2",group="Gann Curves"),
 input.bool(true,"50%",inline="c3",group="Gann Curves"),
 input.bool(true,"61.8%",inline="c4",group="Gann Curves"),
 input.bool(true,"75%",inline="c5",group="Gann Curves"),
 input.bool(true,"100%",inline="c6",group="Gann Curves"))
//Coloring
ccol = array.from(input.color(#ff0000,"",inline="c1",group="Gann Curves"),
 input.color(#ff0000,"",inline="c2",group="Gann Curves"),
 input.color(#ff0000,"",inline="c3",group="Gann Curves"),
 input.color(#ff0000,"",inline="c4",group="Gann Curves"),
 input.color(#ff0000,"",inline="c5",group="Gann Curves"),
 input.color(#ff0000,"",inline="c6",group="Gann Curves"))
//~~}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
// ~~ Variables {
b = bar_index
var float Hi = na
var float Lo = na
var int hLoc = na
var int lLoc = na 
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
// ~~ Storage {
var polyline [] arr = array.new<polyline>(7)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
// ~~ Visible Chart Function {
barIsVisible() => time >= chart.left_visible_bar_time and time <= chart.right_visible_bar_time
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
// ~~ Main {
//Visible High & Low{
if barIsVisible() and high >= nz(Hi, high)
    Hi := high
    hLoc := bar_index
if barIsVisible() and low <= nz(Lo, low)
    Lo := low
    lLoc := bar_index
x0 = lLoc<hLoc?lLoc:hLoc
x6 = lLoc<hLoc?(Future?math.min(bar_index+500,hLoc+(hLoc-lLoc)):hLoc):(Future?math.min(bar_index+500,lLoc+(lLoc-hLoc)):lLoc)
y0 = lLoc<hLoc?Lo:Hi
y6 = lLoc<hLoc?Hi:Lo
//~~}
//Fibonacci Levels{
x = array.new<int>(1,x0)
y = array.new<float>(1,y0)
for i=0 to 4
    x.push(math.round(x0+(x6-x0)*array.get(perc,i)))
    y.push(y0+(y6-y0)*array.get(perc,i))
    if i==4
        x.push(x6)
        y.push(y6)
//~~}
// ~~ Gann Curve {
if showCurve and barIsVisible()
    for i=1 to arr.size()-1
        if cperc.get(i-1)
            points = array.new<chart.point>()
            for j = 0 to 90 by 1
                xx = x0 - (x0-x.get(i))*math.sin(math.toradians(j))
                yy = y0 + math.cos(math.toradians(j))*(y.get(i)-y0)
                points.push(chart.point.from_index(math.round(xx),yy))
            poly = polyline.new(points,false,false,line_color=ccol.get(i-1))
            arr.unshift(poly)
            arr.pop().delete()
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
src =  input(hl2, title="Source",group = "Trend Continuation Signals with TP & SL")
Multiplier = input.float(2,title="Sensitivity (0.5 - 5)", step=0.1, defval=2, minval=0.5, maxval=5,group = "Trend Continuation Signals with TP & SL")
atrPeriods = input.int(14,title="ATR Length", defval=10,group = "Trend Continuation Signals with TP & SL")
atrCalcMethod= input.string("Method 1",title = "ATR Calculation Methods",options = ["Method 1","Method 2"],group = "Trend Continuation Signals with TP & SL")
cloud_val = input.int(10,title = "Cloud Moving Average Length", defval = 10, minval = 5, maxval = 500,group = "Trend Continuation Signals with TP & SL")
stopLossVal  = input.float(2.0, title="Stop Loss Percent (0 for Disabling)", minval=0,group = "Trend Continuation Signals with TP & SL")
showBuySellSignals = input.bool(true,title="Show Buy/Sell Signals", defval=true,group = "Trend Continuation Signals with TP & SL")
showMovingAverageCloud = input.bool(false, title="Show Cloud MA",group = "Trend Continuation Signals with TP & SL")
percent(nom, div) =>
    100 * nom / div
src1 = ta.hma(open, 5)[1] 
src2 = ta.hma(close, 12)
momm1 = ta.change(src1)
momm2 = ta.change(src2)
f1(m, n) => m >= n ? m : 0.0
f2(m, n) => m >= n ? 0.0 : -m
m1 = f1(momm1, momm2)
m2 = f2(momm1, momm2)
sm1 = math.sum(m1, 1)
sm2 = math.sum(m2, 1)
cmoCalc = percent(sm1-sm2, sm1+sm2)
 
hh = ta.highest(2)
h1 = ta.dev(hh, 2) ? na : hh
hpivot = fixnan(h1)
ll = ta.lowest(2)
l1 = ta.dev(ll, 2) ? na : ll
lpivot = fixnan(l1)
 
rsiCalc = ta.rsi(close,9)
lowPivot =  lpivot  
highPivot =  hpivot
 
sup = rsiCalc < 25 and cmoCalc > 50  and lowPivot
res = rsiCalc > 75 and cmoCalc < -50  and highPivot
atr2 = ta.sma(ta.tr, atrPeriods)
atr= atrCalcMethod == "Method 1" ? ta.atr(atrPeriods) : atr2
up=src-(Multiplier*atr)
up1 = nz(up[1],up)
up := close[1] > up1 ? math.max(up,up1) : up
dn=src+(Multiplier*atr)
dn1 = nz(dn[1], dn)
dn := close[1] < dn1 ? math.min(dn, dn1) : dn
 
trend = 1
trend := nz(trend[1], trend)
trend := trend == -1 and close > dn1 ? 1 : trend == 1 and close < up1 ? -1 : trend
buySignal = trend == 1 and trend[1] == -1
sellSignal = trend == -1 and trend[1] == 1
 
pos = 0.0
pos:= buySignal? 1 : sellSignal ? -1 : pos[1]
 
longCond  = buySignal and pos[1]!= 1
shortCond = sellSignal and pos[1]!=-1
 
entryOfLongPosition  = ta.valuewhen(longCond , close, 0)
entryOfShortPosition = ta.valuewhen(shortCond, close, 0)
 
sl  = stopLossVal > 0 ? stopLossVal / 100 : 99999
 
stopLossForLong  = entryOfLongPosition  * (1 - sl)
stopLossForShort = entryOfShortPosition * (1 + sl)
 
takeProfitForLong1R  = entryOfLongPosition  * (1 + sl)
takeProfitForShort1R = entryOfShortPosition * (1 - sl)
 
takeProfitForLong2R  = entryOfLongPosition  * (1 + sl*2)
takeProfitForShort2R = entryOfShortPosition * (1 - sl*2)
 
takeProfitForLong3R  = entryOfLongPosition  * (1 + sl*3)
takeProfitForShort3R = entryOfShortPosition * (1 - sl*3)
 
long_sl  = low < stopLossForLong  and pos[1]==1
short_sl = high> stopLossForShort and pos[1]==-1
 
takeProfitForLongFinal  = high>takeProfitForLong3R  and pos[1]==1
takeProfitForShortFinal = low <takeProfitForShort3R and pos[1]==-1
 
if long_sl or short_sl or takeProfitForLongFinal or takeProfitForShortFinal
    pos:=0
 
lindex = ta.valuewhen(longCond, bar_index, 0)
sindex= ta.valuewhen(shortCond, bar_index, 0)
 
entryColor = pos==1? color.blue : color.purple
 
if barstate.islast and pos!=0
    lineEntry  = line.new(bar_index, pos>0?entryOfLongPosition :entryOfShortPosition , pos>0?lindex:sindex, pos>0?entryOfLongPosition :entryOfShortPosition , color=entryColor  )
    line.delete(lineEntry[1])
    stopLine  = line.new(bar_index, pos>0?stopLossForLong :stopLossForShort , pos>0?lindex:sindex, pos>0?stopLossForLong :stopLossForShort , color=color.red  )
    tpLine1 = line.new(bar_index, pos>0?takeProfitForLong1R:takeProfitForShort1R, pos>0?lindex:sindex, pos>0?takeProfitForLong1R:takeProfitForShort1R, color=color.green)
    tpLine2 = line.new(bar_index, pos>0?takeProfitForLong2R:takeProfitForShort2R, pos>0?lindex:sindex, pos>0?takeProfitForLong2R:takeProfitForShort2R, color=color.green)
    tpLine3 = line.new(bar_index, pos>0?takeProfitForLong3R:takeProfitForShort3R, pos>0?lindex:sindex, pos>0?takeProfitForLong3R:takeProfitForShort3R, color=color.green)
    line.delete(stopLine [1])
    line.delete(tpLine1[1])
    line.delete(tpLine2[1])
    line.delete(tpLine3[1])
 
    labelEntry  = label.new(bar_index, pos>0?entryOfLongPosition :entryOfShortPosition , color=entryColor  , textcolor=#000000, style=label.style_label_left, text="Giriş: " + str.tostring(pos>0?entryOfLongPosition :entryOfShortPosition ))
    label.delete(labelEntry[1])    
 
    labelStop  = label.new(bar_index, pos>0?stopLossForLong :stopLossForShort , color=color.red  , textcolor=#000000, style=label.style_label_left, text="Stop: " + str.tostring(math.round((pos>0?stopLossForLong :stopLossForShort) *100)/100))
    labelTp1 = label.new(bar_index, pos>0?takeProfitForLong1R:takeProfitForShort1R, color=color.green, textcolor=#000000, style=label.style_label_left, text="(1-Kar Al: " +str.tostring(math.round((pos>0?takeProfitForLong1R:takeProfitForShort1R) * 100)/100))
    labelTp2 = label.new(bar_index, pos>0?takeProfitForLong2R:takeProfitForShort2R, color=color.green, textcolor=#000000, style=label.style_label_left, text="(2-Kar Al: " + str.tostring(math.round((pos>0?takeProfitForLong2R:takeProfitForShort2R) * 100)/100))
    labelTp3 = label.new(bar_index, pos>0?takeProfitForLong3R:takeProfitForShort3R, color=color.green, textcolor=#000000, style=label.style_label_left, text="(3-Kar Al: " + str.tostring(math.round((pos>0?takeProfitForLong3R:takeProfitForShort3R) * 100)/100))
    label.delete(labelStop [1])
    label.delete(labelTp1[1])
    label.delete(labelTp2[1])
    label.delete(labelTp3[1])    
 
changeCond = trend != trend[1]
smaSrcHigh = ta.ema(high,cloud_val)
smaSrcLow = ta.ema(low, cloud_val)
[macdLine, signalLine, histLine] = ta.macd(close, 12, 26, 9)
//plot_high = plot(showMovingAverageCloud? smaSrcHigh : na, color = na, transp = 1, editable = false)
//plot_low  = plot(showMovingAverageCloud? smaSrcLow  : na, color = na, transp = 1, editable = false)
//plotshape(longCond ? up : na, title="UpTrend Begins", location=location.belowbar, style=shape.circle, size=size.tiny, color=color.new(color.teal,transp = 50) )
plotshape(longCond and showBuySellSignals ? up : na, title="Buy", text="Al", location=location.belowbar, style=shape.labelup, size=size.tiny, color=color.new(color.lime,transp=50), textcolor=color.white )
//plotshape(shortCond ? dn : na, title="DownTrend Begins", location=location.abovebar, style=shape.circle, size=size.tiny, color=color.new(color.red,transp = 50) )
plotshape(shortCond and showBuySellSignals ? dn : na, title="Sell", text="Sat", location=location.abovebar, style=shape.labeldown, size=size.tiny, color=color.new(color.red,transp=50), textcolor=color.white)
///////////////////////
length4 = input.int(title = "Range", defval = 20, minval = 1)
length5 = input.int(title = "Denge", defval = 100, minval = 1)
offset4 = input(title = "Range", defval = 0)
offset5 = input(title = "Denge", defval = 0)
src77=  input(close)
ama4 = 0.
ama5 = 0.
hh4 = math.max(math.sign(ta.change(ta.highest(length4))), 0)
ll4 = math.max(math.sign(ta.change(ta.lowest(length4)) * -1), 0)
tc4 = math.pow(ta.sma(hh4 or ll4 ? 1 : 0, length4), 2)
ama4 := nz(ama4[1] + tc4 * (src77 - ama4[1]), src77)
hh5 = math.max(math.sign(ta.change(ta.highest(length5))), 0)
ll5 = math.max(math.sign(ta.change(ta.lowest(length5))* -1), 0)
tc5 = math.pow(ta.sma(hh5 or ll5 ? 1 : 0, length5), 2)
ama5 := nz(ama5[1] + tc5 * (src77 - ama5[1]), src77)
plot(ama4, 'Range', color.new(#ccff00, 0), 2, offset = offset4)
plot(ama5, 'Denge', color.new(#df00fc, 0), 2, offset = offset5)
////////////
import loxx/loxxexpandedsourcetypes/4
greencolor = #2DD204
redcolor = #D2042D 
fdRange(int size)=>
    out = math.max(nz(close[size]), ta.highest(high, size)) - math.min(nz(close[size]), ta.lowest(low, size))
    out 
jurikFractalDimension(int size, int count)=>
    int window1 = size * (count - 1)
    int window2 = size * count
    float smlRange = 0
    float smlSumm = 0
    smlRange := fdRange(size)
    smlSumm := nz(smlSumm[1]) + smlRange
    smlSumm -= nz(smlRange[window1])
    out = 2.0 - math.log(fdRange(window2) / (smlSumm / window1)) / math.log(count)
    out
kama(float src, int period, float fast, float slow, float power, bool JurikFD)=>
    float fastend = (2.0 / (fast + 1))
    float slowend = (2.0 / (slow + 1))
    float efratio = 0
    float diff = 0
    float signal = 0
    float noise = 0
    float fract = jurikFractalDimension(period, 2)
    if (JurikFD) 
        efratio := math.min(2.0 - fract, 1.0)
    else 
        signal := math.abs(src - nz(src[period]))
        diff := math.abs(src - nz(src[1]))
        for k = 0 to period - 1 
            noise += nz(diff[k])
        if (noise != 0)
            efratio := signal / noise
        else 
            efratio := 1
    float smooth = math.pow(efratio * (fastend - slowend) + slowend, power)
    float kama = src
    kama := nz(kama[1]) + smooth * (src - nz(kama[1]))
    kama
gkyzvol(int per)=>
    float gzkylog = math.log(open / nz(close[1]))
    float pklog = math.log(high / low)
    float gklog = math.log(close / open)
    float garmult = (2 * math.log(2) - 1)
    
    float gkyzsum = 1 / per * math.sum(math.pow(gzkylog, 2), per)
    float parkinsonsum = 1 / (2 * per) * math.sum(math.pow(pklog, 2), per)
    float garmansum = garmult / per * math.sum(math.pow(gklog, 2), per)
    
    float sum = gkyzsum + parkinsonsum - garmansum
    float devpercent = math.sqrt(sum)  
    devpercent
gkyzFilter(float src, int len, float filter)=>
    float price = src
    float filtdev = filter * gkyzvol(len) * src
    price := math.abs(price - nz(price[1])) < filtdev ? nz(price[1]) : price
    price
smthtype = input.string("Kaufman", "Heikin-Ashi Better Caculation Type", options = ["AMA", "T3", "Kaufman"], group = "Source Settings")
srcin = input.string("Close", "Source", group= "Source Settings", 
     options = 
     ["Close", "Open", "High", "Low", "Median", "Typical", "Weighted", "Average", "Average Median Body", "Trend Biased", "Trend Biased (Extreme)", 
     "HA Close", "HA Open", "HA High", "HA Low", "HA Median", "HA Typical", "HA Weighted", "HA Average", "HA Average Median Body", "HA Trend Biased", "HA Trend Biased (Extreme)",
     "HAB Close", "HAB Open", "HAB High", "HAB Low", "HAB Median", "HAB Typical", "HAB Weighted", "HAB Average", "HAB Average Median Body", "HAB Trend Biased", "HAB Trend Biased (Extreme)"])
AmaPeriod = input.int(10, "AMA Period", group = "Basic Settings")
FastEnd = input.int(2, "Fast-End", group = "Basic Settings")
SlowEnd = input.int(20, "Slow-End", group = "Basic Settings")
SmoothPower = input.int(2, "Smooth Power", group = "Basic Settings")
JurikFDAdaptive = input.bool(false, "Jurik Fractal Dimension Adaptive?", group = "Basic Settings")
filterop = input.string("Both", "Filter Options", options = ["Price", "JFDAGKYZFKAMA", "Both", "None"], group=  "Filter Settings")
filter = input.float(0.5, "Filter Multiple", minval = 0, group= "Filter Settings")
filterperiod = input.int(15, "Filter Period", minval = 0, group= "Filter Settings")
colorbars = input.bool(true, "Color bars?", group= "UI Options")
showSigs = input.bool(true, "Show Signals?", group = "UI Options")
kfl=input.float(0.666, title="* Kaufman's Adaptive MA (KAMA) Only - Fast End", group = "Moving Average Inputs")
ksl=input.float(0.0645, title="* Kaufman's Adaptive MA (KAMA) Only - Slow End", group = "Moving Average Inputs")
amafl = input.int(2, title="* Adaptive Moving Average (AMA) Only - Fast", group = "Moving Average Inputs")
amasl = input.int(30, title="* Adaptive Moving Average (AMA) Only - Slow", group = "Moving Average Inputs")
haclose = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, close)
haopen = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, open)
hahigh = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, high)
halow = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, low)
hamedian = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, hl2)
hatypical = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, hlc3)
haweighted = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, hlcc4)
haaverage = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, ohlc4)
float src99 = switch srcin
    "Close" => loxxexpandedsourcetypes.rclose()
    "Open" => loxxexpandedsourcetypes.ropen()
    "High" => loxxexpandedsourcetypes.rhigh()
    "Low" => loxxexpandedsourcetypes.rlow()
    "Median" => loxxexpandedsourcetypes.rmedian()
    "Typical" => loxxexpandedsourcetypes.rtypical()
    "Weighted" => loxxexpandedsourcetypes.rweighted()
    "Average" => loxxexpandedsourcetypes.raverage()
    "Average Median Body" => loxxexpandedsourcetypes.ravemedbody()
    "Trend Biased" => loxxexpandedsourcetypes.rtrendb()
    "Trend Biased (Extreme)" => loxxexpandedsourcetypes.rtrendbext()
    "HA Close" => loxxexpandedsourcetypes.haclose(haclose)
    "HA Open" => loxxexpandedsourcetypes.haopen(haopen)
    "HA High" => loxxexpandedsourcetypes.hahigh(hahigh)
    "HA Low" => loxxexpandedsourcetypes.halow(halow)
    "HA Median" => loxxexpandedsourcetypes.hamedian(hamedian)
    "HA Typical" => loxxexpandedsourcetypes.hatypical(hatypical)
    "HA Weighted" => loxxexpandedsourcetypes.haweighted(haweighted)
    "HA Average" => loxxexpandedsourcetypes.haaverage(haaverage)
    "HA Average Median Body" => loxxexpandedsourcetypes.haavemedbody(haclose, haopen)
    "HA Trend Biased" => loxxexpandedsourcetypes.hatrendb(haclose, haopen, hahigh, halow)
    "HA Trend Biased (Extreme)" => loxxexpandedsourcetypes.hatrendb(haclose, haopen, hahigh, halow)
    "HAB Close" => loxxexpandedsourcetypes.habclose(smthtype, amafl, amasl, kfl, ksl)
    "HAB Open" => loxxexpandedsourcetypes.habopen(smthtype, amafl, amasl, kfl, ksl)
    "HAB High" => loxxexpandedsourcetypes.habhigh(smthtype, amafl, amasl, kfl, ksl)
    "HAB Low" => loxxexpandedsourcetypes.hablow(smthtype, amafl, amasl, kfl, ksl)
    "HAB Median" => loxxexpandedsourcetypes.habmedian(smthtype, amafl, amasl, kfl, ksl)
    "HAB Typical" => loxxexpandedsourcetypes.habtypical(smthtype, amafl, amasl, kfl, ksl)
    "HAB Weighted" => loxxexpandedsourcetypes.habweighted(smthtype, amafl, amasl, kfl, ksl)
    "HAB Average" => loxxexpandedsourcetypes.habaverage(smthtype, amafl, amasl, kfl, ksl)
    "HAB Average Median Body" => loxxexpandedsourcetypes.habavemedbody(smthtype, amafl, amasl, kfl, ksl)
    "HAB Trend Biased" => loxxexpandedsourcetypes.habtrendb(smthtype, amafl, amasl, kfl, ksl)
    "HAB Trend Biased (Extreme)" => loxxexpandedsourcetypes.habtrendbext(smthtype, amafl, amasl, kfl, ksl)
    => haclose
    
src99 := filterop == "Both" or filterop == "Price" and filter > 0 ? gkyzFilter(src99, filterperiod, filter) : src99
out = kama(src99, AmaPeriod, FastEnd, SlowEnd, SmoothPower, JurikFDAdaptive)
out := filterop == "Both" or filterop == "JFDAGKYZFKAMA" and filter > 0 ? gkyzFilter(out, filterperiod, filter) : out
sig = out[1]
goLong_pre = ta.crossover(out, sig)
goShort_pre = ta.crossunder(out, sig)
contSwitch = 0
contSwitch := nz(contSwitch[1])
contSwitch := goLong_pre ? 1 : goShort_pre ? -1 : contSwitch
goLong = goLong_pre and ta.change(contSwitch)
goShort = goShort_pre and ta.change(contSwitch)
colorout = contSwitch == 1  ? greencolor : redcolor
barcolor(colorbars ? colorout : na)
//////////////////////////////
Price = input(hl2, title='Price')
PeriodF = input(10, title='PeriodF')
PeriodS = input(50, title='PeriodS')
EnableSmooth = input(true, title='EnableSmooth')
AMA(Period, Price) =>
    //Vars: 
    Noise = 0.00
    Signal = 0.00
    Diff = 0.00
    efRatio = 0.00
    Smooth = 1.00
    Fastest = 0.6667
    Slowest = 0.0645
    AdaptMA = 0.00
    AMA = 0.00
    Diff := math.abs(Price - nz(Price[1]))
    if bar_index <= Period
        AdaptMA := Price
        AdaptMA
    if bar_index > Period
        Signal := math.abs(Price - nz(Price[Period]))
        Noise := math.sum(Diff, Period)
        efRatio := Signal / Noise
        Smooth := math.pow(efRatio * (Fastest - Slowest) + Slowest, 2)
        AdaptMA := nz(AdaptMA[1]) + Smooth * (Price - nz(AdaptMA[1]))
        AdaptMA
    AMA := AdaptMA
    AMA
AMAF(Period, Pcnt, Price) =>
    //Vars: 
    Noise = 0.00
    Signal = 0.00
    Diff = 0.00
    efRatio = 0.00
    Smooth = 1.00
    Fastest = 0.6667
    Slowest = 0.0645
    AdaptMA = 0.00
    AMAFltr = 0.00
    AMAF = 0.00
    Diff := math.abs(Price - nz(Price[1]))
    if bar_index <= Period
        AdaptMA := Price
        AdaptMA
    if bar_index > Period
        Signal := math.abs(Price - nz(Price[Period]))
        Noise := math.sum(Diff, Period)
        efRatio := Signal / Noise
        Smooth := math.pow(efRatio * (Fastest - Slowest) + Slowest, 2)
        AdaptMA := nz(AdaptMA[1]) + Smooth * (Price - nz(AdaptMA[1]))
        AMAFltr := ta.stdev(AdaptMA - nz(AdaptMA[1]), Period) * Pcnt
        AMAFltr
    AMAF := AMAFltr
    AMAF
//Vars: 
AMAValF = 0.00
AMAValS = 0.00
AMAValF := EnableSmooth ? ta.linreg(AMA(PeriodF, Price), PeriodF, 0) : AMA(PeriodF, Price)
AMAValS := EnableSmooth ? ta.linreg(AMA(PeriodS, Price), PeriodS, 0) : AMA(PeriodS, Price)
Plot1 = plot(AMAValF, 'Hızlı10', color=color.new(#ffeb3b, 100), linewidth=2)
Plot2 = plot(AMAValS, 'Yavaş50', color=color.new(#df40fb, 100), linewidth=2)
fill(Plot1, Plot2, color=AMAValF > AMAValS ? color.rgb(255, 235, 59, 60) : color.rgb(223, 64, 251, 60))
long = ta.crossover(AMAValF, AMAValS)
short = ta.crossunder(AMAValF, AMAValS)
// Plots labels
l = short ? label.new(bar_index, AMAValF, 'SAT', color=color.red, textcolor=color.white, style=label.style_label_down, yloc=yloc.price, size=size.small) : long ? label.new(bar_index, AMAValF, 'AL', color=color.green, textcolor=color.white, style=label.style_label_up, yloc=yloc.price, size=size.small) : na
//////////// 
 
				
Yer İmleri