BITFINEX:BTCUSD   Bitcoin / Dolar
Ichimoku bulutu ve hareketli ortalamaya göre çalışan pine script kodu aşağıdadır.

//@version=2
//strategy('Complete Ichimoku Trader *modified* - original by @kingthies / mod by @cryptomrdavis', shorttitle='Complete Ichimoku Trader *modified* - original by @kingthies / mod by @cryptomrdavis', overlay=true)
study('Complete Ichimoku Trader *modified* - by @cryptomrdavis -', shorttitle='Complete Ichimoku Trader *modified* - @cryptomrdavis -', overlay=true)

sp = input(true, title="Welcome to the modified Version of the Complete Ichimoku Trader - original by @ethies. This version has some extra lines of code and gives you less signals as the original one.")
haopen = open
hahigh = high
halow = low
haclose = close
heikUpColor() => haclose > haopen
heikDownColor() => haclose <= haopen
o = haopen
c = haclose
src = haclose
price = haclose

rsilength = input(13, title="RSI")
VolSMA = input(20, title="Volume")
uptrendlength = input(2, title="Uptrend Length")
downtrendlength = input(2, title="Downtrend Length")
ShowCloud = input(false, title="Show Ichimoku Cloud?")
ShowIchiLines = input(false, title="Show Ichimoku Lines?")

v1 = volume
v2 = sma ( volume ,VolSMA)

// RSI //
up1 = rma(max(change( src ), 0), 9)
down1 = rma(-min(change( src ), 0), 9)
rsi = down1 == 0 ? 100 : up1 == 0 ? 0 : 100 - (100 / (1 + up1 / down1))
K = sma ( stoch (c, hahigh, halow, 14), 3)
D = sma (K, 3)

myrsi = rsi (c,rsilength)

//KDJ//
ilong = 9
isig = 3
bcwsma(s,l,m) =>
_s = s
_l = l
_m = m
_bcwsma = (_m*_s+(_l-_m)*nz(_bcwsma))/_l
_bcwsma

h = highest(hahigh, ilong)
l = lowest(halow,ilong)
RSV = 100*((c-l)/(h-l))
pK = bcwsma( RSV , isig, 1)
pD = bcwsma(pK, isig, 1)
pJ = 3 * pK-2 * pD
KD = avg (pK, pD )

//EMAs//
EMA5 = ema (price,5)
EMA7 = ema (price,7)
EMA10 = ema (price,10)
EMA14= ema (price,14)
VOLEMA = avg ( volume ,20)

/// --- TREND --- ///
avghigh = sma (h, uptrendlength)
avglow = sma (l, downtrendlength)
uptrend = h > avghigh
downtrend = l < avglow

// ICHIMOKU BUY & SELL//
conversionPeriods = 9
basePeriods = 26
laggingSpan2Periods = 52
displacement = 26
donchian ( len ) => avg (lowest( len ), highest( len ))
resolve( src , default) =>
if na( src )
default
else
src
conversionLine = donchian (conversionPeriods)
baseLine = donchian (basePeriods)
leadLine1 = offset( avg (conversionLine, baseLine), displacement)
leadLine2 = offset( donchian (laggingSpan2Periods), displacement)
tk_cross_bull = crossover(conversionLine, baseLine)
tk_cross_bear = crossunder(conversionLine, baseLine)
cross_y = (conversionLine * (baseLine - baseLine) - baseLine * (conversionLine - conversionLine)) / ((baseLine - baseLine) - (conversionLine - conversionLine))
tk_cross_below_kumo = cross_y <= leadLine2 and cross_y <= leadLine1 and cross_y <= leadLine2 and cross_y <= leadLine1
tk_cross_above_kumo = cross_y >= leadLine2 and cross_y >= leadLine1 and cross_y >= leadLine2 and cross_y >= leadLine1
tk_cross_inside_kumo = (not tk_cross_below_kumo) and (not tk_cross_above_kumo)
pk_cross_bull = crossover(haclose, baseLine)
pk_cross_bear = crossunder(haclose, baseLine)
cross_pk_y = (haclose * (baseLine - baseLine) - baseLine * (haclose - haclose)) / ((baseLine - baseLine) - (haclose - haclose))
pk_cross_below_kumo = cross_pk_y <= leadLine2 and cross_pk_y <= leadLine1 and cross_pk_y <= leadLine2 and cross_pk_y <= leadLine1
pk_cross_above_kumo = cross_pk_y >= leadLine2 and cross_pk_y >= leadLine1 and cross_pk_y >= leadLine2 and cross_pk_y >= leadLine1
pk_cross_inside_kumo = (not pk_cross_below_kumo) and (not pk_cross_above_kumo)
kumo_bull = (crossover(haclose, leadLine1) and leadLine1 > leadLine2) or (crossover(haclose, leadLine2) and leadLine2 > leadLine1)
kumo_bear = (crossunder(haclose, leadLine2) and leadLine1 > leadLine2) or (crossunder(haclose, leadLine1) and leadLine2 > leadLine1)
price_below_kumo = (haclose < leadLine2 and haclose < leadLine1)
price_above_kumo = (haclose > leadLine2 and haclose > leadLine1)
price_inside_kumo = (not price_below_kumo) and (not price_above_kumo)
no_dp_leadLine1 = avg (conversionLine, baseLine)
no_dp_leadLine2 = donchian (laggingSpan2Periods)
lead_line_cross_bull = crossover(no_dp_leadLine1, no_dp_leadLine2)
lead_line_cross_bear = crossunder(no_dp_leadLine1, no_dp_leadLine2)
price_below_kumo := (haclose < no_dp_leadLine2 and haclose < no_dp_leadLine1)
price_above_kumo := (haclose > no_dp_leadLine2 and haclose > no_dp_leadLine1)
price_inside_kumo := (not price_below_kumo) and (not price_above_kumo)
past_price = offset(haclose, displacement)
lag_line_bull_cross = haclose > haclose
lag_line_bear_cross = haclose < haclose
past_price_below_kumo = (past_price < leadLine2 and past_price < leadLine1)
past_price_above_kumo = (past_price > leadLine2 and past_price > leadLine1)
past_price_inside_kumo = (leadLine2 < past_price and past_price < leadLine1) and (leadLine1 < past_price and past_price < leadLine2)

//BUY & SELL
buycond = (tk_cross_below_kumo or tk_cross_inside_kumo or tk_cross_above_kumo) and rising(pJ,1) and heikUpColor() and uptrend and v1 >= v2 and rising(myrsi,1) or
(pk_cross_below_kumo or pk_cross_inside_kumo or pk_cross_above_kumo) and rising(pJ,1) and heikUpColor() and uptrend and v1 >= v2 and rising(myrsi,1) or
(past_price_below_kumo or past_price_above_kumo or past_price_inside_kumo) and rising(pJ,1) and heikUpColor() and uptrend and v1 >= v2 and rising(myrsi,1)
sellcond = (tk_cross_below_kumo or tk_cross_inside_kumo or tk_cross_above_kumo) and falling(pJ,1) and heikDownColor()and falling(myrsi,1) and downtrend or
(pk_cross_below_kumo or pk_cross_inside_kumo or pk_cross_above_kumo) and falling(pJ,1) and heikDownColor() and falling(myrsi,1) and downtrend or
(past_price_below_kumo or past_price_above_kumo or past_price_inside_kumo) and falling(pJ,1) and heikDownColor() and falling(myrsi,1) and downtrend

signalfilter = 0
signalfilter := sellcond ? 1 : buycond ? 2 : nz (signalfilter)
filvar = signalfilter == 1 ? 1:0
buySignal = (signalfilter != signalfilter and filvar == 0)
sellSignal = (signalfilter != signalfilter and filvar == 1)

//PLOT
plotshape(buySignal, color=green, text= "AL", location= location.belowbar,style= shape.labelup, textcolor=white, size = size.tiny, title="Buy Alert",editable=false, transp=30)
plotshape(sellSignal, color=red, text= "SAT", location= location.abovebar,style= shape.labeldown, textcolor=white, size = size.tiny, title="Sell Alert", editable=false, transp=30)

SenkouA = donchian (laggingSpan2Periods)
SenkouB = (conversionLine + baseLine) / 2
plot(ShowIchiLines and conversionLine ? conversionLine : na, color=red, title="Tenkan")
plot(ShowIchiLines and baseLine ? baseLine : na, color=blue, title="Kijun")
plot(ShowIchiLines and price ? price : na, color= teal , title="Chikou", offset = -displacement)
A = plot(ShowCloud and SenkouA ? SenkouA : na, color=purple, title="SenkouA")
B = plot(ShowCloud and SenkouB ? SenkouB : na, color=green, title="SenkouB")
fill(A, B, color=green)

//Alert Conditions
alertcondition(buySignal, title='AL', message='AL')
alertcondition(sellSignal, title='SAT', message='SAT')