// © MSTrade
// =================================
// PLEASE SUPPORT THE TEAM
// =================================
//
// If this project has been helpful, consider making a donation:
// Telegram: [Link]
// =================================
//@version=5
strategy('Maa Sharda Trading', overlay=true, default_qty_type=[Link],
default_qty_value=10000, initial_capital=10000, currency='USD',
commission_type=[Link], commission_value=0.03,
max_bars_back=3000, max_lines_count=100, calc_on_every_tick=false,
max_labels_count=100)
var initialcapital = [Link]
//Truncate Function
truncate(number, decimals) =>
factor = [Link](10, decimals)
int(number * factor) / factor
//
===================================================================================
====
// Trade Time
daysback = input(14, title='Backtest Days, For Defining Best TF, Max: 20 Days')
millisecondinxdays = 1000 * 60 * 60 * 24 * daysback
leftbar = timenow - time < millisecondinxdays
backtest = leftbar
dpa = 4
//
===================================================================================
====
et1 = 'Supertrend'
longside = [Link](true, title='Long Side', group='Strategy Option')
shortside = [Link](true, title='Short Side', group='Strategy Option')
filter1 = 'Filter with Atr'
filter2 = 'Filter with RSI'
filter3 = 'Atr or RSI'
filter4 = 'Atr and RSI'
filter5 = 'No Filtering'
filter6 = 'Entry Only in sideways market(By ATR or RSI)'
filter7 = 'Entry Only in sideways market(By ATR and RSI)'
typefilter = [Link](filter5, title='Sideways Filtering Input',
options=[filter1, filter2, filter3, filter4, filter5, filter6, filter7],
group='Strategy Options')
withsl = [Link](false, title='Use Dynamic SL?', group='Strategy Options')
RSI = truncate([Link](close, [Link](7, group='RSI Filterring')), 2)
toplimitrsi = [Link](45, title='TOP Limit', group='RSI Filterring')
botlimitrsi = [Link](10, title='BOT Limit', group='RSI Filterring')
// TP SL Option
ex1 = 'TP & SL by Percentage Price'
ex2 = 'TP & SL by atr Value'
et = [Link](ex2, title='TP SL Type', options=[ex1, ex2], group='Strategy
Options')
ST = [Link](true, title='Show Supertrend?', group='Supertrend Indicator')
period = [Link](15, group='Supertrend Indicator')
mult = [Link](5, group='Supertrend Indicator')
atrLen = [Link](5, minval=1, title='atr Length', group='Sideways Filtering
Input')
atrMaType = [Link]('EMA', options=['SMA', 'EMA'], group='Sideways Filtering
Input', title='atr Moving Average Type')
atrMaLen = [Link](5, minval=1, title='atr MA Length', group='Sideways Filtering
Input')
//adxLen = input(5, minval = 1, maxval = 50, title = "ADX SMOOTHing",
group='Sideways Filtering Input')
//diLen = input(14, minval = 1, title = "DI Length", group='Sideways Filtering
Input')
//adxLim = input(22, minval = 1, title = "ADX Limit", group='Sideways Filtering
Input')
//SMOOTH = input(3, minval = 1, maxval = 5, title = "SMOOTHing Factor",
group='Sideways Filtering Input')
//lag = input(8, minval = 0, maxval = 15, title = "Lag", group='Sideways Filtering
Input')
TP1 = [Link](1.5, title='TP1 Atr Multiplier', group='TP/SL by ATR')
TP2 = [Link](3, title='TP2 Atr Multiplier', group='TP/SL by ATR')
TP3 = [Link](5, title='TP3 Atr Multiplier', group='TP/SL by ATR')
TP4 = [Link](title='TP 4', minval=0.0, step=0.1, defval=9, group='TP/SL by
ATR')
SL = [Link](6, title='SL Atr Multiplier', group='TP/SL by ATR')
ptp1 = [Link](2, title='Take Profit 1 (%)', minval=0.0, step=0.1, defval=3,
group='TP/SL Percentage Price') * 0.01
ptp2 = [Link](4, title='Take Profit 2 (%)', minval=0.0, step=0.1, defval=5,
group='TP/SL Percentage Price') * 0.01
ptp3 = [Link](6, title='Take Profit 3 (%)', minval=0.0, step=0.1, defval=7,
group='TP/SL Percentage Price') * 0.01
ptp4 = [Link](12, title='Take Profit 4 (%)', minval=0.0, step=0.1, defval=8,
group='TP/SL Percentage Price') * 0.01
psl = [Link](3, title='StopLoss (%)', minval=0.0, step=0.1, defval=2) * 0.01
qtytp1 = [Link](30, title='QTY TP 1', group='Qty for TP')
qtytp2 = [Link](30, title='QTY TP 2', group='Qty for TP')
qtytp3 = [Link](30, title='QTY TP 3', group='Qty for TP')
qtytp4 = [Link](10, title='QTY TP 4', group='Qty for TP')
Qtytp1 = qtytp1 / 100
Qtytp2 = qtytp2 / 100
Qtytp3 = qtytp3 / 100
Qtytp4 = qtytp4 / 100
///
//===================================================================
//===================================================================
//Timeframe
//Supertrend Indicator
src = hl2
atr2 = [Link]([Link], period)
atr = [Link]([Link], '', [Link](period))
up = src - mult * atr
up1 = nz(up[1], up)
up := close[1] > up1 ? [Link](up, up1) : up
dn = src + mult * atr
dn1 = nz(dn[1], dn)
dn := close[1] < dn1 ? [Link](dn, dn1) : dn
trend = 1
trend := nz(trend[1], trend)
trend := trend == -1 and close > dn1 ? 1 : trend == 1 and close < up1 ? -1 : trend
st = trend == 1 ? up : dn
//filtering
atra = [Link]([Link], '', [Link](atrLen))
atrMa = atrMaType == 'EM' ? [Link](atra, atrMaLen) : [Link](atra, atrMaLen)
updm = [Link](high)
downdm = -[Link](low)
plusdm = na(updm) ? na : updm > downdm and updm > 0 ? updm : 0
minusdm = na(downdm) ? na : downdm > updm and downdm > 0 ? downdm : 0
//trur = rma(tr, diLen)
//plus = fixnan(100 * rma(plusdm, diLen) / trur)
//minus = fixnan(100 * rma(minusdm, diLen) / trur)
//sum = plus + minus
//adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), adxLen)
cndSidwayss1 = atra >= atrMa
cndSidwayss2 = RSI > toplimitrsi or RSI < botlimitrsi
cndSidways = cndSidwayss1 or cndSidwayss2
cndSidways1 = cndSidwayss1 and cndSidwayss2
Sidwayss1 = atra <= atrMa
Sidwayss2 = RSI < toplimitrsi and RSI > botlimitrsi
Sidways = Sidwayss1 or Sidwayss2
Sidways1 = Sidwayss1 and Sidwayss2
trendType = typefilter == filter1 ? cndSidwayss1 : typefilter == filter2 ?
cndSidwayss2 : typefilter == filter3 ? cndSidways : typefilter == filter4 ?
cndSidways1 : typefilter == filter5 ? RSI > 0 : typefilter == filter6 ? Sidways :
typefilter == filter7 ? Sidways1 : na
// Entry FIX
buysignal1 = [Link](close, st)
sellsignal1 = [Link](close, st)
buy = buysignal1 and longside
sell = sellsignal1 and shortside
//Tp & Sl by atr Mult
cb = [Link](buy, close, 0)
ratr = [Link](buy, [Link](14), 0)
tpb1 = cb + ratr * TP1
tpb2 = cb + ratr * TP2
tpb3 = cb + ratr * TP3
tpb4 = cb + ratr * TP4
slb = cb - ratr * SL //withsl?up:valuewhen(buy, up,0)
cs = [Link](sell, close, 0)
ratrs = [Link](sell, [Link](14), 0)
tps1 = cs - ratrs * TP1
tps2 = cs - ratrs * TP2
tps3 = cs - ratrs * TP3
tps4 = cs - ratrs * TP4
sls = cs + ratrs * SL //withsl?dn:valuewhen(sell, dn, 0)
Ptpb1 = cb * (1 + ptp1)
Ptpb2 = cb * (1 + ptp2)
Ptpb3 = cb * (1 + ptp3)
Ptpb4 = et == ex1 ? cb * (1 + ptp4) : tpb4
Pslb = cb * (1 - psl)
Ptps1 = cs * (1 - ptp1)
Ptps2 = cs * (1 - ptp2)
Ptps3 = cs * (1 - ptp3)
Ptps4 = et == ex1 ? cs * (1 - ptp4) : tps4
Psls = cs * (1 + psl)
//Variable Fix TP SL
tpb1t = et == ex1 ? Ptpb1 : tpb1
tpb2t = et == ex1 ? Ptpb2 : tpb2
tpb3t = et == ex1 ? Ptpb3 : tpb3
tpb4t = Ptpb4
slbt = et == ex1 ? Pslb : slb
tps1t = et == ex1 ? Ptps1 : tps1
tps2t = et == ex1 ? Ptps2 : tps2
tps3t = et == ex1 ? Ptps3 : tps3
tps4t = Ptps4
slst = et == ex1 ? Psls : sls
//===================================================================
//Input Zignaly Settings
z1 = 'Copy trading / Profit Sharing'
z2 = 'Signal Providing'
z3 = 'Telegram Notification'
ZZ = [Link](z3, title='BOT Type', options=[z1, z2, z3], group='Zignaly
Settings')
P1 = 'Pair 1'
P2 = 'Pair 2'
P3 = 'Pair 3'
pair = [Link](defval=P1, title='Pair Trade', options=[P1, P2, P3],
group='Zignaly Settings')
apikey = [Link]('xxx', title='Api Key', group='Zignaly Settings')
margin = [Link](10, title='Margin % (Use it Only if you use copytrading or
profit sharing)', group='Zignaly Settings')
lev = [Link](30, group='Zignaly Settings')
qty = margin / close
slbm = et == ex1 ? Psls : slb
slsm = et == ex1 ? Psls : sls
slbmessage = '","stopLossPriority":"price","stopLossPrice":"' + [Link](slbm)
slsmessage = '","stopLossPriority":"price","stopLossPrice":"' + [Link](slsm)
// Zignaly Settings
pair1 = [Link]('btcusdt', group='Pair & Signalid, Gunakan Huruf Kecil')
signal1 = [Link]('btc', group='Pair & Signalid, Gunakan Huruf Kecil')
pair2 = [Link]('ethusdt', group='Pair & Signalid, Gunakan Huruf Kecil')
signal2 = [Link]('eth', group='Pair & Signalid, Gunakan Huruf Kecil')
pair3 = [Link]('xxxusdt', group='Pair & Signalid, Gunakan Huruf Kecil')
signal3 = [Link]('xxx', group='Pair & Signalid, Gunakan Huruf Kecil')
PAIR = pair == P1 ? pair1 : pair == P2 ? pair2 : pair3
signal = pair == P1 ? signal1 : pair == P2 ? signal2 : signal3
//alert command, copytrader/profitsharing
longct = '{"key":"' + [Link](apikey) +
'","type":"reverse","exchange":"binance","exchangeAccountType":"futures","pair":"'
+ [Link](PAIR) +
'","exitOrderType":"market","entryOrderType":"market","exitSide":"short","entrySide
":"long","entryLeverage":"' + [Link](lev) + [Link](slbmessage) +
'","takeProfitPriority":"price","takeProfitAmountPercentage1":"' +
[Link](qtytp1) + '","takeProfitPrice1":"' + [Link](tpb1t) +
'","takeProfitAmountPercentage2":"' + [Link](qtytp2) +
'","takeProfitPrice2":"' + [Link](tpb2t) +
'","takeProfitAmountPercentage3":"' + [Link](qtytp3) +
'","takeProfitPrice3":"' + [Link](tpb3t) +
'","takeProfitAmountPercentage4":"' + [Link](qtytp4) +
'","takeProfitPrice4":"' + [Link](tpb4t) + '","positionSizePercentage":"' +
[Link](margin) + '","signalId":"' + [Link](signal) + '"}'
shortct = '{"key":"' + [Link](apikey) +
'","type":"reverse","exchange":"binance","exchangeAccountType":"futures","pair":"'
+ [Link](PAIR) +
'","exitOrderType":"market","entryOrderType":"market","exitSide":"long","entrySide"
:"short","entryLeverage":"' + [Link](lev) + [Link](slsmessage) +
'","takeProfitPriority":"price","takeProfitAmountPercentage1":"' +
[Link](qtytp1) + '","takeProfitPrice1":"' + [Link](tps1t) +
'","takeProfitAmountPercentage2":"' + [Link](qtytp2) +
'","takeProfitPrice2":"' + [Link](tps2t) +
'","takeProfitAmountPercentage3":"' + [Link](qtytp3) +
'","takeProfitPrice3":"' + [Link](tps3t) +
'","takeProfitAmountPercentage4":"' + [Link](qtytp4) +
'","takeProfitPrice4":"' + [Link](tps4t) + '","positionSizePercentage":"' +
[Link](margin) + '","signalId":"' + [Link](signal) + '"}'
slcommand = '{"key":"' + [Link](apikey) + '","pair":"' + [Link](PAIR) +
'","exchange":"binance","exchangeAccountType":"futures","type":"exit","signalId":"'
+ [Link](signal) + '"}'
//signal provider
tpb1tsp = et == ex1 ? ptp1 * 100 : truncate((tpb1 - cb) * 100 / cb, 2)
tpb2tsp = et == ex1 ? ptp2 * 100 : truncate((tpb2 - cb) * 100 / cb, 2)
tpb3tsp = et == ex1 ? ptp3 * 100 : truncate((tpb3 - cb) * 100 / cb, 2)
tpb4tsp = ptp4 * 100
slbtsp = truncate((cb - slb) * 100 / cb, 2)
tps1tsp = et == ex1 ? ptp1 * 100 : truncate((cs - tps1) * 100 / cs, 2)
tps2tsp = et == ex1 ? ptp2 * 100 : truncate((cs - tps2) * 100 / cs, 2)
tps3tsp = et == ex1 ? ptp3 * 100 : truncate((cs - tps3) * 100 / cs, 2)
tps4tsp = ptp4 * 100
slstsp = truncate((sls - cs) * 100 / cs, 2)
slbmsp = et == ex1 ? psl * 100 : slbtsp
slsmsp = et == ex1 ? psl * 100 : slstsp
slbmessagesp = '","stopLossPercentage":"-' + [Link](slbmsp)
slsmessagesp = '","stopLossPercentage":"-' + [Link](slsmsp)
longsp = '{"key":"' + [Link](apikey) +
'","type":"reverse","exchange":"binance","exchangeAccountType":"futures","pair":"'
+ [Link](PAIR) +
'","exitOrderType":"market","entryOrderType":"limit","exitSide":"short","entrySide"
:"long","entryLimitPrice":"' + [Link](cb) + '","entryLeverage":"\n' +
[Link](lev) + [Link](slbmessagesp) +
'","takeProfitAmountPercentage1":"' + [Link](qtytp1) +
'","takeProfitPercentage1":"' + [Link](tpb1tsp) +
'","takeProfitAmountPercentage2":"' + [Link](qtytp2) +
'","takeProfitPercentage2":"' + [Link](tpb2tsp) +
'","takeProfitAmountPercentage3":"' + [Link](qtytp3) +
'","takeProfitPercentage3":"' + [Link](tpb3tsp) +
'","takeProfitAmountPercentage4":"' + [Link](qtytp4) +
'","takeProfitPercentage4":"' + [Link](tpb4tsp) +
'","positionSizePercentage":"' + [Link](margin) + '","signalId":"' +
[Link](signal) + '"}'
shortsp = '{"key":"' + [Link](apikey) +
'","type":"reverse","exchange":"binance","exchangeAccountType":"futures","pair":"'
+ [Link](PAIR) +
'","exitOrderType":"market","entryOrderType":"limit","exitSide":"long","entrySide":
"short","entryLimitPrice":"' + [Link](cs) + '","entryLeverage":"\n' +
[Link](lev) + [Link](slsmessagesp) +
'","takeProfitAmountPercentage1":"' + [Link](qtytp1) +
'","takeProfitPercentage1":"' + [Link](tps1tsp) +
'","takeProfitAmountPercentage2":"' + [Link](qtytp2) +
'","takeProfitPercentage2":"' + [Link](tps2tsp) +
'","takeProfitAmountPercentage3":"' + [Link](qtytp3) +
'","takeProfitPercentage3":"' + [Link](tps3tsp) +
'","takeProfitAmountPercentage4":"' + [Link](qtytp4) +
'","takeProfitPercentage4":"' + [Link](tps4tsp) +
'","positionSizePercentage":"' + [Link](margin) + '","signalId":"' +
[Link](signal) + '"}'
//===================================================================
//MTF Analysis
//===================================================================
//===================================================================
//Source MTF
tf1 = [Link]('15', group='MTF Analysis')
tf2 = [Link]('30', group='MTF Analysis')
tf3 = [Link]('45', group='MTF Analysis')
tf4 = [Link]('60', group='MTF Analysis')
hl2A = [Link]([Link], tf1, hl2)
hl2B = [Link]([Link], tf2, hl2)
hl2C = [Link]([Link], tf3, hl2)
hl2D = [Link]([Link], tf4, hl2)
trA = [Link]([Link], tf1, [Link])
trB = [Link]([Link], tf2, [Link])
trC = [Link]([Link], tf3, [Link])
trD = [Link]([Link], tf4, [Link])
highA = [Link]([Link], tf1, high)
highB = [Link]([Link], tf2, high)
highC = [Link]([Link], tf3, high)
highD = [Link]([Link], tf4, high)
lowA = [Link]([Link], tf1, low)
lowB = [Link]([Link], tf2, low)
lowC = [Link]([Link], tf3, low)
lowD = [Link]([Link], tf4, low)
closeA = [Link]([Link], tf1, close)
closeB = [Link]([Link], tf2, close)
closeC = [Link]([Link], tf3, close)
closeD = [Link]([Link], tf4, close)
//===================================================================
//===================================================================
//Timeframe A
//Supertrend Indicator
srcA = hl2A
atr2A = [Link](trA, period)
atrA = [Link]([Link], tf1, [Link](period))
upA = srcA - mult * atrA
up1A = nz(upA[1], upA)
upA := closeA[1] > up1A ? [Link](upA, up1A) : upA
dnA = srcA + mult * atrA
dn1A = nz(dnA[1], dnA)
dnA := closeA[1] < dn1A ? [Link](dnA, dn1A) : dnA
trendA = 1
trendA := nz(trendA[1], trendA)
trendA := trendA == -1 and closeA > dn1A ? 1 : trendA == 1 and closeA < up1A ? -1 :
trendA
stA = trendA == 1 ? upA : dnA
//filtering
atraA = [Link]([Link], tf1, [Link](atrLen))
atrMaA = atrMaType == 'EMA' ? [Link](atraA, atrMaLen) : [Link](atraA, atrMaLen)
updmA = [Link](highA)
downdmA = -[Link](lowA)
plusdmA = na(updmA) ? na : updmA > downdmA and updmA > 0 ? updmA : 0
minusdmA = na(downdmA) ? na : downdmA > updmA and downdmA > 0 ? downdmA : 0
//trurA = rma(trA, diLen)
//plusA = fixnan(100 * rma(plusdmA, diLen) / trurA)
//minusA = fixnan(100 * rma(minusdmA, diLen) / trurA)
//sumA = plusA + minusA
//adxA = 100 * rma(abs(plusA - minusA) / (sumA == 0 ? 1 : sumA), adxLen)
cndSidwayss1A = atraA >= atrMaA
cndSidwayss2A = RSI > toplimitrsi or RSI < botlimitrsi
cndSidwaysA = cndSidwayss1A or cndSidwayss2A
cndSidways1A = cndSidwayss1A and cndSidwayss2A
Sidwayss1A = atraA <= atrMaA
Sidwayss2A = RSI < toplimitrsi and RSI > botlimitrsi
SidwaysA = Sidwayss1A or Sidwayss2A
Sidways1A = Sidwayss1A and Sidwayss2A
trendTypeA = typefilter == filter1 ? cndSidwayss1A : typefilter == filter2 ?
cndSidwayss2A : typefilter == filter3 ? cndSidwaysA : typefilter == filter4 ?
cndSidways1A : typefilter == filter5 ? RSI > 0 : typefilter == filter6 ? SidwaysA :
typefilter == filter7 ? Sidways1A : na
// Entry FIX
buysignal1A = [Link](closeA, stA) and backtest and trendTypeA
sellsignal1A = [Link](closeA, stA) and backtest and trendTypeA
buyA = buysignal1A and longside
sellA = sellsignal1A and shortside
//Tp & Sl by atr Mult
cbA = [Link](buyA, closeA, 0)
ratrA = [Link](buyA, [Link]([Link], tf1, [Link](14)), 0)
tpb1A = cbA + ratrA * TP1
tpb2A = cbA + ratrA * TP2
tpb3A = cbA + ratrA * TP3
tpb4A = cbA + ratrA * TP4
slbA = cbA - ratrA * SL //withsl?upA:valuewhen(buyA, upA,0)
csA = [Link](sellA, closeA, 0)
ratrsA = [Link](sellA, [Link]([Link], tf1, [Link](14)),
0)
tps1A = csA - ratrsA * TP1
tps2A = csA - ratrsA * TP2
tps3A = csA - ratrsA * TP3
tps4A = csA - ratrsA * TP4
slsA = csA + ratrsA * SL //withsl?dnA:valuewhen(sellA, dnA, 0)
Ptpb1A = cbA * (1 + ptp1)
Ptpb2A = cbA * (1 + ptp2)
Ptpb3A = cbA * (1 + ptp3)
Ptpb4A = et == ex1 ? cbA * (1 + ptp4) : tpb4A
PslbA = cbA * (1 - psl)
Ptps1A = csA * (1 - ptp1)
Ptps2A = csA * (1 - ptp2)
Ptps3A = csA * (1 - ptp3)
Ptps4A = et == ex1 ? csA * (1 - ptp4) : tps4A
PslsA = csA * (1 + psl)
//Variable Fix TP SL
tpb1tA = et == ex1 ? Ptpb1A : tpb1A
tpb2tA = et == ex1 ? Ptpb2A : tpb2A
tpb3tA = et == ex1 ? Ptpb3A : tpb3A
tpb4tA = Ptpb4A
slbtA = et == ex1 ? PslbA : slbA
tps1tA = et == ex1 ? Ptps1A : tps1A
tps2tA = et == ex1 ? Ptps2A : tps2A
tps3tA = et == ex1 ? Ptps3A : tps3A
tps4tA = Ptps4A
slstA = et == ex1 ? PslsA : slsA
sinceentrybA = int([Link](1, nz([Link](buyA))))
openedbA = [Link](buyA) >= 0 and trendA[1] == 1 and longside
highestbarbA = [Link](sinceentrybA)
lowestbarbA = [Link](sinceentrybA)
stillopenb1A = [Link](buyA) == 1 ? true : highestbarbA[1] < tpb1tA and
lowestbarbA[1] > slbtA
stillopenb2A = [Link](buyA) == 1 ? true : highestbarbA[1] < tpb2tA and
lowestbarbA[1] > slbtA
stillopenb3A = [Link](buyA) == 1 ? true : highestbarbA[1] < tpb3tA and
lowestbarbA[1] > slbtA
stillopenb4A = [Link](buyA) == 1 ? true : highestbarbA[1] < tpb4tA and
lowestbarbA[1] > slbtA
hittpb1A = [Link](highA, tpb1tA) and stillopenb1A and openedbA
plotshape(hittpb1A)
hittpb2A = [Link](highA, tpb2tA) and stillopenb2A and openedbA
hittpb3A = [Link](highA, tpb3tA) and stillopenb3A and openedbA
hittpb4A = [Link](highA, tpb4tA) and stillopenb4A and openedbA
hitslbA = lowA < slbtA and stillopenb4A and openedbA
winreversebA = closeA > cbA and backtest and [Link](closeA, stA) and
stillopenb4A and trendA == -1 and openedbA
losereversebA = closeA < cbA and backtest and [Link](closeA, stA) and
stillopenb4A and trendA == -1 and openedbA
sinceentrysA = int([Link](1, nz([Link](sellA))))
openedsA = [Link](sellA) >= 0 and trendA[1] == -1 and shortside
highestbarsA = [Link](sinceentrysA)
lowestbarsA = [Link](sinceentrysA)
stillopens1A = [Link](sellA) == 1 ? true : highestbarsA[1] < slstA and
lowestbarsA[1] > tps1tA
stillopens2A = [Link](sellA) == 1 ? true : highestbarsA[1] < slstA and
lowestbarsA[1] > tps2tA
stillopens3A = [Link](sellA) == 1 ? true : highestbarsA[1] < slstA and
lowestbarsA[1] > tps3tA
stillopens4A = [Link](sellA) == 1 ? true : highestbarsA[1] < slstA and
lowestbarsA[1] > tps4tA
hittps1A = [Link](lowA, tps1tA) and stillopens1A and openedsA
hittps2A = [Link](lowA, tps2tA) and stillopens2A and openedsA
hittps3A = [Link](lowA, tps3tA) and stillopens3A and openedsA
hittps4A = [Link](lowA, tps4tA) and stillopens4A and openedsA
hitslsA = highA > slstA and stillopens4A and openedsA
winreversesA = closeA <= csA and backtest and [Link](closeA, stA) and
stillopens4A and trendA == 1 and openedsA
losereversesA = closeA >= csA and backtest and [Link](closeA, stA) and
stillopens4A and trendA == 1 and openedsA
//============================================
cumbuyA = [Link](buyA ? 1 : 0)
cumsellA = [Link](sellA ? 1 : 0)
cumsignalA = cumbuyA + cumsellA
//net profit
sisaqtybA = stillopenb1A ? 1 : stillopenb2A ? 1 - Qtytp1 : stillopenb3A ? 1 -
(Qtytp1 + Qtytp2) : 1 - (Qtytp1 + Qtytp2 + Qtytp3)
sisaqtysA = stillopens1A ? 1 : stillopens2A ? 1 - Qtytp1 : stillopens3A ? 1 -
(Qtytp1 + Qtytp2) : 1 - (Qtytp1 + Qtytp2 + Qtytp3)
ptpb1A = (tpb1tA - cbA) * 100 / cbA * Qtytp1 //-0.06
ptpb2A = (tpb2tA - cbA) * 100 / cbA * Qtytp2 //-0.06
ptpb3A = (tpb3tA - cbA) * 100 / cbA * Qtytp3 //-0.06
ptpb4A = (tpb4tA - cbA) * 100 / cbA * Qtytp4 //-0.06
pslbA = (closeA - cbA) * 100 / cbA * sisaqtybA //-0.06
prbA = (closeA - cbA) * 100 / cbA * sisaqtybA //-0.06
ptps1A = (csA - tps1tA) * 100 / csA * Qtytp1 //-0.06
ptps2A = (csA - tps2tA) * 100 / csA * Qtytp2 //-0.06
ptps3A = (csA - tps3tA) * 100 / csA * Qtytp3 //-0.06
ptps4A = (csA - tps4tA) * 100 / csA * Qtytp4 //-0.06
pslsA = (csA - closeA) * 100 / csA * sisaqtysA //-0.06
prsA = (csA - closeA) * 100 / csA * sisaqtysA //-0.06
prtpb1A = [Link](hittpb1A ? ptpb1A : 0)
prtpb2A = [Link](hittpb2A ? ptpb2A : 0)
prtpb3A = [Link](hittpb3A ? ptpb3A : 0)
prtpb4A = [Link](hittpb4A ? ptpb4A : 0)
prslbA = [Link](hitslbA ? pslbA : 0)
prwrbA = [Link](winreversebA ? prbA : 0)
prlrbA = [Link](losereversebA ? prbA : 0)
prtps1A = [Link](hittps1A ? ptps1A : 0)
prtps2A = [Link](hittps2A ? ptps2A : 0)
prtps3A = [Link](hittps3A ? ptps3A : 0)
prtps4A = [Link](hittps4A ? ptps4A : 0)
prslsA = [Link](hitslsA ? pslsA : 0)
prwrsA = [Link](winreversesA ? prsA : 0)
prlrsA = [Link](losereversesA ? prsA : 0)
netcapitalgainA = prtpb1A + prtpb2A + prtpb3A + prtpb4A + prslbA + prtps1A +
prtps2A + prtps3A + prtps4A + prslsA + prwrbA + prlrbA + prwrsA + prlrsA
///winrate
wintpb1A = [Link](hittpb1A ? 1 : 0)
wintpb2A = [Link](hittpb2A ? 1 : 0)
wintpb3A = [Link](hittpb3A ? 1 : 0)
wintpb4A = [Link](hittpb4A ? 1 : 0)
wrslbA = [Link](hitslbA ? 1 : 0)
wintps1A = [Link](hittps1A ? 1 : 0)
wintps2A = [Link](hittps2A ? 1 : 0)
wintps3A = [Link](hittps3A ? 1 : 0)
wintps4A = [Link](hittps4A ? 1 : 0)
wrslsA = [Link](hitslsA ? 1 : 0)
cumtp1A = wintpb1A + wintps1A
cumtp2A = wintpb2A + wintps2A
cumtp3A = wintpb3A + wintps3A
cumtp4A = wintpb4A + wintps4A
cumslA = wrslbA + wrslsA
cumpositionA = cumtp1A + cumtp2A + cumtp3A + cumtp4A + cumslA
//+cumwinreverseA//+cumlosereverseA
wrtp1A = truncate(cumtp1A * 100 / cumsignalA, 0)
wrtp2A = truncate(cumtp2A * 100 / cumsignalA, 0)
wrtp3A = truncate(cumtp3A * 100 / cumsignalA, 0)
wrtp4A = truncate(cumtp4A * 100 / cumsignalA, 0)
wrslA = truncate(cumslA * 100 / cumsignalA, 0)
winallA = cumtp1A + cumtp2A + cumtp3A + cumtp4A //+cumwinreverseA
wrallA = winallA * 100 / cumpositionA
//===================================================================
//===================================================================
//===================================================================
//===================================================================
//Timeframe B
//Supertrend Indicator
srcB = hl2B
atr2B = [Link](trB, period)
atrB = [Link]([Link], tf2, [Link](period))
upB = srcB - mult * atrB
up1B = nz(upB[1], upB)
upB := closeB[1] > up1B ? [Link](upB, up1B) : upB
dnB = srcB + mult * atrB
dn1B = nz(dnB[1], dnB)
dnB := closeB[1] < dn1B ? [Link](dnB, dn1B) : dnB
trendB = 1
trendB := nz(trendB[1], trendB)
trendB := trendB == -1 and closeB > dn1B ? 1 : trendB == 1 and closeB < up1B ? -1 :
trendB
stB = trendB == 1 ? upB : dnB
//filtering
atraB = [Link]([Link], tf2, [Link](atrLen))
atrMaB = atrMaType == 'EMB' ? [Link](atraB, atrMaLen) : [Link](atraB, atrMaLen)
updmB = [Link](highB)
downdmB = -[Link](lowB)
plusdmB = na(updmB) ? na : updmB > downdmB and updmB > 0 ? updmB : 0
minusdmB = na(downdmB) ? na : downdmB > updmB and downdmB > 0 ? downdmB : 0
//trurB = rma(trB, diLen)
//plusB = fixnan(100 * rma(plusdmB, diLen) / trurB)
//minusB = fixnan(100 * rma(minusdmB, diLen) / trurB)
//sumB = plusB + minusB
//adxB = 100 * rma(abs(plusB - minusB) / (sumB == 0 ? 1 : sumB), adxLen)
cndSidwayss1B = atraB >= atrMaB
cndSidwayss2B = RSI > toplimitrsi or RSI < botlimitrsi
cndSidwaysB = cndSidwayss1B or cndSidwayss2B
cndSidways1B = cndSidwayss1B and cndSidwayss2B
Sidwayss1B = atraB <= atrMaB
Sidwayss2B = RSI < toplimitrsi and RSI > botlimitrsi
SidwaysB = Sidwayss1B or Sidwayss2B
Sidways1B = Sidwayss1B and Sidwayss2B
trendTypeB = typefilter == filter1 ? cndSidwayss1B : typefilter == filter2 ?
cndSidwayss2B : typefilter == filter3 ? cndSidwaysB : typefilter == filter4 ?
cndSidways1B : typefilter == filter5 ? RSI > 0 : typefilter == filter6 ? SidwaysB :
typefilter == filter7 ? Sidways1B : na
// Entry FIX
buysignal1B = [Link](closeB, stB) and backtest and trendTypeB
sellsignal1B = [Link](closeB, stB) and backtest and trendTypeB
buyB = buysignal1B and longside
sellB = sellsignal1B and shortside
//Tp & Sl by atr Mult
cbB = [Link](buyB, closeB, 0)
ratrB = [Link](buyB, [Link]([Link], tf2, [Link](14)), 0)
tpb1B = cbB + ratrB * TP1
tpb2B = cbB + ratrB * TP2
tpb3B = cbB + ratrB * TP3
tpb4B = cbB + ratrB * TP4
slbB = cbB - ratrB * SL //withsl?upB:valuewhen(buyB, upB,0)
csB = [Link](sellB, closeB, 0)
ratrsB = [Link](sellB, [Link]([Link], tf2, [Link](14)),
0)
tps1B = csB - ratrsB * TP1
tps2B = csB - ratrsB * TP2
tps3B = csB - ratrsB * TP3
tps4B = csB - ratrsB * TP4
slsB = csB + ratrsB * SL //withsl?dnB:valuewhen(sellB, dnB, 0)
Ptpb1B = cbB * (1 + ptp1)
Ptpb2B = cbB * (1 + ptp2)
Ptpb3B = cbB * (1 + ptp3)
Ptpb4B = et == ex1 ? cbB * (1 + ptp4) : tpb4B
PslbB = cbB * (1 - psl)
Ptps1B = csB * (1 - ptp1)
Ptps2B = csB * (1 - ptp2)
Ptps3B = csB * (1 - ptp3)
Ptps4B = et == ex1 ? csB * (1 - ptp4) : tps4B
PslsB = csB * (1 + psl)
//Variable Fix TP SL
tpb1tB = et == ex1 ? Ptpb1B : tpb1B
tpb2tB = et == ex1 ? Ptpb2B : tpb2B
tpb3tB = et == ex1 ? Ptpb3B : tpb3B
tpb4tB = Ptpb4B
slbtB = et == ex1 ? PslbB : slbB
tps1tB = et == ex1 ? Ptps1B : tps1B
tps2tB = et == ex1 ? Ptps2B : tps2B
tps3tB = et == ex1 ? Ptps3B : tps3B
tps4tB = Ptps4B
slstB = et == ex1 ? PslsB : slsB
sinceentrybB = int([Link](1, nz([Link](buyB))))
openedbB = [Link](buyB) >= 0 and trendB[1] == 1 and longside
highestbarbB = [Link](sinceentrybB)
lowestbarbB = [Link](sinceentrybB)
stillopenb1B = [Link](buyB) == 1 ? true : highestbarbB[1] < tpb1tB and
lowestbarbB[1] > slbtB
stillopenb2B = [Link](buyB) == 1 ? true : highestbarbB[1] < tpb2tB and
lowestbarbB[1] > slbtB
stillopenb3B = [Link](buyB) == 1 ? true : highestbarbB[1] < tpb3tB and
lowestbarbB[1] > slbtB
stillopenb4B = [Link](buyB) == 1 ? true : highestbarbB[1] < tpb4tB and
lowestbarbB[1] > slbtB
hittpb1B = [Link](highB, tpb1tB) and stillopenb1B and openedbB
plotshape(hittpb1B)
hittpb2B = [Link](highB, tpb2tB) and stillopenb2B and openedbB
hittpb3B = [Link](highB, tpb3tB) and stillopenb3B and openedbB
hittpb4B = [Link](highB, tpb4tB) and stillopenb4B and openedbB
hitslbB = lowB < slbtB and stillopenb4B and openedbB
winreversebB = closeB > cbB and backtest and [Link](closeB, stB) and
stillopenb4B and trendB == -1 and openedbB
losereversebB = closeB < cbB and backtest and [Link](closeB, stB) and
stillopenb4B and trendB == -1 and openedbB
sinceentrysB = int([Link](1, nz([Link](sellB))))
openedsB = [Link](sellB) >= 0 and trendB[1] == -1 and shortside
highestbarsB = [Link](sinceentrysB)
lowestbarsB = [Link](sinceentrysB)
stillopens1B = [Link](sellB) == 1 ? true : highestbarsB[1] < slstB and
lowestbarsB[1] > tps1tB
stillopens2B = [Link](sellB) == 1 ? true : highestbarsB[1] < slstB and
lowestbarsB[1] > tps2tB
stillopens3B = [Link](sellB) == 1 ? true : highestbarsB[1] < slstB and
lowestbarsB[1] > tps3tB
stillopens4B = [Link](sellB) == 1 ? true : highestbarsB[1] < slstB and
lowestbarsB[1] > tps4tB
hittps1B = [Link](lowB, tps1tB) and stillopens1B and openedsB
hittps2B = [Link](lowB, tps2tB) and stillopens2B and openedsB
hittps3B = [Link](lowB, tps3tB) and stillopens3B and openedsB
hittps4B = [Link](lowB, tps4tB) and stillopens4B and openedsB
hitslsB = highB > slstB and stillopens4B and openedsB
winreversesB = closeB <= csB and backtest and [Link](closeB, stB) and
stillopens4B and trendB == 1 and openedsB
losereversesB = closeB >= csB and backtest and [Link](closeB, stB) and
stillopens4B and trendB == 1 and openedsB
//============================================
cumbuyB = [Link](buyB ? 1 : 0)
cumsellB = [Link](sellB ? 1 : 0)
cumsignalB = cumbuyB + cumsellB
//net profit
sisaqtybB = stillopenb1B ? 1 : stillopenb2B ? 1 - Qtytp1 : stillopenb3B ? 1 -
(Qtytp1 + Qtytp2) : 1 - (Qtytp1 + Qtytp2 + Qtytp3)
sisaqtysB = stillopens1B ? 1 : stillopens2B ? 1 - Qtytp1 : stillopens3B ? 1 -
(Qtytp1 + Qtytp2) : 1 - (Qtytp1 + Qtytp2 + Qtytp3)
ptpb1B = (tpb1tB - cbB) * 100 / cbB * Qtytp1 //-0.06
ptpb2B = (tpb2tB - cbB) * 100 / cbB * Qtytp2 //-0.06
ptpb3B = (tpb3tB - cbB) * 100 / cbB * Qtytp3 //-0.06
ptpb4B = (tpb4tB - cbB) * 100 / cbB * Qtytp4 //-0.06
pslbB = (closeB - cbB) * 100 / cbB * sisaqtybB //-0.06
prbB = (closeB - cbB) * 100 / cbB * sisaqtybB //-0.06
ptps1B = (csB - tps1tB) * 100 / csB * Qtytp1 //-0.06
ptps2B = (csB - tps2tB) * 100 / csB * Qtytp2 //-0.06
ptps3B = (csB - tps3tB) * 100 / csB * Qtytp3 //-0.06
ptps4B = (csB - tps4tB) * 100 / csB * Qtytp4 //-0.06
pslsB = (csB - close) * 100 / csB * sisaqtysB //-0.06
prsB = (csB - closeB) * 100 / csB * sisaqtysB //-0.06
prtpb1B = [Link](hittpb1B ? ptpb1B : 0)
prtpb2B = [Link](hittpb2B ? ptpb2B : 0)
prtpb3B = [Link](hittpb3B ? ptpb3B : 0)
prtpb4B = [Link](hittpb4B ? ptpb4B : 0)
prslbB = [Link](hitslbB ? pslbB : 0)
prwrbB = [Link](winreversebB ? prbB : 0)
prlrbB = [Link](losereversebB ? prbB : 0)
prtps1B = [Link](hittps1B ? ptps1B : 0)
prtps2B = [Link](hittps2B ? ptps2B : 0)
prtps3B = [Link](hittps3B ? ptps3B : 0)
prtps4B = [Link](hittps4B ? ptps4B : 0)
prslsB = [Link](hitslsB ? pslsB : 0)
prwrsB = [Link](winreversesB ? prsB : 0)
prlrsB = [Link](losereversesB ? prsB : 0)
netcapitalgainB = prtpb1B + prtpb2B + prtpb3B + prtpb4B + prslbB + prtps1B +
prtps2B + prtps3B + prtps4B + prslsB + prwrbB + prlrbB + prwrsB + prlrsB
///winrate
wintpb1B = [Link](hittpb1B ? 1 : 0)
wintpb2B = [Link](hittpb2B ? 1 : 0)
wintpb3B = [Link](hittpb3B ? 1 : 0)
wintpb4B = [Link](hittpb4B ? 1 : 0)
wrslbB = [Link](hitslbB ? 1 : 0)
wintps1B = [Link](hittps1B ? 1 : 0)
wintps2B = [Link](hittps2B ? 1 : 0)
wintps3B = [Link](hittps3B ? 1 : 0)
wintps4B = [Link](hittps4B ? 1 : 0)
wrslsB = [Link](hitslsB ? 1 : 0)
cumtp1B = wintpb1B + wintps1B
cumtp2B = wintpb2B + wintps2B
cumtp3B = wintpb3B + wintps3B
cumtp4B = wintpb4B + wintps4B
cumslB = wrslbB + wrslsB
cumpositionB = cumtp1B + cumtp2B + cumtp3B + cumtp4B + cumslB
//+cumwinreverseB//+cumlosereverseB
wrtp1B = truncate(cumtp1B * 100 / cumsignalB, 0)
wrtp2B = truncate(cumtp2B * 100 / cumsignalB, 0)
wrtp3B = truncate(cumtp3B * 100 / cumsignalB, 0)
wrtp4B = truncate(cumtp4B * 100 / cumsignalB, 0)
wrslB = truncate(cumslB * 100 / cumsignalB, 0)
winallB = cumtp1B + cumtp2B + cumtp3B + cumtp4B //+cumwinreverseB
wrallB = winallB * 100 / cumpositionB
//===================================================================
//===================================================================
//===================================================================
//===================================================================
//Timeframe C
//Supertrend Indicator
srcC = hl2C
atr2C = [Link](trC, period)
atrC = [Link]([Link], tf3, [Link](period))
upC = srcC - mult * atrC
up1C = nz(upC[1], upC)
upC := closeC[1] > up1C ? [Link](upC, up1C) : upC
dnC = srcC + mult * atrC
dn1C = nz(dnC[1], dnC)
dnC := closeC[1] < dn1C ? [Link](dnC, dn1C) : dnC
trendC = 1
trendC := nz(trendC[1], trendC)
trendC := trendC == -1 and closeC > dn1C ? 1 : trendC == 1 and closeC < up1C ? -1 :
trendC
stC = trendC == 1 ? upC : dnC
//filtering
atraC = [Link]([Link], tf3, [Link](atrLen))
atrMaC = atrMaType == 'EMC' ? [Link](atraC, atrMaLen) : [Link](atraC, atrMaLen)
updmC = [Link](highC)
downdmC = -[Link](lowC)
plusdmC = na(updmC) ? na : updmC > downdmC and updmC > 0 ? updmC : 0
minusdmC = na(downdmC) ? na : downdmC > updmC and downdmC > 0 ? downdmC : 0
//trurC = rma(trC, diLen)
//plusC = fixnan(100 * rma(plusdmC, diLen) / trurC)
//minusC = fixnan(100 * rma(minusdmC, diLen) / trurC)
//sumC = plusC + minusC
//adxC = 100 * rma(abs(plusC - minusC) / (sumC == 0 ? 1 : sumC), adxLen)
cndSidwayss1C = atraC >= atrMaC
cndSidwayss2C = RSI > toplimitrsi or RSI < botlimitrsi
cndSidwaysC = cndSidwayss1C or cndSidwayss2C
cndSidways1C = cndSidwayss1C and cndSidwayss2C
Sidwayss1C = atraC <= atrMaC
Sidwayss2C = RSI < toplimitrsi and RSI > botlimitrsi
SidwaysC = Sidwayss1C or Sidwayss2C
Sidways1C = Sidwayss1C and Sidwayss2C
trendTypeC = typefilter == filter1 ? cndSidwayss1C : typefilter == filter2 ?
cndSidwayss2C : typefilter == filter3 ? cndSidwaysC : typefilter == filter4 ?
cndSidways1C : typefilter == filter5 ? RSI > 0 : typefilter == filter6 ? SidwaysC :
typefilter == filter7 ? Sidways1C : na
// Entry FIX
buysignal1C = [Link](closeC, stC) and backtest and trendTypeC
sellsignal1C = [Link](closeC, stC) and backtest and trendTypeC
buyC = buysignal1C and longside
sellC = sellsignal1C and shortside
//Tp & Sl by atr Mult
cbC = [Link](buyC, closeC, 0)
ratrC = [Link](buyC, [Link]([Link], tf3, [Link](14)), 0)
tpb1C = cbC + ratrC * TP1
tpb2C = cbC + ratrC * TP2
tpb3C = cbC + ratrC * TP3
tpb4C = cbC + ratrC * TP4
slbC = cbC - ratrC * SL //withsl?upC:valuewhen(buyC, upC,0)
csC = [Link](sellC, closeC, 0)
ratrsC = [Link](sellC, [Link]([Link], tf3, [Link](14)),
0)
tps1C = csC - ratrsC * TP1
tps2C = csC - ratrsC * TP2
tps3C = csC - ratrsC * TP3
tps4C = csC - ratrsC * TP4
slsC = csC + ratrsC * SL //withsl?dnC:valuewhen(sellC, dnC, 0)
Ptpb1C = cbC * (1 + ptp1)
Ptpb2C = cbC * (1 + ptp2)
Ptpb3C = cbC * (1 + ptp3)
Ptpb4C = et == ex1 ? cbC * (1 + ptp4) : tpb4C
PslbC = cbC * (1 - psl)
Ptps1C = csC * (1 - ptp1)
Ptps2C = csC * (1 - ptp2)
Ptps3C = csC * (1 - ptp3)
Ptps4C = et == ex1 ? csC * (1 - ptp4) : tps4C
PslsC = csC * (1 + psl)
//Variable Fix TP SL
tpb1tC = et == ex1 ? Ptpb1C : tpb1C
tpb2tC = et == ex1 ? Ptpb2C : tpb2C
tpb3tC = et == ex1 ? Ptpb3C : tpb3C
tpb4tC = Ptpb4C
slbtC = et == ex1 ? PslbC : slbC
tps1tC = et == ex1 ? Ptps1C : tps1C
tps2tC = et == ex1 ? Ptps2C : tps2C
tps3tC = et == ex1 ? Ptps3C : tps3C
tps4tC = Ptps4C
slstC = et == ex1 ? PslsC : slsC
sinceentrybC = int([Link](1, nz([Link](buyC))))
openedbC = [Link](buyC) >= 0 and trendC[1] == 1 and longside
highestbarbC = [Link](sinceentrybC)
lowestbarbC = [Link](sinceentrybC)
stillopenb1C = [Link](buyC) == 1 ? true : highestbarbC[1] < tpb1tC and
lowestbarbC[1] > slbtC
stillopenb2C = [Link](buyC) == 1 ? true : highestbarbC[1] < tpb2tC and
lowestbarbC[1] > slbtC
stillopenb3C = [Link](buyC) == 1 ? true : highestbarbC[1] < tpb3tC and
lowestbarbC[1] > slbtC
stillopenb4C = [Link](buyC) == 1 ? true : highestbarbC[1] < tpb4tC and
lowestbarbC[1] > slbtC
hittpb1C = [Link](highC, tpb1tC) and stillopenb1C and openedbC
plotshape(hittpb1C)
hittpb2C = [Link](highC, tpb2tC) and stillopenb2C and openedbC
hittpb3C = [Link](highC, tpb3tC) and stillopenb3C and openedbC
hittpb4C = [Link](highC, tpb4tC) and stillopenb4C and openedbC
hitslbC = lowC < slbtC and stillopenb4C and openedbC
winreversebC = closeC > cbC and backtest and [Link](closeC, stC) and
stillopenb4C and trendC == -1 and openedbC
losereversebC = closeC < cbC and backtest and [Link](closeC, stC) and
stillopenb4C and trendC == -1 and openedbC
sinceentrysC = int([Link](1, nz([Link](sellC))))
openedsC = [Link](sellC) >= 0 and trendC[1] == -1 and shortside
highestbarsC = [Link](sinceentrysC)
lowestbarsC = [Link](sinceentrysC)
stillopens1C = [Link](sellC) == 1 ? true : highestbarsC[1] < slstC and
lowestbarsC[1] > tps1tC
stillopens2C = [Link](sellC) == 1 ? true : highestbarsC[1] < slstC and
lowestbarsC[1] > tps2tC
stillopens3C = [Link](sellC) == 1 ? true : highestbarsC[1] < slstC and
lowestbarsC[1] > tps3tC
stillopens4C = [Link](sellC) == 1 ? true : highestbarsC[1] < slstC and
lowestbarsC[1] > tps4tC
hittps1C = [Link](lowC, tps1tC) and stillopens1C and openedsC
hittps2C = [Link](lowC, tps2tC) and stillopens2C and openedsC
hittps3C = [Link](lowC, tps3tC) and stillopens3C and openedsC
hittps4C = [Link](lowC, tps4tC) and stillopens4C and openedsC
hitslsC = highC > slstC and stillopens4C and openedsC
winreversesC = closeC <= csC and backtest and [Link](closeC, stC) and
stillopens4C and trendC == 1 and openedsC
losereversesC = closeC >= csC and backtest and [Link](closeC, stC) and
stillopens4C and trendC == 1 and openedsC
//============================================
cumbuyC = [Link](buyC ? 1 : 0)
cumsellC = [Link](sellC ? 1 : 0)
cumsignalC = cumbuyC + cumsellC
//net profit
sisaqtybC = stillopenb1C ? 1 : stillopenb2C ? 1 - Qtytp1 : stillopenb3C ? 1 -
(Qtytp1 + Qtytp2) : 1 - (Qtytp1 + Qtytp2 + Qtytp3)
sisaqtysC = stillopens1C ? 1 : stillopens2C ? 1 - Qtytp1 : stillopens3C ? 1 -
(Qtytp1 + Qtytp2) : 1 - (Qtytp1 + Qtytp2 + Qtytp3)
ptpb1C = (tpb1tC - cbC) * 100 / cbC * Qtytp1 //-0.06
ptpb2C = (tpb2tC - cbC) * 100 / cbC * Qtytp2 //-0.06
ptpb3C = (tpb3tC - cbC) * 100 / cbC * Qtytp3 //-0.06
ptpb4C = (tpb4tC - cbC) * 100 / cbC * Qtytp4 //-0.06
pslbC = (closeC - cbC) * 100 / cbC * sisaqtybC //-0.06
prbC = (closeC - cbC) * 100 / cbC * sisaqtybC //-0.06
ptps1C = (csC - tps1tC) * 100 / csC * Qtytp1 //-0.06
ptps2C = (csC - tps2tC) * 100 / csC * Qtytp2 //-0.06
ptps3C = (csC - tps3tC) * 100 / csC * Qtytp3 //-0.06
ptps4C = (csC - tps4tC) * 100 / csC * Qtytp4 //-0.06
pslsC = (csC - closeC) * 100 / csC * sisaqtysC //-0.06
prsC = (csC - closeC) * 100 / csC * sisaqtysC //-0.06
prtpb1C = [Link](hittpb1C ? ptpb1C : 0)
prtpb2C = [Link](hittpb2C ? ptpb2C : 0)
prtpb3C = [Link](hittpb3C ? ptpb3C : 0)
prtpb4C = [Link](hittpb4C ? ptpb4C : 0)
prslbC = [Link](hitslbC ? pslbC : 0)
prwrbC = [Link](winreversebC ? prbC : 0)
prlrbC = [Link](losereversebC ? prbC : 0)
prtps1C = [Link](hittps1C ? ptps1C : 0)
prtps2C = [Link](hittps2C ? ptps2C : 0)
prtps3C = [Link](hittps3C ? ptps3C : 0)
prtps4C = [Link](hittps4C ? ptps4C : 0)
prslsC = [Link](hitslsC ? pslsC : 0)
prwrsC = [Link](winreversesC ? prsC : 0)
prlrsC = [Link](losereversesC ? prsC : 0)
netcapitalgainC = prtpb1C + prtpb2C + prtpb3C + prtpb4C + prslbC + prtps1C +
prtps2C + prtps3C + prtps4C + prslsC + prwrbC + prlrbC + prwrsC + prlrsC
///winrate
wintpb1C = [Link](hittpb1C ? 1 : 0)
wintpb2C = [Link](hittpb2C ? 1 : 0)
wintpb3C = [Link](hittpb3C ? 1 : 0)
wintpb4C = [Link](hittpb4C ? 1 : 0)
wrslbC = [Link](hitslbC ? 1 : 0)
wintps1C = [Link](hittps1C ? 1 : 0)
wintps2C = [Link](hittps2C ? 1 : 0)
wintps3C = [Link](hittps3C ? 1 : 0)
wintps4C = [Link](hittps4C ? 1 : 0)
wrslsC = [Link](hitslsC ? 1 : 0)
cumtp1C = wintpb1C + wintps1C
cumtp2C = wintpb2C + wintps2C
cumtp3C = wintpb3C + wintps3C
cumtp4C = wintpb4C + wintps4C
cumslC = wrslbC + wrslsC
cumpositionC = cumtp1C + cumtp2C + cumtp3C + cumtp4C + cumslC
//+cumwinreverseC//+cumlosereverseC
wrtp1C = truncate(cumtp1C * 100 / cumsignalC, 0)
wrtp2C = truncate(cumtp2C * 100 / cumsignalC, 0)
wrtp3C = truncate(cumtp3C * 100 / cumsignalC, 0)
wrtp4C = truncate(cumtp4C * 100 / cumsignalC, 0)
wrslC = truncate(cumslC * 100 / cumsignalC, 0)
winallC = cumtp1C + cumtp2C + cumtp3C + cumtp4C //+cumwinreverseC
wrallC = winallC * 100 / cumpositionC
//===================================================================
//===================================================================
//===================================================================
//===================================================================
//Timeframe D
//Supertrend Indicator
srcD = hl2D
atr2D = [Link](trD, period)
atrD = [Link]([Link], tf4, [Link](period))
upD = srcD - mult * atrD
up1D = nz(upD[1], upD)
upD := closeD[1] > up1D ? [Link](upD, up1D) : upD
dnD = srcD + mult * atrD
dn1D = nz(dnD[1], dnD)
dnD := closeD[1] < dn1D ? [Link](dnD, dn1D) : dnD
trendD = 1
trendD := nz(trendD[1], trendD)
trendD := trendD == -1 and closeD > dn1D ? 1 : trendD == 1 and closeD < up1D ? -1 :
trendD
stD = trendD == 1 ? upD : dnD
//filtering
atraD = [Link]([Link], tf4, [Link](atrLen))
atrMaD = atrMaType == 'EMD' ? [Link](atraD, atrMaLen) : [Link](atraD, atrMaLen)
updmD = [Link](highD)
downdmD = -[Link](lowD)
plusdmD = na(updmD) ? na : updmD > downdmD and updmD > 0 ? updmD : 0
minusdmD = na(downdmD) ? na : downdmD > updmD and downdmD > 0 ? downdmD : 0
//trurD = rma(trD, diLen)
//plusD = fixnan(100 * rma(plusdmD, diLen) / trurD)
//minusD = fixnan(100 * rma(minusdmD, diLen) / trurD)
//sumD = plusD + minusD
//adxD = 100 * rma(abs(plusD - minusD) / (sumD == 0 ? 1 : sumD), adxLen)
cndSidwayss1D = atraD >= atrMaD
cndSidwayss2D = RSI > toplimitrsi or RSI < botlimitrsi
cndSidwaysD = cndSidwayss1D or cndSidwayss2D
cndSidways1D = cndSidwayss1D and cndSidwayss2D
Sidwayss1D = atraD <= atrMaD
Sidwayss2D = RSI < toplimitrsi and RSI > botlimitrsi
SidwaysD = Sidwayss1D or Sidwayss2D
Sidways1D = Sidwayss1D and Sidwayss2D
trendTypeD = typefilter == filter1 ? cndSidwayss1D : typefilter == filter2 ?
cndSidwayss2D : typefilter == filter3 ? cndSidwaysD : typefilter == filter4 ?
cndSidways1D : typefilter == filter5 ? RSI > 0 : typefilter == filter6 ? SidwaysD :
typefilter == filter7 ? Sidways1D : na
// Entry FIX
buysignal1D = [Link](closeD, stD) and backtest and trendTypeD
sellsignal1D = [Link](closeD, stD) and backtest and trendTypeD
buyD = buysignal1D and longside
sellD = sellsignal1D and shortside
//Tp & Sl by atr Mult
cbD = [Link](buyD, closeD, 0)
ratrD = [Link](buyD, [Link]([Link], tf4, [Link](14)), 0)
tpb1D = cbD + ratrD * TP1
tpb2D = cbD + ratrD * TP2
tpb3D = cbD + ratrD * TP3
tpb4D = cbD + ratrD * TP4
slbD = cbD - ratrD * SL //withsl?upD:valuewhen(buyD, upD,0)
csD = [Link](sellD, closeD, 0)
ratrsD = [Link](sellD, [Link]([Link], tf4, [Link](14)),
0)
tps1D = csD - ratrsD * TP1
tps2D = csD - ratrsD * TP2
tps3D = csD - ratrsD * TP3
tps4D = csD - ratrsD * TP4
slsD = csD + ratrsD * SL //withsl?dnD:valuewhen(sellD, dnD, 0)
Ptpb1D = cbD * (1 + ptp1)
Ptpb2D = cbD * (1 + ptp2)
Ptpb3D = cbD * (1 + ptp3)
Ptpb4D = et == ex1 ? cbD * (1 + ptp4) : tpb4D
PslbD = cbD * (1 - psl)
Ptps1D = csD * (1 - ptp1)
Ptps2D = csD * (1 - ptp2)
Ptps3D = csD * (1 - ptp3)
Ptps4D = et == ex1 ? csD * (1 - ptp4) : tps4D
PslsD = csD * (1 + psl)
//Variable Fix TP SL
tpb1tD = et == ex1 ? Ptpb1D : tpb1D
tpb2tD = et == ex1 ? Ptpb2D : tpb2D
tpb3tD = et == ex1 ? Ptpb3D : tpb3D
tpb4tD = Ptpb4D
slbtD = et == ex1 ? PslbD : slbD
tps1tD = et == ex1 ? Ptps1D : tps1D
tps2tD = et == ex1 ? Ptps2D : tps2D
tps3tD = et == ex1 ? Ptps3D : tps3D
tps4tD = Ptps4D
slstD = et == ex1 ? PslsD : slsD
sinceentrybD = int([Link](1, nz([Link](buyD))))
openedbD = [Link](buyD) >= 0 and trendD[1] == 1 and longside
highestbarbD = [Link](sinceentrybD)
lowestbarbD = [Link](sinceentrybD)
stillopenb1D = [Link](buyD) == 1 ? true : highestbarbD[1] < tpb1tD and
lowestbarbD[1] > slbtD
stillopenb2D = [Link](buyD) == 1 ? true : highestbarbD[1] < tpb2tD and
lowestbarbD[1] > slbtD
stillopenb3D = [Link](buyD) == 1 ? true : highestbarbD[1] < tpb3tD and
lowestbarbD[1] > slbtD
stillopenb4D = [Link](buyD) == 1 ? true : highestbarbD[1] < tpb4tD and
lowestbarbD[1] > slbtD
hittpb1D = [Link](highD, tpb1tD) and stillopenb1D and openedbD
plotshape(hittpb1D)
hittpb2D = [Link](highD, tpb2tD) and stillopenb2D and openedbD
hittpb3D = [Link](highD, tpb3tD) and stillopenb3D and openedbD
hittpb4D = [Link](highD, tpb4tD) and stillopenb4D and openedbD
hitslbD = lowD < slbtD and stillopenb4D and openedbD
winreversebD = closeD > cbD and backtest and [Link](closeD, stD) and
stillopenb4D and trendD == -1 and openedbD
losereversebD = closeD < cbD and backtest and [Link](closeD, stD) and
stillopenb4D and trendD == -1 and openedbD
sinceentrysD = int([Link](1, nz([Link](sellD))))
openedsD = [Link](sellD) >= 0 and trendD[1] == -1 and shortside
highestbarsD = [Link](sinceentrysD)
lowestbarsD = [Link](sinceentrysD)
stillopens1D = [Link](sellD) == 1 ? true : highestbarsD[1] < slstD and
lowestbarsD[1] > tps1tD
stillopens2D = [Link](sellD) == 1 ? true : highestbarsD[1] < slstD and
lowestbarsD[1] > tps2tD
stillopens3D = [Link](sellD) == 1 ? true : highestbarsD[1] < slstD and
lowestbarsD[1] > tps3tD
stillopens4D = [Link](sellD) == 1 ? true : highestbarsD[1] < slstD and
lowestbarsD[1] > tps4tD
hittps1D = [Link](lowD, tps1tD) and stillopens1D and openedsD
hittps2D = [Link](lowD, tps2tD) and stillopens2D and openedsD
hittps3D = [Link](lowD, tps3tD) and stillopens3D and openedsD
hittps4D = [Link](lowD, tps4tD) and stillopens4D and openedsD
hitslsD = highD > slstD and stillopens4D and openedsD
winreversesD = closeD <= csD and backtest and [Link](closeD, stD) and
stillopens4D and trendD == 1 and openedsD
losereversesD = closeD >= csD and backtest and [Link](closeD, stD) and
stillopens4D and trendD == 1 and openedsD
//============================================
cumbuyD = [Link](buyD ? 1 : 0)
cumsellD = [Link](sellD ? 1 : 0)
cumsignalD = cumbuyD + cumsellD
//net profit
sisaqtybD = stillopenb1D ? 1 : stillopenb2D ? 1 - Qtytp1 : stillopenb3D ? 1 -
(Qtytp1 + Qtytp2) : 1 - (Qtytp1 + Qtytp2 + Qtytp3)
sisaqtysD = stillopens1D ? 1 : stillopens2D ? 1 - Qtytp1 : stillopens3D ? 1 -
(Qtytp1 + Qtytp2) : 1 - (Qtytp1 + Qtytp2 + Qtytp3)
ptpb1D = (tpb1tD - cbD) * 100 / cbD * Qtytp1 //-0.06
ptpb2D = (tpb2tD - cbD) * 100 / cbD * Qtytp2 //-0.06
ptpb3D = (tpb3tD - cbD) * 100 / cbD * Qtytp3 //-0.06
ptpb4D = (tpb4tD - cbD) * 100 / cbD * Qtytp4 //-0.06
pslbD = (closeD - cbD) * 100 / cbD * sisaqtybD //-0.06
prbD = (closeD - cbD) * 100 / cbD * sisaqtybD //-0.06
ptps1D = (csD - tps1tD) * 100 / csD * Qtytp1 //-0.06
ptps2D = (csD - tps2tD) * 100 / csD * Qtytp2 //-0.06
ptps3D = (csD - tps3tD) * 100 / csD * Qtytp3 //-0.06
ptps4D = (csD - tps4tD) * 100 / csD * Qtytp4 //-0.06
pslsD = (csD - closeD) * 100 / csD * sisaqtysD //-0.06
prsD = (csD - closeD) * 100 / csD * sisaqtysD //-0.06
prtpb1D = [Link](hittpb1D ? ptpb1D : 0)
prtpb2D = [Link](hittpb2D ? ptpb2D : 0)
prtpb3D = [Link](hittpb3D ? ptpb3D : 0)
prtpb4D = [Link](hittpb4D ? ptpb4D : 0)
prslbD = [Link](hitslbD ? pslbD : 0)
prwrbD = [Link](winreversebD ? prbD : 0)
prlrbD = [Link](losereversebD ? prbD : 0)
prtps1D = [Link](hittps1D ? ptps1D : 0)
prtps2D = [Link](hittps2D ? ptps2D : 0)
prtps3D = [Link](hittps3D ? ptps3D : 0)
prtps4D = [Link](hittps4D ? ptps4D : 0)
prslsD = [Link](hitslsD ? pslsD : 0)
prwrsD = [Link](winreversesD ? prsD : 0)
prlrsD = [Link](losereversesD ? prsD : 0)
netcapitalgainD = prtpb1D + prtpb2D + prtpb3D + prtpb4D + prslbD + prtps1D +
prtps2D + prtps3D + prtps4D + prslsD + prwrbD + prlrbD + prwrsD + prlrsD
///winrate
wintpb1D = [Link](hittpb1D ? 1 : 0)
wintpb2D = [Link](hittpb2D ? 1 : 0)
wintpb3D = [Link](hittpb3D ? 1 : 0)
wintpb4D = [Link](hittpb4D ? 1 : 0)
wrslbD = [Link](hitslbD ? 1 : 0)
wintps1D = [Link](hittps1D ? 1 : 0)
wintps2D = [Link](hittps2D ? 1 : 0)
wintps3D = [Link](hittps3D ? 1 : 0)
wintps4D = [Link](hittps4D ? 1 : 0)
wrslsD = [Link](hitslsD ? 1 : 0)
cumtp1D = wintpb1D + wintps1D
cumtp2D = wintpb2D + wintps2D
cumtp3D = wintpb3D + wintps3D
cumtp4D = wintpb4D + wintps4D
cumslD = wrslbD + wrslsD
cumpositionD = cumtp1D + cumtp2D + cumtp3D + cumtp4D + cumslD
//+cumwinreverseD//+cumlosereverseD
wrtp1D = truncate(cumtp1D * 100 / cumsignalD, 0)
wrtp2D = truncate(cumtp2D * 100 / cumsignalD, 0)
wrtp3D = truncate(cumtp3D * 100 / cumsignalD, 0)
wrtp4D = truncate(cumtp4D * 100 / cumsignalD, 0)
wrslD = truncate(cumslD * 100 / cumsignalD, 0)
winallD = cumtp1D + cumtp2D + cumtp3D + cumtp4D //+cumwinreverseD
wrallD = winallD * 100 / cumpositionD
//===================================================================
//===================================================================
//
===================================================================================
====
//Trend Panel
smoothKsrsi = [Link](3, 'K', minval=1)
smoothDsrsi = [Link](3, 'D', minval=1)
lengthRSIsrsi = [Link](14, 'RSI Length', minval=1)
lengthStochsrsi = [Link](14, 'Stochastic Length', minval=1)
srcsrsi = input(close, title='RSI Source')
rsi1srsi = [Link](srcsrsi, lengthRSIsrsi)
ksrsi = truncate([Link]([Link](rsi1srsi, rsi1srsi, rsi1srsi, lengthStochsrsi),
smoothKsrsi), dpa)
dsrsi = [Link](ksrsi, smoothDsrsi)
fast_lengthm = input(title='Fast Length', defval=12)
slow_lengthm = input(title='Slow Length', defval=26)
srcm = input(title='Source', defval=close)
signal_lengthm = [Link](title='Signal Smoothing', minval=1, maxval=50, defval=9)
sma_sourcem = [Link](title='Oscillator MA Type', defval='EMA',
options=['SMA', 'EMA'])
sma_signalm = [Link](title='Signal Line MA Type', defval='EMA',
options=['SMA', 'EMA'])
fast_mam = sma_sourcem == 'SMA' ? [Link](srcm, fast_lengthm) : [Link](srcm,
fast_lengthm)
slow_mam = sma_sourcem == 'SMA' ? [Link](srcm, slow_lengthm) : [Link](srcm,
slow_lengthm)
macd = fast_mam - slow_mam
signalm = sma_signalm == 'SMA' ? [Link](macd, signal_lengthm) : [Link](macd,
signal_lengthm)
histm = macd - signalm
trenddir = RSI > 55 ? 'Bullish' : RSI < 45 ? 'Bearish' : 'Sideways'
//Tele Notif
ep = trend == 1 ? cb : cs
winrate = truncate([Link] / [Link] * 100, 0)
capitalgain = 100 * [Link] / initialcapital
closedtrades = [Link]
//Gathers User Inputs
//Dashboard
sideentry = strategy.position_size > 0 ? 'LONG' : strategy.position_size < 0 ?
'SHORT' : 'No Position'
epp = strategy.position_size > 0 ? cb : strategy.position_size < 0 ? cs : na
tp1p = truncate(strategy.position_size > 0 ? tpb1t : strategy.position_size < 0 ?
tps1t : na, dpa)
tp2p = truncate(strategy.position_size > 0 ? tpb2t : strategy.position_size < 0 ?
tps2t : na, dpa)
tp3p = truncate(strategy.position_size > 0 ? tpb3t : strategy.position_size < 0 ?
tps3t : na, dpa)
tp4p = truncate(strategy.position_size > 0 ? tpb4t : strategy.position_size < 0 ?
tps4t : na, dpa)
slp = truncate(strategy.position_size > 0 ? slbt : strategy.position_size < 0 ?
slst : na, dpa)
dashDist = [Link](5, 'Dashboard Distance', group='Dashboard Settings')
dashColor = [Link]([Link](#000000, 0), 'Dashboard Color', inline='Dash
Line', group='Dashboard Settings')
dashTextColor = [Link]([Link](#ffffff, 0), 'Text Color', inline='Dash
Line', group='Dashboard Settings')
sinceentryb = int([Link](1, nz([Link](buy and backtest and trendType))))
highestbarb = [Link](high[1], sinceentryb)
lowestbarb = [Link](low[1], sinceentryb)
sinceentrys = int([Link](1, nz([Link](sell and backtest and trendType))))
highestbars = [Link](high[1], sinceentrys)
lowestbars = [Link](low[1], sinceentrys)
hittp1 = strategy.position_size > 0 ? highestbars > tpb1t : strategy.position_size
< 0 ? lowestbars < tps1t : na
hittp1t = hittp1 ? ' ✅' : na
hittp2 = strategy.position_size > 0 ? highestbars > tpb2t : strategy.position_size
< 0 ? lowestbars < tps2t : na
hittp2t = hittp2 ? ' ✅' : na
hittp3 = strategy.position_size > 0 ? highestbars > tpb3t : strategy.position_size
< 0 ? lowestbars < tps3t : na
hittp3t = hittp3 ? ' ✅' : na
hittp4 = strategy.position_size > 0 ? highestbars > tpb4t : strategy.position_size
< 0 ? lowestbars < tps4t : na
hittp4t = hittp4 ? ' ✅' : na
longnotif = '_____________________________' + '\n ' +
'\n📡📡Signals 💯Max🤖Profit💸 📡📡' + '\n_____________________________' + '\n
' + '\nCoin : ' + [Link] + '\nPosition : 🔺 LONG' + '\
nOpen Price : ' + [Link](truncate(ep, dpa)) + '\nTake Profit 1 : ' +
[Link](truncate(tpb1t, dpa)) + '\nTake Profit 2 : ' +
[Link](truncate(tpb2t, dpa)) + '\nTake Profit 3 : ' +
[Link](truncate(tpb3t, dpa)) + '\nTake Profit 4 : ' +
[Link](truncate(tpb4t, dpa)) + '\nStoploss : ' +
[Link](truncate(slbt, dpa)) + '\n_____________________________' + '\n
' + '\n Backtest Days ' + 'On ' + [Link](truncate(daysback, 2)) + ' Days 💰' +
'\n_____________________________' + '\n ' + '\n🌟 💯Max🤖
Profit💸 Winrate : ' + [Link](winrate) + ' % 🌟' + '\n💰 Net Profits : ' +
[Link](truncate(capitalgain, 2)) + '% 💰' + '\n📌 Total Trades : ' +
[Link](closedtrades) + ' 📌' + '\n_____________________________'
//+ '\n\n🎯 TAKE PROFITS RATINGS (%) 🎯'
//+ '\n_____________________________'
//+ '\n\nTake Profits 1 : '+tostring(wrtp1A)+' %'
//+ '\nTake Profits 2 : ' +tostring(wrtp2A)+' %'
//+ '\nTake Profits 3 : ' +tostring(wrtp3A)+' %'
//+ '\nTake Profits 4 : ' +tostring(wrtp4A)+' %'
//+ '\n_______________________________'
//+ '\n '
//+ '\n🧾Panel 💯Max🤖Profit💸'
//+ '\n_______________________________'
//+ '\n '
//+ '\nRSI : ' + tostring(RSI)
//+ '\nSRSI : ' + tostring(ksrsi)
//+ '\nCurrent Sentiment = ' + tostring(trenddir)
//+ '\n_____________________________'
//+ '\n '
//+ '\n🚨 Notes 🚨'
//+ '\n• Disclaimer On !'
//+ '\n• Future USD-M Coin Mode.'
//+ '\n• Trade with high risk.'
//+ '\n• Stay wise & disciplined.'
//+ '\n• Risk Management.'
//+ '\n• Use 1-3% of the total Wallet Future.\n'
//+ '\n_____________________________'
//+ '\n '
//+ '\n 🎉 Happy Profit 🎉'
//+ '\n_____________________________'
shortnotif = '_______________________________' + '\n '
+ '\n📡📡Signals 💯Max🤖Profit💸 📡📡' + '\n_____________________________' + '\n
' + '\nCoin : ' + [Link] + '\nPosition : 🔻 SHORT' + '\
nOpen Price : ' + [Link](truncate(ep, dpa)) + '\nTake Profit 1 : ' +
[Link](truncate(tps1t, dpa)) + '\nTake Profit 2 : ' +
[Link](truncate(tps2t, dpa)) + '\nTake Profit 3 : ' +
[Link](truncate(tps3t, dpa)) + '\nTake Profit 4 : ' +
[Link](truncate(tps4t, dpa)) + '\nStoploss : ' +
[Link](truncate(slst, dpa)) + '\n_____________________________' + '\n
' + '\n Backtest Days ' + 'On ' + [Link](truncate(daysback, 2)) + ' Days 💰' +
'\n_____________________________' + '\n ' + '\n🌟 💯Max🤖
Profit💸 Winrate : ' + [Link](winrate) + ' % 🌟' + '\n💰 Net Profits : ' +
[Link](truncate(capitalgain, 2)) + '% 💰' + '\n📌 Total Trades : ' +
[Link](closedtrades) + ' 📌' + '\n_____________________________'
//+ '\n\n🎯 TAKE PROFITS RATINGS (%) 🎯'
//+ '\n_____________________________'
//+ '\n\nTake Profits 1 : '+tostring(wrtp1A)+' %'
//+ '\nTake Profits 2 : ' +tostring(wrtp2A)+' %'
//+ '\nTake Profits 3 : ' +tostring(wrtp3A)+' %'
//+ '\nTake Profits 4 : ' +tostring(wrtp4A)+' %'
//+ '\n_______________________________'
//+ '\n '
//+ '\n🧾Panel 💯Max🤖Profit💸'
//+ '\n_______________________________'
//+ '\n '
//+ '\nRSI : ' + tostring(RSI)
//+ '\nSRSI : ' + tostring(ksrsi)
//+ '\nCurrent Sentiment = ' + tostring(trenddir)
//+ '\n_____________________________'
//+ '\n '
//+ '\n🚨 Notes 🚨'
//+ '\n• Disclaimer On !'
//+ '\n• Future USD-M Coin Mode.'
//+ '\n• Trade with high risk.'
//+ '\n• Stay wise & disciplined.'
//+ '\n• Risk Management.'
//+ '\n• Use 1-3% Wallet Future.\n'
//+ '\n_____________________________'
//+ '\n '
// + '\n🎉 Happy Profit 🎉'
// + '\n_____________________________'
exitziglong1 = '⚠Position Status⚠\n\nTake Profit 1 ✅ From 🔺 Long Signal\n' + 'at
Price : ' + [Link](tpb1t) + ' in ' + [Link] // +
tostring(exitpricelong1)
exitzigshort1 = '⚠Position Status⚠\n\nTake Profit 1 ✅ From 🔻 Short Signal\n' + 'at
Price : ' + [Link](tps1t) + ' in ' + [Link] //+
tostring(exitpriceshort1)
exitziglong2 = '⚠Position Status⚠\n\nTake Profit 2 ✅ From 🔺 Long Signal\n' + 'at
Price : ' + [Link](tpb2t) + ' in ' + [Link] // +
tostring(exitpricelong2)
exitzigshort2 = '⚠Position Status⚠\n\nTake Profit 2 ✅ From 🔻 Short Signal\n' + 'at
Price : ' + [Link](tps2t) + ' in ' + [Link] // +
tostring(exitpriceshort2)
exitziglong3 = '⚠Position Status⚠\n\nTake Profit 3 ✅ From 🔺 Long Signal\n' + 'at
Price : ' + [Link](tpb3t) + ' in ' + [Link] // +
tostring(exitpricelong3)
exitzigshort3 = '⚠Position Status⚠\n\nTake Profit 3 ✅ From 🔻 Short Signal\n' + 'at
Price : ' + [Link](tps3t) + ' in ' + [Link] // +
tostring(exitpriceshort3)
exitziglong4 = '⚠Position Status⚠\n\nTake Profit 4 ✅ From 🔺 Long Signal\n' + 'at
Price : ' + [Link](tpb4t) + ' in ' + [Link] // +
tostring(exitpricelong3)
exitzigshort4 = '⚠Position Status⚠\n\nTake Profit 4 ✅ From 🔻 Short Signal\n' + 'at
Price : ' + [Link](tps4t) + ' in ' + [Link] // +
tostring(exitpriceshort3)
sllong = '⚠Position Status⚠\n\nHit SL 💋 From 🔺 Long Signal\n' + ' Price : ' +
[Link](slbt) + ' in ' + [Link] // + tostring(exitpricelong4)
slshort = '⚠Position Status⚠\n\nHit SL 💋 From 🔻 Short Signal\n' + ' Price : ' +
[Link](slst) + ' in ' + [Link] // + tostring(exitpriceshort4)
longbotcommand = ZZ == z1 ? longct : ZZ == z2 ? longsp : longnotif
shortbotcommand = ZZ == z1 ? shortct : ZZ == z2 ? shortsp : shortnotif
exitbotcommandl1 = ZZ == z3 ? exitziglong1 : na
exitbotcommands1 = ZZ == z3 ? exitzigshort1 : na
exitbotcommandl2 = ZZ == z3 ? exitziglong2 : na
exitbotcommands2 = ZZ == z3 ? exitzigshort2 : na
exitbotcommandl3 = ZZ == z3 ? exitziglong3 : na
exitbotcommands3 = ZZ == z3 ? exitzigshort3 : na
exitbotcommandl4 = ZZ == z3 ? exitziglong4 : na
exitbotcommands4 = ZZ == z3 ? exitzigshort4 : na
sllongcommand = ZZ == z3 ? sllong : slcommand
slshortcommand = ZZ == z3 ? slshort : slcommand
//
if buy and backtest and trendType and longside
[Link]('Buy', direction=[Link], comment='LONG',
alert_message=longbotcommand)
if sell and backtest and trendType and shortside
[Link]('Sell', direction=[Link], comment='SHORT',
alert_message=shortbotcommand)
[Link]('TP 1', 'Buy', qty_percent=qtytp1, limit=tpb1t,
alert_message=exitbotcommandl1)
[Link]('TP 2', 'Buy', qty_percent=qtytp2, limit=tpb2t,
alert_message=exitbotcommandl2)
[Link]('TP 3', 'Buy', qty_percent=qtytp3, limit=tpb3t,
alert_message=exitbotcommandl3)
[Link]('TP 4', 'Buy', qty_percent=qtytp4, limit=tpb4t,
alert_message=exitbotcommandl4)
slbclose = sellsignal1 or low < slbt
[Link]('Buy', when=slbclose, comment='SL', alert_message=sllongcommand)
[Link]('TP 1', 'Sell', qty_percent=qtytp1, limit=tps1t,
alert_message=exitbotcommands1)
[Link]('TP 2', 'Sell', qty_percent=qtytp2, limit=tps2t,
alert_message=exitbotcommands1)
[Link]('TP 3', 'Sell', qty_percent=qtytp3, limit=tps3t,
alert_message=exitbotcommands1)
[Link]('TP 4', 'Sell', qty_percent=qtytp4, limit=tps4t,
alert_message=exitbotcommands1)
slsclose = buysignal1 or high > slst
[Link]('Sell', when=slsclose, comment='SL', alert_message=slshortcommand)
plot(strategy.position_size <= 0 ? na : tpb1t, color=[Link]([Link], 0),
style=plot.style_linebr, linewidth=2, title='TP 1 Buy')
plot(strategy.position_size <= 0 ? na : tpb2t, color=[Link]([Link], 0),
style=plot.style_linebr, linewidth=2, title='TP 2 Buy')
plot(strategy.position_size <= 0 ? na : tpb3t, color=[Link]([Link], 0),
style=plot.style_linebr, linewidth=2, title='TP 3 Buy')
plot(strategy.position_size >= 0 ? na : tps1t, color=[Link]([Link], 0),
style=plot.style_linebr, linewidth=2, title='TP 1 Sell')
plot(strategy.position_size >= 0 ? na : tps2t, color=[Link]([Link], 0),
style=plot.style_linebr, linewidth=2, title='TP 2 Sell')
plot(strategy.position_size >= 0 ? na : tps3t, color=[Link]([Link], 0),
style=plot.style_linebr, linewidth=2, title='TP 3 Sell')
plot(strategy.position_size >= 0 ? na : tps4t, color=[Link]([Link], 0),
style=plot.style_linebr, linewidth=2, title='TP 4 Sell')
plot(strategy.position_size <= 0 ? na : tpb4t, color=[Link]([Link], 0),
style=plot.style_linebr, linewidth=2, title='TP 4 Sell')
plot(strategy.position_size >= 0 ? na : slst, color=[Link]([Link], 0),
style=plot.style_linebr, linewidth=2, title='TP 4 Sell')
plot(strategy.position_size <= 0 ? na : slbt, color=[Link]([Link], 0),
style=plot.style_linebr, linewidth=2, title='TP 4 Sell')
//
besttf = [Link](netcapitalgainA, netcapitalgainB, netcapitalgainC,
netcapitalgainD)
besttft = besttf == netcapitalgainA ? tf1 : besttf == netcapitalgainB ? tf2 :
besttf == netcapitalgainC ? tf3 : besttf == netcapitalgainD ? tf4 : na
accesstf = [Link]
wrtp1 = accesstf == [Link](3) ? besttf == netcapitalgainA ? wrtp1A : besttf
== netcapitalgainB ? wrtp1B : besttf == netcapitalgainC ? wrtp1C : besttf ==
netcapitalgainD ? wrtp1D : na : na
wrtp2 = accesstf == [Link](3) ? besttf == netcapitalgainA ? wrtp2A : besttf
== netcapitalgainB ? wrtp2B : besttf == netcapitalgainC ? wrtp2C : besttf ==
netcapitalgainD ? wrtp2D : na : na
wrtp3 = accesstf == [Link](3) ? besttf == netcapitalgainA ? wrtp3A : besttf
== netcapitalgainB ? wrtp3B : besttf == netcapitalgainC ? wrtp3C : besttf ==
netcapitalgainD ? wrtp3D : na : na
wrtp4 = accesstf == [Link](3) ? besttf == netcapitalgainA ? wrtp4A : besttf
== netcapitalgainB ? wrtp4B : besttf == netcapitalgainC ? wrtp4C : besttf ==
netcapitalgainD ? wrtp4D : na : na
wrsl = accesstf == [Link](3) ? besttf == netcapitalgainA ? wrslA : besttf ==
netcapitalgainB ? wrslB : besttf == netcapitalgainC ? wrslC : besttf ==
netcapitalgainD ? wrslD : na : na
Besttf = accesstf == [Link](3) ? besttft : 'NaN'
mtfanalysis = accesstf == [Link](3) ? [Link](Besttf) : 'NaN'
dashboardtext = '_______________________________' + '\n
' + '\nSignals Maa Sharda Trading' + '\n_______________________________' + '\n
' + '\nCoin : ' + [Link] + '\nLaverage : 10x-20X' + '\nExchanges : Binance
Futures' + '\nPosition : ' + [Link](sideentry) + '\nEntry Target : ' +
[Link](truncate(epp, dpa)) + '\nTake Profit 1 : ' +
[Link](truncate(tp1p, dpa)) + [Link](hittp1t) + '\nTake Profit 2 : ' +
[Link](truncate(tp2p, dpa)) + [Link](hittp2t) + '\nTake Profit 3 : ' +
[Link](truncate(tp3p, dpa)) + [Link](hittp3t) + '\nTake Profit 4 : ' +
[Link](truncate(tp4p, dpa)) + [Link](hittp4t) + '\nStop Target : ' +
[Link](truncate(slp, dpa)) + '\n_______________________________' + '\n\nMulti
TF Analysis' + '\nBuka akses TF 3m untuk melihat Best TF ' + '\n\n Best TimeFrame :
' + mtfanalysis + '\n_______________________________' + '\n
' + '\nWinrate : ' + [Link](winrate) + ' %' + '\nNet Profits : ' +
[Link](truncate(capitalgain, 2)) + ' % On ' + [Link](daysback) + '
Days' + '\nTotal Trades : ' + [Link](closedtrades) + '\
n_____________________________' + '\n\n🎯 TAKE PROFITS RATINGS (%) 🎯' + '\
n_____________________________' + '\n\nTake Profits 1 : ' + [Link](wrtp1A) +
' %' + '\nTake Profits 2 : ' + [Link](wrtp2A) + ' %' + '\nTake Profits 3 : '
+ [Link](wrtp3A) + ' %' + '\nTake Profits 4 : ' + [Link](wrtp4A) + ' %'
// + '\n_______________________________'
// + '\n\n🧾Panel 💯Max🤖Profit💸'
// + '\n_______________________________'
// + '\n '
// + '\nRSI = ' + tostring(RSI)
// + '\nCurrent Sentiment = ' + tostring(trenddir)
// + '\n_______________________________'
// + '\n '
// + '\n🎉 Happy Profit 🎉'
// + '\n_______________________________'
// + '\n' + tostring(netcapitalgainA)
// + '\n' + tostring(netcapitalgainB)
// + '\n' + tostring(netcapitalgainC)
// + '\n' + tostring(netcapitalgainD)
//if strategy.position_size>0?strategy.position_size>0:strategy.position_size<0
label lemonLabel = [Link](time, close, text=dashboardtext, color=dashColor,
xloc=xloc.bar_time, style=label.style_label_left, textcolor=dashTextColor,
textalign=text.align_center)
label.set_x(lemonLabel, label.get_x(lemonLabel) + [Link]([Link](time) *
dashDist))
[Link](lemonLabel[1])
//PLOTTING
bodyMiddle = plot(ST ? (open + close) / 2 : na, display=[Link])
uptrend = plot(ST ? trend < 0 ? na : up : na, 'Up trend',
color=[Link]([Link], 0), style=plot.style_linebr, linewidth=2)
downtrend = plot(ST ? trend < 0 ? dn : na : na, 'Down trend',
color=[Link]([Link], 0), style=plot.style_linebr, linewidth=2)