Strategi Manajemen Perdagangan Grid Dinamis

Penulis:ChaoZhang, Tanggal: 2023-12-04 15:43:44
Tag:

img

Gambaran umum

Strategi Manajemen Trading Grid Dinamis adalah pendekatan perdagangan berbasis fluktuasi pasar. Dengan memanfaatkan volatilitas pasar, strategi ini menetapkan titik beli dan jual pada tingkat harga yang berbeda untuk mengoptimalkan portofolio. Strategi ini dapat disesuaikan dengan berbagai kondisi pasar, terutama cocok untuk kepemilikan jangka panjang, perdagangan spot, dan perdagangan swing tanpa leverage.

Prinsip Strategi

Inti dari Strategi Manajemen Perdagangan Grid Dinamis adalah menggunakan titik pivot berdasarkan periode waktu untuk menentukan tingkat grid. Ini menetapkan beberapa titik pembelian dan penjualan, membeli ketika harga pasar turun, dan menjual ketika naik. Membeli terus-menerus selama penurunan pasar menurunkan biaya akuisisi rata-rata. Ketika harga pasar melebihi harga pembelian rata-rata, strategi mulai menjual, terus melakukannya jika harga terus meningkat, sehingga mewujudkan keuntungan.

Keuntungan dari Strategi

  1. ** Adap

t untuk Fluktuasi Pasar**: Strategi ini secara efektif beradaptasi dengan perubahan pasar, berlaku di pasar bull dan bear. 2.Diversifikasi Risiko: Perdagangan pada tingkat harga yang berbeda mendiversifikasi risiko membeli atau menjual pada satu titik harga. 3.Manfaat jangka panjang: Cocok untuk strategi kepemilikan jangka panjang, berpotensi menghasilkan pengembalian yang stabil dari waktu ke waktu karena efek biaya rata-rata.

Risiko dari Strategi

  1. Perilaku Pasar yang Ekstrim: Dalam kondisi pasar yang ekstrim, seperti fluktuasi drastis atau kejatuhan pasar, strategi dapat menghadapi risiko yang signifikan.
  2. Kebutuhan Optimasi Strategi: Strategi ini membutuhkan penyesuaian dan optimalisasi terus menerus sesuai dengan kondisi pasar.

Arahan untuk Optimalisasi

  1. Pengaturan Parameter: Penyesuaian ukuran grid dan frekuensi perdagangan sesuai dengan perubahan pasar dapat mengakomodasi volatilitas pasar yang berbeda.
  2. Pengendalian Risiko: Memperkenalkan mekanisme manajemen risiko yang lebih halus, seperti menetapkan titik stop-loss, untuk menghindari kerugian besar dalam kondisi pasar yang ekstrim.

Kesimpulan

Strategi Manajemen Perdagangan Grid Dinamis adalah pendekatan perdagangan serbaguna, berlaku untuk berbagai lingkungan pasar. Dengan berdagang pada tingkat harga yang berbeda, itu bertujuan untuk mengurangi risiko dan mencapai keuntungan jangka panjang. Namun, karena ketidakpastian pasar, strategi ini membutuhkan penyesuaian dan optimalisasi yang berkelanjutan untuk beradaptasi dengan perubahan pasar. Secara keseluruhan, strategi ini menawarkan pilihan yang menarik bagi investor yang mencari pengembalian jangka panjang dan stabil.


/*backtest
start: 2022-11-27 00:00:00
end: 2023-12-03 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// Β© XaviZ

//@version=4
strategy(title = "CoGrid Management", shorttitle = "CoGridπŸ’Ή", overlay = true, pyramiding = 1000, default_qty_value = 0)

// β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” Inputs

WOption             = input('PRICE',        " 》 WIDTH TYPE",                                                   options = ['PRICE','% PP'])
Width               = input(500,            " 》 WIDTH",                type = input.float,     minval = 0)
ppPeriod            = input('Month',        " 》 PP PERIOD",                                                    options = ['Day','Week','15D','Month'])
BuyType             = input("CASH",         " 》 BUY TYPE",                                                     options = ["CONTRACTS","CASH","% EQUITY"])
BuyQ                = input(10000,          " 》 QUANTITY TO BUY",      type = input.float,     minval = 0)
SellType            = input('CONTRACTS',    " 》 SELL TYPE",                                                    options = ["CONTRACTS","CASH","% EQUITY"])
SellQ               = input(2,              " 》 QUANTITY TO SELL",     type = input.float,     minval = 0)

// β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” Vars

// β€”β€”β€”β€”β€” Buy Price & Sell Price
var float OpenPrice = na
OpenPrice := nz(OpenPrice[1])

// β€”β€”β€”β€”β€” Final Buy Price & Final Sell Price
var float FinalBuyPrice = na
FinalBuyPrice  := nz(FinalBuyPrice[1])
var float FinalSellPrice = na
FinalSellPrice := nz(FinalSellPrice[1])
var float FinalOpenPrice = na
FinalOpenPrice := nz(FinalOpenPrice[1])

// β€”β€”β€”β€”β€” Average Price
var int nBuys = na
nBuys := nz(nBuys[1])
var int nSells = na
nSells := nz(nSells[1])
var float sumBuy = na
sumBuy := nz(sumBuy[1])
var float sumSell = na
sumSell := nz(sumSell[1])
var float sumQtyBuy = na
sumQtyBuy := nz(sumQtyBuy[1])
var float sumQtySell = na
sumQtySell := nz(sumQtySell[1])
var float AveragePrice = na
AveragePrice := nz(AveragePrice[1])

// β€”β€”β€”β€”β€” Fibonacci Pivots Level Calculation
var float PP = na

// β€”β€”β€”β€”β€” Origin from Rounded Pivot Points or last Sell
var float PPdownOrigin = na

// β€”β€”β€”β€”β€” Origin from Rounded Position Price
var float PPupOrigin = na

// β€”β€”β€”β€”β€” Final Buy & Sell Conditions
var bool BuyCondition = na
BuyCondition := nz(BuyCondition[1])
var bool SellCondition = na
SellCondition := nz(SellCondition[1])

// β€”β€”β€”β€”β€” Backtest
BuyFactor           = BuyType  == "CONTRACTS"   ? 1 : BuyType == "% EQUITY" ? (100 / (strategy.equity / close)) : close
SellFactor          = SellType == "CASH"        ? close : 1
BuyQuanTity         = BuyQ  / BuyFactor
SellQuanTity        = SellQ / SellFactor

// β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” Pivot Points

// β€”β€”β€”β€”β€” Pivot Points Period
res                 = ppPeriod == '15D' ? '15D' : ppPeriod == 'Week' ? 'W' : ppPeriod == 'Day' ? 'D' : 'M'

// β€”β€”β€”β€”β€” High, Low, Close Calc. 
// "Function to securely and simply call `security()` so that it never repaints and never looks ahead" (@PineCoders)
f_secureSecurity(_symbol, _res, _src) => security(_symbol, _res, _src[1], lookahead = barmerge.lookahead_on)

phigh               = f_secureSecurity(syminfo.tickerid, res, high)
plow                = f_secureSecurity(syminfo.tickerid, res, low)
pclose              = f_secureSecurity(syminfo.tickerid, res, close)

// β€”β€”β€”β€”β€” Fibonacci Pivots Level Calculation
PP                  := (phigh + plow + pclose) / 3

// β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” Grid Strategy

// β€”β€”β€”β€”β€” Width between levels
float GridWidth     = WOption == 'PRICE' ? Width : PP * (Width/100)

// β€”β€”β€”β€”β€” Origin from Rounded Pivot Points
PPdownOrigin        := floor(PP / GridWidth) * GridWidth

// β€”β€”β€”β€”β€” Origin from Rounded Average Position Price
PPupOrigin          := nz(PPupOrigin[1])

// β€”β€”β€”β€”β€” Grid Calculation
fGrid(_1, _2, _n) =>
    _a = _1, _b = _2, _c = 0.0
    for _i = 1 to _n
        if _i == 1
            _c := _a
        else
            _c := _a + _b
        _a := _c

// β€”β€”β€”β€”β€” Initial Open Price
fOpenPrice() =>
    var float _ldown = na
    var bool _pb = na
    var float _lup = na
    var bool  _ps = na
    var float _OpenPrice = na
    _OpenPrice := nz(_OpenPrice[1])
    for _i = 1 to 15
        _ldown := fGrid(PPdownOrigin, -GridWidth, _i)
        _lup := fGrid(PPupOrigin, GridWidth, _i)
        _pb := crossunder(low, _ldown) and high >= _ldown
        _ps := crossover(high, _lup) and low <= _lup
        if _pb
            _OpenPrice := _ldown
        if _ps
            _OpenPrice := _lup
    _OpenPrice
    
OpenPrice := fOpenPrice()

// β€”β€”β€”β€”β€” Buy at better Price
fBuyCondition(_n) =>
    var float _ldown = na
    _ldown := nz(_ldown[1])
    var bool _pb = na
    _pb := nz(_pb[1])
    var bool _BuyCondition = na
    _BuyCondition := nz(_BuyCondition[1])
    for _i = 1 to _n
        _ldown := fGrid(PPdownOrigin, -GridWidth, _i)
        _pb := crossunder(low, _ldown) and high >= _ldown
        _BuyCondition := nz(nBuys) == 0 ? _pb and _ldown < (fixnan(OpenPrice[1]) - GridWidth / 4)  : _pb and _ldown < (fixnan(FinalOpenPrice[1]) - GridWidth / 4)
    _BuyCondition

// β€”β€”β€”β€”β€” Sell at better Price
fSellCondition(_n) =>
    var float _lup = na
    _lup := nz(_lup[1])
    var bool  _ps = na
    _ps := nz(_ps[1])
    var bool _SellCondition = na
    _SellCondition := nz(_SellCondition[1])
    for _i = 1 to _n
        _lup := fGrid(PPupOrigin, GridWidth, _i)
        _ps  := crossover(high, _lup) and low <= _lup
        _SellCondition := nz(nSells) == 0 ? _ps and _lup > (fixnan(OpenPrice[1]) + GridWidth / 4) : _ps and _lup > (fixnan(FinalOpenPrice[1]) + GridWidth / 4)
    _SellCondition

// β€”β€”β€”β€”β€” Final Open Price
fFinalOpenPrice() =>
    var float _ldown = na
    _ldown := nz(_ldown[1])
    var float _lup = na
    _lup := nz(_lup[1])
    var float _FinalBuyPrice = na
    _FinalBuyPrice := nz(_FinalBuyPrice[1])
    var float _FinalSellPrice = na
    _FinalSellPrice := nz(_FinalSellPrice[1])
    var float _FinalOpenPrice = na
    _FinalOpenPrice := nz(_FinalOpenPrice[1])
    for _i = 1 to 15
        _ldown := fGrid(PPdownOrigin, -GridWidth, _i)
        _lup := fGrid(PPupOrigin, GridWidth, _i)
        if fBuyCondition(_i)
            _FinalBuyPrice  := _ldown
            _FinalOpenPrice := _ldown
        if fSellCondition(_i)
            _FinalSellPrice := _lup
            _FinalOpenPrice := _lup
    [_FinalBuyPrice,_FinalSellPrice,_FinalOpenPrice]

[_FinalBuyPrice,_FinalSellPrice,_FinalOpenPrice] = fFinalOpenPrice()
FinalBuyPrice := _FinalBuyPrice, FinalSellPrice := _FinalSellPrice, FinalOpenPrice := _FinalOpenPrice

// β€”β€”β€”β€”β€” Average Price & Backtest
for _i = 1 to 15
    if fBuyCondition(_i)
        nBuys           := nBuys + 1
        nSells          := na
        sumBuy          := FinalOpenPrice * BuyQuanTity + nz(sumBuy[1])
        sumQtyBuy       := BuyQuanTity + nz(sumQtyBuy[1])
        AveragePrice    := sumBuy / sumQtyBuy
        strategy.entry("BUY", strategy.long, qty = BuyQuanTity)
        
    if fSellCondition(_i)
        nBuys           := na
        nSells          := nSells + 1
        sumBuy          := na
        sumQtyBuy       := na
        strategy.close("BUY", qty = SellType != "% EQUITY" ? SellQuanTity : na, qty_percent = (SellType == "% EQUITY" ? SellQuanTity : na), comment = "SELL")

// β€”β€”β€”β€”β€” Origin from Rounded Pivot Points or last Sell                      
PPdownOrigin := (WOption == 'PRICE') ? 
     (fixnan(FinalSellPrice[1]) <= PP ? (floor(fixnan(FinalSellPrice[1]) / GridWidth) * GridWidth) - GridWidth : floor(PP / GridWidth) * GridWidth) :
     (fixnan(FinalSellPrice[1]) <= PP ? fixnan(FinalSellPrice[1]) - GridWidth : PP)

// β€”β€”β€”β€”β€” Origin from Rounded Average Buy Price
PPupOrigin := WOption == 'PRICE' ?
     ((ceil(fixnan(AveragePrice[1]) / GridWidth) * GridWidth) + GridWidth) :
     (fixnan(AveragePrice[1]) + GridWidth)
     
// β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” Plotting

// β€”β€”β€”β€”β€” Plotting Pivot Points
plot(PP, title  = "PP", style = plot.style_circles, color = color.aqua, linewidth = 2)

// β€”β€”β€”β€”β€” Plotting the average price
plot(nBuys > 1 ? AveragePrice[1] : na, title = "Average Price", style = plot.style_circles, color = color.fuchsia, linewidth = 2)

// β€”β€”β€”β€”β€” Buy Conditions                                                 β€”β€”β€”β€”β€” Sell Conditions
pb1  = fBuyCondition(1)  ? fGrid(PPdownOrigin, -GridWidth, 1)   : na,   ps1  = fSellCondition(1)  ? fGrid(PPupOrigin, GridWidth, 1)   : na
pb2  = fBuyCondition(2)  ? fGrid(PPdownOrigin, -GridWidth, 2)   : na,   ps2  = fSellCondition(2)  ? fGrid(PPupOrigin, GridWidth, 2)   : na
pb3  = fBuyCondition(3)  ? fGrid(PPdownOrigin, -GridWidth, 3)   : na,   ps3  = fSellCondition(3)  ? fGrid(PPupOrigin, GridWidth, 3)   : na
pb4  = fBuyCondition(4)  ? fGrid(PPdownOrigin, -GridWidth, 4)   : na,   ps4  = fSellCondition(4)  ? fGrid(PPupOrigin, GridWidth, 4)   : na
pb5  = fBuyCondition(5)  ? fGrid(PPdownOrigin, -GridWidth, 5)   : na,   ps5  = fSellCondition(5)  ? fGrid(PPupOrigin, GridWidth, 5)   : na
pb6  = fBuyCondition(6)  ? fGrid(PPdownOrigin, -GridWidth, 6)   : na,   ps6  = fSellCondition(6)  ? fGrid(PPupOrigin, GridWidth, 6)   : na
pb7  = fBuyCondition(7)  ? fGrid(PPdownOrigin, -GridWidth, 7)   : na,   ps7  = fSellCondition(7)  ? fGrid(PPupOrigin, GridWidth, 7)   : na
pb8  = fBuyCondition(8)  ? fGrid(PPdownOrigin, -GridWidth, 8)   : na,   ps8  = fSellCondition(8)  ? fGrid(PPupOrigin, GridWidth, 8)   : na
pb9  = fBuyCondition(9)  ? fGrid(PPdownOrigin, -GridWidth, 9)   : na,   ps9  = fSellCondition(9)  ? fGrid(PPupOrigin, GridWidth, 9)   : na
pb10 = fBuyCondition(10) ? fGrid(PPdownOrigin, -GridWidth, 10)  : na,   ps10 = fSellCondition(10) ? fGrid(PPupOrigin, GridWidth, 10)  : na
pb11 = fBuyCondition(11) ? fGrid(PPdownOrigin, -GridWidth, 11)  : na,   ps11 = fSellCondition(11) ? fGrid(PPupOrigin, GridWidth, 11)  : na
pb12 = fBuyCondition(12) ? fGrid(PPdownOrigin, -GridWidth, 12)  : na,   ps12 = fSellCondition(12) ? fGrid(PPupOrigin, GridWidth, 12)  : na
pb13 = fBuyCondition(13) ? fGrid(PPdownOrigin, -GridWidth, 13)  : na,   ps13 = fSellCondition(13) ? fGrid(PPupOrigin, GridWidth, 13)  : na
pb14 = fBuyCondition(14) ? fGrid(PPdownOrigin, -GridWidth, 14)  : na,   ps14 = fSellCondition(14) ? fGrid(PPupOrigin, GridWidth, 14)  : na
pb15 = fBuyCondition(15) ? fGrid(PPdownOrigin, -GridWidth, 15)  : na,   ps15 = fSellCondition(15) ? fGrid(PPupOrigin, GridWidth, 15)  : na

// β€”β€”β€”β€”β€” Buy Level Conditions
lb1  = low < fGrid(PPdownOrigin, -GridWidth, 1)   and PP > fGrid(PPdownOrigin, -GridWidth, 1)  ? fGrid(PPdownOrigin, -GridWidth, 1)   : na
lb2  = low < fGrid(PPdownOrigin, -GridWidth, 2)   and PP > fGrid(PPdownOrigin, -GridWidth, 2)  ? fGrid(PPdownOrigin, -GridWidth, 2)   : na
lb3  = low < fGrid(PPdownOrigin, -GridWidth, 3)   and PP > fGrid(PPdownOrigin, -GridWidth, 3)  ? fGrid(PPdownOrigin, -GridWidth, 3)   : na
lb4  = low < fGrid(PPdownOrigin, -GridWidth, 4)   and PP > fGrid(PPdownOrigin, -GridWidth, 4)  ? fGrid(PPdownOrigin, -GridWidth, 4)   : na
lb5  = low < fGrid(PPdownOrigin, -GridWidth, 5)   and PP > fGrid(PPdownOrigin, -GridWidth, 5)  ? fGrid(PPdownOrigin, -GridWidth, 5)   : na
lb6  = low < fGrid(PPdownOrigin, -GridWidth, 6)   and PP > fGrid(PPdownOrigin, -GridWidth, 6)  ? fGrid(PPdownOrigin, -GridWidth, 6)   : na
lb7  = low < fGrid(PPdownOrigin, -GridWidth, 7)   and PP > fGrid(PPdownOrigin, -GridWidth, 7)  ? fGrid(PPdownOrigin, -GridWidth, 7)   : na
lb8  = low < fGrid(PPdownOrigin, -GridWidth, 8)   and PP > fGrid(PPdownOrigin, -GridWidth, 8)  ? fGrid(PPdownOrigin, -GridWidth, 8)   : na
lb9  = low < fGrid(PPdownOrigin, -GridWidth, 9)   and PP > fGrid(PPdownOrigin, -GridWidth, 9)  ? fGrid(PPdownOrigin, -GridWidth, 9)   : na
lb10 = low < fGrid(PPdownOrigin, -GridWidth, 10)  and PP > fGrid(PPdownOrigin, -GridWidth, 10) ? fGrid(PPdownOrigin, -GridWidth, 10)  : na
lb11 = low < fGrid(PPdownOrigin, -GridWidth, 11)  and PP > fGrid(PPdownOrigin, -GridWidth, 11) ? fGrid(PPdownOrigin, -GridWidth, 11)  : na
lb12 = low < fGrid(PPdownOrigin, -GridWidth, 12)  and PP > fGrid(PPdownOrigin, -GridWidth, 12) ? fGrid(PPdownOrigin, -GridWidth, 12)  : na
lb13 = low < fGrid(PPdownOrigin, -GridWidth, 13)  and PP > fGrid(PPdownOrigin, -GridWidth, 13) ? fGrid(PPdownOrigin, -GridWidth, 13)  : na
lb14 = low < fGrid(PPdownOrigin, -GridWidth, 14)  and PP > fGrid(PPdownOrigin, -GridWidth, 14) ? fGrid(PPdownOrigin, -GridWidth, 14)  : na
lb15 = low < fGrid(PPdownOrigin, -GridWidth, 15)  and PP > fGrid(PPdownOrigin, -GridWidth, 15) ? fGrid(PPdownOrigin, -GridWidth, 15)  : na

// β€”β€”β€”β€”β€” Sell Level Conditions
ls1  = high > fGrid(PPupOrigin, GridWidth, 1)   and PP < fGrid(PPupOrigin, GridWidth, 1)  ? fGrid(PPupOrigin, GridWidth, 1)   : na
ls2  = high > fGrid(PPupOrigin, GridWidth, 2)   and PP < fGrid(PPupOrigin, GridWidth, 2)  ? fGrid(PPupOrigin, GridWidth, 2)   : na
ls3  = high > fGrid(PPupOrigin, GridWidth, 3)   and PP < fGrid(PPupOrigin, GridWidth, 3)  ? fGrid(PPupOrigin, GridWidth, 3)   : na
ls4  = high > fGrid(PPupOrigin, GridWidth, 4)   and PP < fGrid(PPupOrigin, GridWidth, 4)  ? fGrid(PPupOrigin, GridWidth, 4)   : na
ls5  = high > fGrid(PPupOrigin, GridWidth, 5)   and PP < fGrid(PPupOrigin, GridWidth, 5)  ? fGrid(PPupOrigin, GridWidth, 5)   : na
ls6  = high > fGrid(PPupOrigin, GridWidth, 6)   and PP < fGrid(PPupOrigin, GridWidth, 6)  ? fGrid(PPupOrigin, GridWidth, 6)   : na
ls7  = high > fGrid(PPupOrigin, GridWidth, 7)   and PP < fGrid(PPupOrigin, GridWidth, 7)  ? fGrid(PPupOrigin, GridWidth, 7)   : na
ls8  = high > fGrid(PPupOrigin, GridWidth, 8)   and PP < fGrid(PPupOrigin, GridWidth, 8)  ? fGrid(PPupOrigin, GridWidth, 8)   : na
ls9  = high > fGrid(PPupOrigin, GridWidth, 9)   and PP < fGrid(PPupOrigin, GridWidth, 9)  ? fGrid(PPupOrigin, GridWidth, 9)   : na
ls10 = high > fGrid(PPupOrigin, GridWidth, 10)  and PP < fGrid(PPupOrigin, GridWidth, 10) ? fGrid(PPupOrigin, GridWidth, 10)  : na
ls11 = high > fGrid(PPupOrigin, GridWidth, 11)  and PP < fGrid(PPupOrigin, GridWidth, 11) ? fGrid(PPupOrigin, GridWidth, 11)  : na
ls12 = high > fGrid(PPupOrigin, GridWidth, 12)  and PP < fGrid(PPupOrigin, GridWidth, 12) ? fGrid(PPupOrigin, GridWidth, 12)  : na
ls13 = high > fGrid(PPupOrigin, GridWidth, 13)  and PP < fGrid(PPupOrigin, GridWidth, 13) ? fGrid(PPupOrigin, GridWidth, 13)  : na
ls14 = high > fGrid(PPupOrigin, GridWidth, 14)  and PP < fGrid(PPupOrigin, GridWidth, 14) ? fGrid(PPupOrigin, GridWidth, 14)  : na
ls15 = high > fGrid(PPupOrigin, GridWidth, 15)  and PP < fGrid(PPupOrigin, GridWidth, 15) ? fGrid(PPupOrigin, GridWidth, 15)  : na

// β€”β€”β€”β€”β€” Buy Shapes
plotshape(pb1,  title = "Buy 1",  style = shape.diamond, location = location.absolute, color = color.lime, text = "1",  size = size.tiny)
plotshape(pb2,  title = "Buy 2",  style = shape.diamond, location = location.absolute, color = color.lime, text = "2",  size = size.tiny)
plotshape(pb3,  title = "Buy 3",  style = shape.diamond, location = location.absolute, color = color.lime, text = "3",  size = size.tiny)
plotshape(pb4,  title = "Buy 4",  style = shape.diamond, location = location.absolute, color = color.lime, text = "4",  size = size.tiny)
plotshape(pb5,  title = "Buy 5",  style = shape.diamond, location = location.absolute, color = color.lime, text = "5",  size = size.tiny)
plotshape(pb6,  title = "Buy 6",  style = shape.diamond, location = location.absolute, color = color.lime, text = "6",  size = size.tiny)
plotshape(pb7,  title = "Buy 7",  style = shape.diamond, location = location.absolute, color = color.lime, text = "7",  size = size.tiny)
plotshape(pb8,  title = "Buy 8",  style = shape.diamond, location = location.absolute, color = color.lime, text = "8",  size = size.tiny)
plotshape(pb9,  title = "Buy 9",  style = shape.diamond, location = location.absolute, color = color.lime, text = "9",  size = size.tiny)
plotshape(pb10, title = "Buy 10", style = shape.diamond, location = location.absolute, color = color.lime, text = "10", size = size.tiny)
plotshape(pb11, title = "Buy 11", style = shape.diamond, location = location.absolute, color = color.lime, text = "11", size = size.tiny)
plotshape(pb12, title = "Buy 12", style = shape.diamond, location = location.absolute, color = color.lime, text = "12", size = size.tiny)
plotshape(pb13, title = "Buy 13", style = shape.diamond, location = location.absolute, color = color.lime, text = "13", size = size.tiny)
plotshape(pb14, title = "Buy 14", style = shape.diamond, location = location.absolute, color = color.lime, text = "14", size = size.tiny)
plotshape(pb15, title = "Buy 15", style = shape.diamond, location = location.absolute, color = color.lime, text = "15", size = size.tiny)

// β€”β€”β€”β€”β€” Sell Shapes
plotshape(ps1,  title = "Sell 1",  style = shape.diamond, location = location.absolute, color = color.orange, text = "1",  size = size.tiny)
plotshape(ps2,  title = "Sell 2",  style = shape.diamond, location = location.absolute, color = color.orange, text = "2",  size = size.tiny)
plotshape(ps3,  title = "Sell 3",  style = shape.diamond, location = location.absolute, color = color.orange, text = "3",  size = size.tiny)
plotshape(ps4,  title = "Sell 4",  style = shape.diamond, location = location.absolute, color = color.orange, text = "4",  size = size.tiny)
plotshape(ps5,  title = "Sell 5",  style = shape.diamond, location = location.absolute, color = color.orange, text = "5",  size = size.tiny)
plotshape(ps6,  title = "Sell 6",  style = shape.diamond, location = location.absolute, color = color.orange, text = "6",  size = size.tiny)
plotshape(ps7,  title = "Sell 7",  style = shape.diamond, location = location.absolute, color = color.orange, text = "7",  size = size.tiny)
plotshape(ps8,  title = "Sell 8",  style = shape.diamond, location = location.absolute, color = color.orange, text = "8",  size = size.tiny)
plotshape(ps9,  title = "Sell 9",  style = shape.diamond, location = location.absolute, color = color.orange, text = "9",  size = size.tiny)
plotshape(ps10, title = "Sell 10", style = shape.diamond, location = location.absolute, color = color.orange, text = "10", size = size.tiny)
plotshape(ps11, title = "Sell 11", style = shape.diamond, location = location.absolute, color = color.orange, text = "11", size = size.tiny)
plotshape(ps12, title = "Sell 12", style = shape.diamond, location = location.absolute, color = color.orange, text = "12", size = size.tiny)
plotshape(ps13, title = "Sell 13", style = shape.diamond, location = location.absolute, color = color.orange, text = "13", size = size.tiny)
plotshape(ps14, title = "Sell 14", style = shape.diamond, location = location.absolute, color = color.orange, text = "14", size = size.tiny)
plotshape(ps15, title = "Sell 15", style = shape.diamond, location = location.absolute, color = color.orange, text = "15", size = size.tiny)

// β€”β€”β€”β€”β€” Plotting Lines under PP                                                        // β€”β€”β€”β€”β€” Plotting Lines above PP
plot(lb1,  title = "Level down 1",  style = plot.style_circles, color = color.green),   plot(ls1,  title = "Level up 1",  style = plot.style_circles, color = color.red)
plot(lb2,  title = "Level down 2",  style = plot.style_circles, color = color.green),   plot(ls2,  title = "Level up 2",  style = plot.style_circles, color = color.red)
plot(lb3,  title = "Level down 3",  style = plot.style_circles, color = color.green),   plot(ls3,  title = "Level up 3",  style = plot.style_circles, color = color.red)
plot(lb4,  title = "Level down 4",  style = plot.style_circles, color = color.green),   plot(ls4,  title = "Level up 4",  style = plot.style_circles, color = color.red)
plot(lb5,  title = "Level down 5",  style = plot.style_circles, color = color.green),   plot(ls5,  title = "Level up 5",  style = plot.style_circles, color = color.red)
plot(lb6,  title = "Level down 6",  style = plot.style_circles, color = color.green),   plot(ls6,  title = "Level up 6",  style = plot.style_circles, color = color.red)
plot(lb7,  title = "Level down 7",  style = plot.style_circles, color = color.green),   plot(ls7,  title = "Level up 7",  style = plot.style_circles, color = color.red)
plot(lb8,  title = "Level down 8",  style = plot.style_circles, color = color.green),   plot(ls8,  title = "Level up 8",  style = plot.style_circles, color = color.red)
plot(lb9,  title = "Level down 9",  style = plot.style_circles, color = color.green),   plot(ls9,  title = "Level up 9",  style = plot.style_circles, color = color.red)
plot(lb10, title = "Level down 10", style = plot.style_circles, color = color.green),   plot(ls10, title = "Level up 10", style = plot.style_circles, color = color.red)
plot(lb11, title = "Level down 11", style = plot.style_circles, color = color.green),   plot(ls11, title = "Level up 11", style = plot.style_circles, color = color.red)
plot(lb12, title = "Level down 12", style = plot.style_circles, color = color.green),   plot(ls12, title = "Level up 12", style = plot.style_circles, color = color.red)
plot(lb13, title = "Level down 13", style = plot.style_circles, color = color.green),   plot(ls13, title = "Level up 13", style = plot.style_circles, color = color.red)
plot(lb14, title = "Level down 14", style = plot.style_circles, color = color.green),   plot(ls14, title = "Level up 14", style = plot.style_circles, color = color.red)
plot(lb15, title = "Level down 15", style = plot.style_circles, color = color.green),   plot(ls15, title = "Level up 15", style = plot.style_circles, color = color.red)

// by XaviZπŸ’€

Lebih banyak