동적 네트워크 거래 관리 전략

저자:차오장, 날짜: 2023-12-04 15:43:44
태그:

img

전반적인 설명

동적 그리드 거래 관리 전략 (Dynamic Grid Trading Management Strategy) 은 시장 변동에 기반한 거래 접근법이다. 시장 변동성을 활용하여 포트폴리오를 최적화하기 위해 다른 가격 수준에서 구매 및 판매 지점을 설정한다. 이 전략은 다양한 시장 조건에 적응할 수 있으며, 특히 장기 보유, 스팟 거래 및 레버리지없는 스윙 거래에 적합하다.

전략의 원칙

동적 그리드 거래 관리 전략의 본질은 그리드 수준을 결정하기 위해 시간 기간에 기반한 중추점을 사용하는 것입니다. 그것은 여러 구매 및 판매 포인트를 설정하고, 시장 가격이 떨어지면 구입하고, 상승하면 판매합니다. 시장 부진 중 지속적인 구매는 평균 인수 비용을 낮춰줍니다. 시장 가격이 평균 구매 가격을 초과하면 전략은 판매를 시작하고, 가격이 계속 상승하면 계속 판매하여 수익을 창출합니다.

전략 의 장점

  1. **응용

시장 변동**: 이 전략은 시장 변동에 효과적으로 적응하며, 황소 시장과 곰 시장 모두에 적용됩니다. 2.리스크 다양화: 다른 가격 수준에서의 거래는 하나의 가격점에 구매 또는 판매의 위험을 다양화합니다. 3.장기적 이득: 장기 보유 전략에 적합하며 평균 비용 효과로 인해 시간이 지남에 따라 안정적인 수익을 창출 할 수 있습니다.

전략 의 위험

  1. 극단적 인 시장 행동: 급격한 변동이나 시장 붕괴와 같은 극한 시장 조건에서 전략은 상당한 위험에 직면 할 수 있습니다.
  2. 전략 최적화 필요성: 전략은 시장 조건에 따라 지속적인 조정과 최적화를 요구합니다.

최적화 위한 지침

  1. 매개 변수 조정: 시장 변화에 따라 네트워크 크기와 거래 빈도를 조정하면 다른 시장 변동성을 수용할 수 있습니다.
  2. 위험 관리: 극단적인 시장 조건에서 상당한 손실을 피하기 위해 손해를 막는 지점을 설정하는 것과 같은 더 세밀한 위험 관리 메커니즘을 도입합니다.

결론

동적 그리드 거래 관리 전략은 다양한 시장 환경에 적용 가능한 다재다능한 거래 접근법이다. 다른 가격 수준에서 거래함으로써 위험을 줄이고 장기적인 이익을 달성하는 것을 목표로합니다. 그러나 시장의 예측 불가능성으로 인해 전략은 시장 변화에 적응하기 위해 지속적인 조정 및 최적화를 필요로합니다. 전반적으로이 전략은 장기적이고 안정적인 수익을 추구하는 투자자에게 매력적인 옵션을 제공합니다.


/*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💤

더 많은