資源の読み込みに... 荷物...

複数の移動平均動向傾向戦略

作者: リン・ハーンチャオチャン開催日:2023年11月23日 15:40:15
タグ:

img

概要

マルチプルムービング・アベアダイナミック・トレンド戦略は,複数のタイプのムービング・アベア指標を使用して市場のトレンドを決定し,ストップ・ロスのポジションを動的に調整する定量的な取引戦略である.この戦略は,異なるムービング・アベアを組み合わせることで,市場のトレンドをより包括的かつ正確に判断し,高い勝ち率の取引を達成することができます.

戦略原則

この戦略は主に,シンプル・ムービング・アベア (SMA),指数的なムービング・アベア (EMA),重量化されたムービング・アベア (WMA),三角形のムービング・アベア (TMA),変数指数ダイナミック・アベア (VIDYA),ワイルダー・のムービング・アベア (WWMA),ゼロ・ラグ指数的なムービング・アベア (ZLEMA),真の強度指数 (TSI) などカスタム関数を通じて8種類の異なる移動平均を実装する.この戦略は,ユーザーが8つの移動平均のうちの1つを主要な指標として選択することを可能にします.

この戦略は,最初に選択した移動平均を計算し,設定した百分比パラメータに基づいて上下レールの位置を動的に計算する.価格が上下レールを突破すると購入信号が起動し,価格が下下下レールを突破すると販売信号が起動する.また,戦略は,移動平均と価格の間のクロスオーバーを補助判断信号として追跡する.

計算中に,戦略は市場トレンドの方向も判断し,それによって上下レールの位置を動的に調整する.特に,上昇傾向が決定されたとき,下下レールは上昇する価格に従って上昇するので,ストップ損失線が上昇する価格を最適に追跡することができる.下落傾向が決定されたとき,上下レールは減少する価格に従って下がり,ストップ損失点を削減し損失を最小限に抑える.

戦略 の 利点

  • 市場動向をより正確に判断するために 8つの移動平均指標を組み合わせた.
  • ストップ・ロスのポジションを動的に調整し,利益を最大限に抑え,ストップ・ロスの逆転を避ける.
  • 偽のブレイクによって引き起こされる間違った取引をフィルタリングする.移動平均値と価格クロスオーバーを補助信号として使用する.
  • 異なる市場環境に対応した パーマータをカスタマイズし最適化できます

リスク と 解決策

  • 戦略の複雑性とデバッグの難しさが多重な指標の組み合わせにより増加する.
  • 特定の市場環境では,特定のタイプの移動平均が劣る可能性があります.
  • 偽の脱出によって引き起こされる誤った取引に関連したリスクは依然として存在します

解決策:

  • コード読みやすさを改善し,検査やデバッグを容易にするためのコメントを出す.
  • 移動平均の種類を選択するか,市場状況に基づいて自動選択モジュールを組み込む.
  • パラメータ設定を最適化し 信号をフィルタリングする補助指標を追加します

オプティマイゼーションの方向性

この戦略を最適化するには まだ多くの余地があります

  • 変化する市場環境に基づいて自動パラメータ最適化モジュールを組み込む.
  • 傾向決定に役立つ機械学習モデルを組み込む.
  • 戦略の安定性を向上させるため センチメントインデックスのような 補助判断指標を追加します
  • ストップ・ロスのメカニズムを最適化し よりダイナミックで正確なストップを可能にします
  • 価格差をキャピタライズするために 多資産ペアを拡大する 戦略

結論

多動平均動向トレンド戦略は,複数の動向平均指標を組み合わせて市場動向を決定し,価格ブレイクシグナルに基づいて取引を開始し,効率的な収益性のためにストップ損失ラインポジションを動的に調整する.この戦略は,トレンドフォロー,価格ブレイクトレード,動向ストップの3つの主要な定量戦略コンセプトを成功裏に統合し,強い安定性と収益性を発揮する.パラメータ最適化とパターン認識のさらなる改善により,この戦略は継続的なパフォーマンス向上の可能性が高く,集中研究と適用に値する非常に価値のある高度な定量戦略となっています.


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

//@version=4
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © KivancOzbilgic

//created by: @Anil_Ozeksi
//developer: ANIL ÖZEKŞİ
//author: @kivancozbilgic

strategy("Optimized Trend Tracker","OTTEx", overlay=true)
src = input(close, title="Source")
length=input(2, "OTT Period", minval=1)
percent=input(1.4, "OTT Percent", type=input.float, step=0.1, minval=0)
showsupport = input(title="Show Support Line?", type=input.bool, defval=true)
showsignalsk = input(title="Show Support Line Crossing Signals?", type=input.bool, defval=true)
showsignalsc = input(title="Show Price/OTT Crossing Signals?", type=input.bool, defval=false)
highlight = input(title="Show OTT Color Changes?", type=input.bool, defval=false)
showsignalsr = input(title="Show OTT Color Change Signals?", type=input.bool, defval=false)
highlighting = input(title="Highlighter On/Off ?", type=input.bool, defval=true)
mav = input(title="Moving Average Type", defval="VAR", options=["SMA", "EMA", "WMA", "TMA", "VAR", "WWMA", "ZLEMA", "TSF"])
Var_Func(src,length)=>
    valpha=2/(length+1)
    vud1=src>src[1] ? src-src[1] : 0
    vdd1=src<src[1] ? src[1]-src : 0
    vUD=sum(vud1,9)
    vDD=sum(vdd1,9)
    vCMO=nz((vUD-vDD)/(vUD+vDD))
    VAR=0.0
    VAR:=nz(valpha*abs(vCMO)*src)+(1-valpha*abs(vCMO))*nz(VAR[1])
VAR=Var_Func(src,length)
Wwma_Func(src,length)=>
    wwalpha = 1/ length
    WWMA = 0.0
    WWMA := wwalpha*src + (1-wwalpha)*nz(WWMA[1])
WWMA=Wwma_Func(src,length)
Zlema_Func(src,length)=>
    zxLag = length/2==round(length/2) ? length/2 : (length - 1) / 2
    zxEMAData = (src + (src - src[zxLag]))
    ZLEMA = ema(zxEMAData, length)
ZLEMA=Zlema_Func(src,length)
Tsf_Func(src,length)=>
    lrc = linreg(src, length, 0)
    lrc1 = linreg(src,length,1)
    lrs = (lrc-lrc1)
    TSF = linreg(src, length, 0)+lrs
TSF=Tsf_Func(src,length)
getMA(src, length) =>
    ma = 0.0
    if mav == "SMA"
        ma := sma(src, length)
        ma

    if mav == "EMA"
        ma := ema(src, length)
        ma

    if mav == "WMA"
        ma := wma(src, length)
        ma

    if mav == "TMA"
        ma := sma(sma(src, ceil(length / 2)), floor(length / 2) + 1)
        ma

    if mav == "VAR"
        ma := VAR
        ma

    if mav == "WWMA"
        ma := WWMA
        ma

    if mav == "ZLEMA"
        ma := ZLEMA
        ma

    if mav == "TSF"
        ma := TSF
        ma
    ma
    
MAvg=getMA(src, length)
fark=MAvg*percent*0.01
longStop = MAvg - fark
longStopPrev = nz(longStop[1], longStop)
longStop := MAvg > longStopPrev ? max(longStop, longStopPrev) : longStop
shortStop =  MAvg + fark
shortStopPrev = nz(shortStop[1], shortStop)
shortStop := MAvg < shortStopPrev ? min(shortStop, shortStopPrev) : shortStop
dir = 1
dir := nz(dir[1], dir)
dir := dir == -1 and MAvg > shortStopPrev ? 1 : dir == 1 and MAvg < longStopPrev ? -1 : dir
MT = dir==1 ? longStop: shortStop
OTT=MAvg>MT ? MT*(200+percent)/200 : MT*(200-percent)/200 
plot(showsupport ? MAvg : na, color=#0585E1, linewidth=2, title="Support Line")
OTTC = highlight ? OTT[2] > OTT[3] ? color.green : color.red : #B800D9 
pALL=plot(nz(OTT[2]), color=OTTC, linewidth=2, title="OTT", transp=0)
alertcondition(cross(OTT[2], OTT[3]), title="Color ALARM", message="OTT Has Changed Color!")
alertcondition(crossover(OTT[2], OTT[3]), title="GREEN ALERT", message="OTT GREEN BUY SIGNAL!")
alertcondition(crossunder(OTT[2], OTT[3]), title="RED ALERT", message="OTT RED SELL SIGNAL!")
alertcondition(cross(MAvg, OTT[2]), title="Cross Alert", message="OTT - Support Line Crossing!")
alertcondition(crossover(MAvg, OTT[2]), title="Crossover Alarm", message="Support Line BUY SIGNAL!")
alertcondition(crossunder(MAvg, OTT[2]), title="Crossunder Alarm", message="Support Line SELL SIGNAL!")
alertcondition(cross(src, OTT[2]), title="Price Cross Alert", message="OTT - Price Crossing!")
alertcondition(crossover(src, OTT[2]), title="Price Crossover Alarm", message="PRICE OVER OTT - BUY SIGNAL!")
alertcondition(crossunder(src, OTT[2]), title="Price Crossunder Alarm", message="PRICE UNDER OTT - SELL SIGNAL!")
buySignalk = crossover(MAvg, OTT[2])
plotshape(buySignalk and showsignalsk ? OTT*0.995 : na, title="Buy", text="Buy", location=location.absolute, style=shape.labelup, size=size.tiny, color=color.green, textcolor=color.white, transp=0)
sellSignallk = crossunder(MAvg, OTT[2])
plotshape(sellSignallk and showsignalsk ? OTT*1.005 : na, title="Sell", text="Sell", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.white, transp=0)
buySignalc = crossover(src, OTT[2])
plotshape(buySignalc and showsignalsc ? OTT*0.995 : na, title="Buy", text="Buy", location=location.absolute, style=shape.labelup, size=size.tiny, color=color.green, textcolor=color.white, transp=0)
sellSignallc = crossunder(src, OTT[2])
plotshape(sellSignallc and showsignalsc ? OTT*1.005 : na, title="Sell", text="Sell", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.white, transp=0)
mPlot = plot(ohlc4, title="", style=plot.style_circles, linewidth=0,display=display.none)
longFillColor = highlighting ? (MAvg>OTT ? color.green : na) : na
shortFillColor = highlighting ? (MAvg<OTT ? color.red : na) : na
fill(mPlot, pALL, title="UpTrend Highligter", color=longFillColor)
fill(mPlot, pALL, title="DownTrend Highligter", color=shortFillColor)
buySignalr = crossover(OTT[2], OTT[3])
plotshape(buySignalr and showsignalsr ? OTT*0.995 : na, title="Buy", text="Buy", location=location.absolute, style=shape.labelup, size=size.tiny, color=color.green, textcolor=color.white, transp=0)
sellSignallr = crossunder(OTT[2], OTT[3])
plotshape(sellSignallr and showsignalsr ? OTT*1.005 : na, title="Sell", text="Sell", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.white, transp=0)
showscr = input(true, title="Show Screener Label")
posX_scr = input(20, title="Pos. Label x-axis")
posY_scr = input(1, title="Pos. Size Label y-axis")
colinput = input(title="Label Color", defval="Blue", options=["White", "Black", "Red", "Green", "Yellow", "Blue"])
col = color.gray
if colinput=="White"
    col:=color.white
if colinput=="Black"
    col:=color.black
if colinput=="Red"
    col:=color.red
if colinput=="Green"
    col:=color.green
if colinput=="Yellow"
    col:=color.yellow
if colinput=="Blue"
    col:=color.blue
dummy0 = input(true, title = "=Backtest Inputs=")
FromDay    = input(defval = 1, title = "From Day", minval = 1, maxval = 31)
FromMonth  = input(defval = 1, title = "From Month", minval = 1, maxval = 12)
FromYear   = input(defval = 2005, title = "From Year", minval = 2005)
ToDay      = input(defval = 1, title = "To Day", minval = 1, maxval = 31)
ToMonth    = input(defval = 1, title = "To Month", minval = 1, maxval = 12)
ToYear     = input(defval = 9999, title = "To Year", minval = 2006)
Start     = timestamp(FromYear, FromMonth, FromDay, 00, 00)
Finish    = timestamp(ToYear, ToMonth, ToDay, 23, 59)
Timerange() => true
if buySignalk
    strategy.entry("Long", strategy.long,when=Timerange())
if sellSignallk
    strategy.entry("Short", strategy.short,when=Timerange())
// t1=input('EURUSD',   title='Symbol 01',type=input.symbol)
// t2=input('XAUUSD',    title='Symbol 02',type=input.symbol)
// t3=input('AMZN',    title='Symbol 03',type=input.symbol)
// t4=input('TSLA',    title='Symbol 04',type=input.symbol)
// t5=input('BTCUSDT',    title='Symbol 05',type=input.symbol)
// t6=input('ETHBTC',    title='Symbol 06',type=input.symbol)
// t7=input('XBTUSD',    title='Symbol 07',type=input.symbol)
// t8=input('XRPBTC',    title='Symbol 08',type=input.symbol)
// t9=input('THYAO',   title='Symbol 09',type=input.symbol)
// t10=input('GARAN',    title='Symbol 10',type=input.symbol)
// t11=input('',      title='Symbol 11',type=input.symbol)
// t12=input('',      title='Symbol 12',type=input.symbol)
// t13=input('',      title='Symbol 13',type=input.symbol)
// t14=input('',      title='Symbol 14',type=input.symbol)
// t15=input('',      title='Symbol 15',type=input.symbol)
// t16=input('',     title='Symbol 16',type=input.symbol)
// t17=input('',    title='Symbol 17',type=input.symbol)
// t18=input('',    title='Symbol 18',type=input.symbol)
// t19=input('',    title='Symbol 19',type=input.symbol)
// t20=input('',    title='Symbol 20',type=input.symbol)
// OTTs(percent, length) =>
//     Up=MAvg-MAvg*percent*0.01
//     Dn=MAvg+MAvg*percent*0.01
    
//     TrendUp = 0.0
//     TrendUp := MAvg[1]>TrendUp[1] ? max(Up,TrendUp[1]) : Up
//     TrendDown = 0.0
//     TrendDown := MAvg[1]<TrendDown[1]? min(Dn,TrendDown[1]) : Dn
//     Trend = 0.0
//     Trend := MAvg > TrendDown[1] ? 1: MAvg< TrendUp[1]? -1: nz(Trend[1],1)
//     Tsl = Trend==1? TrendUp: TrendDown
    
//     S_Buy = Trend == 1 ? 1 : 0
//     S_Sell = Trend != 1 ? 1 : 0
    
//     [Trend, Tsl]
// [Trend, Tsl] =  OTTs(percent, length)
// TrendReversal = Trend != Trend[1]
// [t01, s01] = security(t1, timeframe.period, OTTs(percent, length))
// [t02, s02] = security(t2, timeframe.period, OTTs(percent, length))
// [t03, s03] = security(t3, timeframe.period, OTTs(percent, length))
// [t04, s04] = security(t4, timeframe.period, OTTs(percent, length))
// [t05, s05] = security(t5, timeframe.period, OTTs(percent, length))
// [t06, s06] = security(t6, timeframe.period, OTTs(percent, length))
// [t07, s07] = security(t7, timeframe.period, OTTs(percent, length))
// [t08, s08] = security(t8, timeframe.period, OTTs(percent, length))
// [t09, s09] = security(t9, timeframe.period, OTTs(percent, length))
// [t010, s010] = security(t10, timeframe.period, OTTs(percent, length))
// [t011, s011] = security(t11, timeframe.period, OTTs(percent, length))
// [t012, s012] = security(t12, timeframe.period, OTTs(percent, length))
// [t013, s013] = security(t13, timeframe.period, OTTs(percent, length))
// [t014, s014] = security(t14, timeframe.period, OTTs(percent, length))
// [t015, s015] = security(t15, timeframe.period, OTTs(percent, length))
// [t016, s016] = security(t16, timeframe.period, OTTs(percent, length))
// [t017, s017] = security(t17, timeframe.period, OTTs(percent, length))
// [t018, s018] = security(t18, timeframe.period, OTTs(percent, length))
// [t019, s019] = security(t19, timeframe.period, OTTs(percent, length))
// [t020, s020] = security(t20, timeframe.period, OTTs(percent, length))
// tr01 = t01 != t01[1], up01 = t01 == 1, dn01 = t01 == -1
// tr02 = t02 != t02[1], up02 = t02 == 1, dn02 = t02 == -1
// tr03 = t03 != t03[1], up03 = t03 == 1, dn03 = t03 == -1
// tr04 = t04 != t04[1], up04 = t04 == 1, dn04 = t04 == -1
// tr05 = t05 != t05[1], up05 = t05 == 1, dn05 = t05 == -1
// tr06 = t06 != t06[1], up06 = t06 == 1, dn06 = t06 == -1
// tr07 = t07 != t07[1], up07 = t07 == 1, dn07 = t07 == -1
// tr08 = t08 != t08[1], up08 = t08 == 1, dn08 = t08 == -1
// tr09 = t09 != t09[1], up09 = t09 == 1, dn09 = t09 == -1
// tr010 = t010 != t010[1], up010 = t010 == 1, dn010 = t010 == -1
// tr011 = t011 != t011[1], up011 = t011 == 1, dn011 = t011 == -1
// tr012 = t012 != t012[1], up012 = t012 == 1, dn012 = t012 == -1
// tr013 = t013 != t013[1], up013 = t013 == 1, dn013 = t013 == -1
// tr014 = t014 != t014[1], up014 = t014 == 1, dn014 = t014 == -1
// tr015 = t015 != t015[1], up015 = t015 == 1, dn015 = t015 == -1
// tr016 = t016 != t016[1], up016 = t016 == 1, dn016 = t016 == -1
// tr017 = t017 != t017[1], up017 = t017 == 1, dn017 = t017 == -1
// tr018 = t018 != t018[1], up018 = t018 == 1, dn018 = t018 == -1
// tr019 = t019 != t019[1], up019 = t019 == 1, dn019 = t019 == -1
// tr020 = t020 != t020[1], up020 = t020 == 1, dn020 = t020 == -1
// pot_label = 'Potential Reversal: \n'
// pot_label := tr01    ? pot_label + t1 + '\n'  : pot_label
// pot_label := tr02    ? pot_label + t2 + '\n'  : pot_label
// pot_label := tr03    ? pot_label + t3 + '\n'  : pot_label
// pot_label := tr04    ? pot_label + t4 + '\n'  : pot_label
// pot_label := tr05    ? pot_label + t5 + '\n'  : pot_label
// pot_label := tr06    ? pot_label + t6 + '\n'  : pot_label
// pot_label := tr07    ? pot_label + t7 + '\n'  : pot_label
// pot_label := tr08    ? pot_label + t8 + '\n'  : pot_label
// pot_label := tr09    ? pot_label + t9 + '\n'  : pot_label
// pot_label := tr010    ? pot_label + t10 + '\n'  : pot_label
// pot_label := tr011    ? pot_label + t11 + '\n'  : pot_label
// pot_label := tr012    ? pot_label + t12 + '\n'  : pot_label
// pot_label := tr013    ? pot_label + t13 + '\n'  : pot_label
// pot_label := tr014    ? pot_label + t14 + '\n'  : pot_label
// pot_label := tr015    ? pot_label + t15 + '\n'  : pot_label
// pot_label := tr016    ? pot_label + t16 + '\n'  : pot_label
// pot_label := tr017    ? pot_label + t17 + '\n'  : pot_label
// pot_label := tr018    ? pot_label + t18 + '\n'  : pot_label
// pot_label := tr019    ? pot_label + t19 + '\n'  : pot_label
// pot_label := tr020    ? pot_label + t20 + '\n'  : pot_label
// scr_label = 'Confirmed Reversal: \n'
// scr_label := tr01[1] ? scr_label + t1 + '\n'  : scr_label
// scr_label := tr02[1] ? scr_label + t2 + '\n'  : scr_label
// scr_label := tr03[1] ? scr_label + t3 + '\n'  : scr_label
// scr_label := tr04[1] ? scr_label + t4 + '\n'  : scr_label
// scr_label := tr05[1] ? scr_label + t5 + '\n'  : scr_label
// scr_label := tr06[1] ? scr_label + t6 + '\n'  : scr_label
// scr_label := tr07[1] ? scr_label + t7 + '\n'  : scr_label
// scr_label := tr08[1] ? scr_label + t8 + '\n'  : scr_label
// scr_label := tr09[1] ? scr_label + t9 + '\n'  : scr_label
// scr_label := tr010[1] ? scr_label + t10 + '\n'  : scr_label
// scr_label := tr011[1] ? scr_label + t11 + '\n'  : scr_label
// scr_label := tr012[1] ? scr_label + t12 + '\n'  : scr_label
// scr_label := tr013[1] ? scr_label + t13 + '\n'  : scr_label
// scr_label := tr014[1] ? scr_label + t14 + '\n'  : scr_label
// scr_label := tr015[1] ? scr_label + t15 + '\n'  : scr_label
// scr_label := tr016[1] ? scr_label + t16 + '\n'  : scr_label
// scr_label := tr017[1] ? scr_label + t17 + '\n'  : scr_label
// scr_label := tr018[1] ? scr_label + t18 + '\n'  : scr_label
// scr_label := tr019[1] ? scr_label + t19 + '\n'  : scr_label
// scr_label := tr020[1] ? scr_label + t20 + '\n'  : scr_label
// up_label = 'Uptrend: \n'
// up_label := up01[1] ? up_label + t1 + '\n'  : up_label
// up_label := up02[1] ? up_label + t2 + '\n'  : up_label
// up_label := up03[1] ? up_label + t3 + '\n'  : up_label
// up_label := up04[1] ? up_label + t4 + '\n'  : up_label
// up_label := up05[1] ? up_label + t5 + '\n'  : up_label
// up_label := up06[1] ? up_label + t6 + '\n'  : up_label
// up_label := up07[1] ? up_label + t7 + '\n'  : up_label
// up_label := up08[1] ? up_label + t8 + '\n'  : up_label
// up_label := up09[1] ? up_label + t9 + '\n'  : up_label
// up_label := up010[1] ? up_label + t10 + '\n'  : up_label
// up_label := up011[1] ? up_label + t11 + '\n'  : up_label
// up_label := up012[1] ? up_label + t12 + '\n'  : up_label
// up_label := up013[1] ? up_label + t13 + '\n'  : up_label
// up_label := up014[1] ? up_label + t14 + '\n'  : up_label
// up_label := up015[1] ? up_label + t15 + '\n'  : up_label
// up_label := up016[1] ? up_label + t16 + '\n'  : up_label
// up_label := up017[1] ? up_label + t17 + '\n'  : up_label
// up_label := up018[1] ? up_label + t18 + '\n'  : up_label
// up_label := up019[1] ? up_label + t19 + '\n'  : up_label
// up_label := up020[1] ? up_label + t20 + '\n'  : up_label
// dn_label = 'Downtrend: \n'
// dn_label := dn01[1] ? dn_label + t1 + '\n'  : dn_label
// dn_label := dn02[1] ? dn_label + t2 + '\n'  : dn_label
// dn_label := dn03[1] ? dn_label + t3 + '\n'  : dn_label
// dn_label := dn04[1] ? dn_label + t4 + '\n'  : dn_label
// dn_label := dn05[1] ? dn_label + t5 + '\n'  : dn_label
// dn_label := dn06[1] ? dn_label + t6 + '\n'  : dn_label
// dn_label := dn07[1] ? dn_label + t7 + '\n'  : dn_label
// dn_label := dn08[1] ? dn_label + t8 + '\n'  : dn_label
// dn_label := dn09[1] ? dn_label + t9 + '\n'  : dn_label
// dn_label := dn010[1] ? dn_label + t10 + '\n'  : dn_label
// dn_label := dn011[1] ? dn_label + t11 + '\n'  : dn_label
// dn_label := dn012[1] ? dn_label + t12 + '\n'  : dn_label
// dn_label := dn013[1] ? dn_label + t13 + '\n'  : dn_label
// dn_label := dn014[1] ? dn_label + t14 + '\n'  : dn_label
// dn_label := dn015[1] ? dn_label + t15 + '\n'  : dn_label
// dn_label := dn016[1] ? dn_label + t16 + '\n'  : dn_label
// dn_label := dn017[1] ? dn_label + t17 + '\n'  : dn_label
// dn_label := dn018[1] ? dn_label + t18 + '\n'  : dn_label
// dn_label := dn019[1] ? dn_label + t19 + '\n'  : dn_label
// dn_label := dn020[1] ? dn_label + t20 + '\n'  : dn_label
// f_colorscr (_valscr ) => 
//      _valscr  ? #00000000 : na
     
// f_printscr (_txtscr ) => 
//      var _lblscr  = label(na), 
//      label.delete(_lblscr ), 
//      _lblscr  := label.new(
//      time + (time-time[1])*posX_scr , 
//      ohlc4[posY_scr], 
//      _txtscr ,
//      xloc.bar_time, 
//      yloc.price, 
//      f_colorscr (  showscr ),
//      textcolor =  showscr ? col : na, 
//      size = size.normal, 
//      style=label.style_label_center
//      )
// f_printscr ( scr_label + '\n' + pot_label +'\n' + up_label + '\n' + dn_label)
  


もっと