YouTubeの巨人『魔法のような双 EMA 均線戦略』

作者: リン・ハーン小さな夢, 作成日:2022年9月15日 15:56:22 更新日:2023年9月15日 20:50:38

img

YouTubeの巨人『魔法のような双 EMA 均線戦略』

この記事では,YouTubeから"魔法の双 EMA 均線戦略"について説明します. この戦略は,株式や仮想通貨の市場を殺すと呼ばれるものです. ビデオを見て,この戦略は2つのトレードビュー指標を用いたトレードビューのパイン言語戦略であることを学びました. ビデオの回転効果を見て,FMZはTrading ViewのPine言語もサポートしているので,自分の回転,テスト,分析をしたいと強く思いました.

戦略で使用する指標

エマ指標

簡単なデザインのために,ビデオで述べたような移動平均指数を使わない.代わりに,Trading Viewの内蔵ta.emaを使います (実際は同じです).

2 ウマンチュウ・スイング・フリー指標

これはTrading Viewの指標で,Trading Viewのソースコードをダウンロードする必要があります.

img

ヴァンマンチュ・スウィング・フリー コード:

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

// Credits to the original Script - Range Filter DonovanWall https://www.tradingview.com/script/lut7sBgG-Range-Filter-DW/
// This version is the old version of the Range Filter with less settings to tinker with

//@version=4
study(title="Range Filter - B&S Signals", shorttitle="RF - B&S Signals", overlay=true)

//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
//Functions
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------

//Range Size Function
rng_size(x, qty, n)=> 
//    AC       = Cond_EMA(abs(x - x[1]), 1, n)
    wper      = (n*2) - 1
    avrng     = ema(abs(x - x[1]), n)
    AC = ema(avrng, wper)*qty
    rng_size = AC

//Range Filter Function
rng_filt(x, rng_, n)=>
    r          = rng_
    var rfilt  = array.new_float(2, x)
    array.set(rfilt, 1, array.get(rfilt, 0))
    if x - r > array.get(rfilt, 1)
        array.set(rfilt, 0, x - r)
    if x + r < array.get(rfilt, 1)
        array.set(rfilt, 0, x + r)
    rng_filt1 = array.get(rfilt, 0)
    
    hi_band   = rng_filt1 + r
    lo_band   = rng_filt1 - r
    rng_filt  = rng_filt1
    [hi_band, lo_band, rng_filt]
 
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
//Inputs
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------

//Range Source
rng_src = input(defval=close, type=input.source, title="Swing Source")

//Range Period
rng_per = input(defval=20, minval=1, title="Swing Period")

//Range Size Inputs
rng_qty   = input(defval=3.5, minval=0.0000001, title="Swing Multiplier")

//Bar Colors
use_barcolor = input(defval=false, type=input.bool, title="Bar Colors On/Off")

//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
//Definitions
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------

//Range Filter Values
[h_band, l_band, filt] = rng_filt(rng_src, rng_size(rng_src, rng_qty, rng_per), rng_per)

//Direction Conditions
var fdir = 0.0
fdir    := filt > filt[1] ? 1 : filt < filt[1] ? -1 : fdir
upward   = fdir==1 ? 1 : 0
downward = fdir==-1 ? 1 : 0

//Trading Condition
longCond = rng_src > filt and rng_src > rng_src[1] and upward > 0 or rng_src > filt and rng_src < rng_src[1] and upward > 0 
shortCond = rng_src < filt and rng_src < rng_src[1] and downward > 0 or rng_src < filt and rng_src > rng_src[1] and downward > 0

CondIni = 0
CondIni := longCond ? 1 : shortCond ? -1 : CondIni[1]
longCondition = longCond and CondIni[1] == -1
shortCondition = shortCond and CondIni[1] == 1

//Colors
filt_color = upward ? #05ff9b : downward ? #ff0583 : #cccccc
bar_color  = upward and (rng_src > filt) ? (rng_src > rng_src[1] ? #05ff9b : #00b36b) :
             downward and (rng_src < filt) ? (rng_src < rng_src[1] ? #ff0583 : #b8005d) : #cccccc

//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
//Outputs
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------

//Filter Plot
filt_plot = plot(filt, color=filt_color, transp=67, linewidth=3, title="Filter")

//Band Plots
h_band_plot = plot(h_band, color=color.new(#05ff9b, 100), title="High Band")
l_band_plot = plot(l_band, color=color.new(#ff0583, 100), title="Low Band")

//Band Fills
fill(h_band_plot, filt_plot, color=color.new(#00b36b, 92), title="High Band Fill")
fill(l_band_plot, filt_plot, color=color.new(#b8005d, 92), title="Low Band Fill")

//Bar Color
barcolor(use_barcolor ? bar_color : na)

//Plot Buy and Sell Labels
plotshape(longCondition, title = "Buy Signal", text ="BUY", textcolor = color.white, style=shape.labelup, size = size.normal, location=location.belowbar, color = color.new(color.green, 0))
plotshape(shortCondition, title = "Sell Signal", text ="SELL", textcolor = color.white, style=shape.labeldown, size = size.normal, location=location.abovebar, color = color.new(color.red, 0))

//Alerts
alertcondition(longCondition, title="Buy Alert", message = "BUY")
alertcondition(shortCondition, title="Sell Alert", message = "SELL")

戦略的論理

EMA指標:戦略は2つのEMA均線,速線 (小周期パラメータ),慢線 (大周期パラメータ) を使用する.双 EMA均線の役割は主に市場の傾向の方向を判断するのに役立ちます.

  • 多頭列 速線は遅線の上にあります.

  • 空っぽの列 速行線は遅行線の下にある.

VuManChu Swing Free インディケーター:VuManChu Swing Free インディケーターは,信号を発信し,その後,他の条件と組み合わせて,下注の取引を行うかどうかを判断するために使用されます. VuManChu Swing Free インディケーターのソースコードから,longCondition 変数は購入信号,shortCondition 変数は販売信号を表します.後続の下注条件は両変数を使用します.

戦略的な取引シグナル誘発条件については,以下のように説明します.

1 複数入場する規則: 陽線Kの閉じる価格は,EMAの快線上にある. 2つの平均EMAは,多頭配列 (快線は,スローライン上にある) を表示し,VuManChu Swing Freeは,買い信号 (longCondition true) を表示します. 3つの条件が成立します.このK線は,複数の入口を行う鍵K線であり,このK線の閉じる価格は,入口です.

2、空白に入れるためのルール (複数入りの反対): 陰K線の閉じる価格は,EMA快線以下で,2つの平均EMAが空頭列を呈し (快線がスローラインの下),VuManChu Swing Freeが売り信号を呈し (short Condition true) なければならない.三つの条件が満たされ,このK線の閉じる価格は空きエントリー位置である.

取引の論理は非常に単純ではない. 出所したビデオには,停止停止停止の詳細な説明がないため,小編はここで比較中間の停止停止停止停止停止停止停止停止方法を使用する自由を行います. 固定点数停止停止停止,停止停止停止を追跡します.

コードデザイン

ウォーマンチュウ・スウィング・フリー指標のコードは,我々が直接,原稿をそのまま,我々の戦略コードに組み込む.

img

取引の機能を実現するために,Pine言語のコードを書き,

// extend
fastEmaPeriod = input(50, "fastEmaPeriod")         // 快线周期
slowEmaPeriod = input(200, "slowEmaPeriod")        // 慢线周期
loss = input(30, "loss")                           // 止损点数
trailPoints = input(30, "trailPoints")             // 移动止盈触发点数
trailOffset = input(30, "trailOffset")             // 移动止盈偏移量(点数)
amount = input(1, "amount")                        // 下单量

emaFast = ta.ema(close, fastEmaPeriod)             // 计算快线EMA
emaSlow = ta.ema(close, slowEmaPeriod)             // 计算慢线EMA

buyCondition = longCondition and emaFast > emaSlow and close > open and close > emaFast         // 做多入场条件
sellCondition = shortCondition and emaFast < emaSlow and close < open and close < emaFast       // 做空入场条件

if buyCondition and strategy.position_size == 0
    strategy.entry("long", strategy.long, amount)
    strategy.exit("exit_long", "long", amount, loss=loss, trail_points=trailPoints, trail_offset=trailOffset)
if sellCondition and strategy.position_size == 0
    strategy.entry("short", strategy.short, amount)
    strategy.exit("exit_short", "short", amount, loss=loss, trail_points=trailPoints, trail_offset=trailOffset)

A.可以看到,当buyCondition为真时即:

1,longCondition変数が真である (VuManChu Swing Free指標がより多くの信号を発している). 2、emaFast > emaSlow (EMAを複数表示する) ー 3、close > open (現在のBARを日線に表示) ・close > emaFast (閉じる価格をEMAの快線上に表示) ・

更に3つの条件が満たされます.

B.当sellCondition为真时,则做空的三个条件成立(这里不再赘述)。

次に,if条件判断信号が起動した場合に,strategy.entry関数で入場し,strategy.exit関数でストップ損失,追跡停止を設定します.

完全なコード

/*backtest
start: 2022-01-01 00:00:00
end: 2022-10-08 00:00:00
period: 15m
basePeriod: 5m
exchanges: [{"eid":"Futures_Binance","currency":"ETH_USDT"}]
args: [["ZPrecision",0,358374]]
*/

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

// Credits to the original Script - Range Filter DonovanWall https://www.tradingview.com/script/lut7sBgG-Range-Filter-DW/
// This version is the old version of the Range Filter with less settings to tinker with

//@version=4
study(title="Range Filter - B&S Signals", shorttitle="RF - B&S Signals", overlay=true)

//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
//Functions
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------

//Range Size Function
rng_size(x, qty, n)=> 
//    AC       = Cond_EMA(abs(x - x[1]), 1, n)
    wper      = (n*2) - 1
    avrng     = ema(abs(x - x[1]), n)
    AC = ema(avrng, wper)*qty
    rng_size = AC

//Range Filter Function
rng_filt(x, rng_, n)=>
    r          = rng_
    var rfilt  = array.new_float(2, x)
    array.set(rfilt, 1, array.get(rfilt, 0))
    if x - r > array.get(rfilt, 1)
        array.set(rfilt, 0, x - r)
    if x + r < array.get(rfilt, 1)
        array.set(rfilt, 0, x + r)
    rng_filt1 = array.get(rfilt, 0)
    
    hi_band   = rng_filt1 + r
    lo_band   = rng_filt1 - r
    rng_filt  = rng_filt1
    [hi_band, lo_band, rng_filt]
 
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
//Inputs
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------

//Range Source
rng_src = input(defval=close, type=input.source, title="Swing Source")

//Range Period
rng_per = input(defval=20, minval=1, title="Swing Period")

//Range Size Inputs
rng_qty   = input(defval=3.5, minval=0.0000001, title="Swing Multiplier")

//Bar Colors
use_barcolor = input(defval=false, type=input.bool, title="Bar Colors On/Off")

//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
//Definitions
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------

//Range Filter Values
[h_band, l_band, filt] = rng_filt(rng_src, rng_size(rng_src, rng_qty, rng_per), rng_per)

//Direction Conditions
var fdir = 0.0
fdir    := filt > filt[1] ? 1 : filt < filt[1] ? -1 : fdir
upward   = fdir==1 ? 1 : 0
downward = fdir==-1 ? 1 : 0

//Trading Condition
longCond = rng_src > filt and rng_src > rng_src[1] and upward > 0 or rng_src > filt and rng_src < rng_src[1] and upward > 0 
shortCond = rng_src < filt and rng_src < rng_src[1] and downward > 0 or rng_src < filt and rng_src > rng_src[1] and downward > 0

CondIni = 0
CondIni := longCond ? 1 : shortCond ? -1 : CondIni[1]
longCondition = longCond and CondIni[1] == -1
shortCondition = shortCond and CondIni[1] == 1

//Colors
filt_color = upward ? #05ff9b : downward ? #ff0583 : #cccccc
bar_color  = upward and (rng_src > filt) ? (rng_src > rng_src[1] ? #05ff9b : #00b36b) :
             downward and (rng_src < filt) ? (rng_src < rng_src[1] ? #ff0583 : #b8005d) : #cccccc

//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
//Outputs
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------

//Filter Plot
filt_plot = plot(filt, color=filt_color, transp=67, linewidth=3, title="Filter")

//Band Plots
h_band_plot = plot(h_band, color=color.new(#05ff9b, 100), title="High Band")
l_band_plot = plot(l_band, color=color.new(#ff0583, 100), title="Low Band")

//Band Fills
fill(h_band_plot, filt_plot, color=color.new(#00b36b, 92), title="High Band Fill")
fill(l_band_plot, filt_plot, color=color.new(#b8005d, 92), title="Low Band Fill")

//Bar Color
barcolor(use_barcolor ? bar_color : na)

//Plot Buy and Sell Labels
plotshape(longCondition, title = "Buy Signal", text ="BUY", textcolor = color.white, style=shape.labelup, size = size.normal, location=location.belowbar, color = color.new(color.green, 0))
plotshape(shortCondition, title = "Sell Signal", text ="SELL", textcolor = color.white, style=shape.labeldown, size = size.normal, location=location.abovebar, color = color.new(color.red, 0))

//Alerts
alertcondition(longCondition, title="Buy Alert", message = "BUY")
alertcondition(shortCondition, title="Sell Alert", message = "SELL")


// extend
fastEmaPeriod = input(50, "fastEmaPeriod")
slowEmaPeriod = input(200, "slowEmaPeriod")
loss = input(30, "loss")
trailPoints = input(30, "trailPoints")
trailOffset = input(30, "trailOffset")
amount = input(1, "amount")

emaFast = ta.ema(close, fastEmaPeriod)
emaSlow = ta.ema(close, slowEmaPeriod)

buyCondition = longCondition and emaFast > emaSlow and close > open and close > emaFast
sellCondition = shortCondition and emaFast < emaSlow and close < open and close < emaFast

if buyCondition and strategy.position_size == 0
    strategy.entry("long", strategy.long, amount)
    strategy.exit("exit_long", "long", amount, loss=loss, trail_points=trailPoints, trail_offset=trailOffset)
if sellCondition and strategy.position_size == 0
    strategy.entry("short", strategy.short, amount)
    strategy.exit("exit_short", "short", amount, loss=loss, trail_points=trailPoints, trail_offset=trailOffset)

試行錯誤

復習テストの時間範囲は2022年1月から2022年10月まで選択され,K線サイクルは15分であり,閉盤価格モデルによる復習である.市場がBinanceのETH_USDT永続契約を選択する.パラメータ設定は,出場ビデオで述べたように,高速線50サイクル,スローライン200サイクル,その他のパラメータはデフォルトで変わらない.停止損失,追跡停止ピーク数,私は主観的に1ポイントを設定し,30ポイントを設定する.

img

img

復習結果 マママ虎虎 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復習結果 復

永久契約をBTC_USDTに交換してみましょう.

img

ツイッターでは,BTCの評価も爆発的に上がっています.

img

img

戦略アドレスは:https://www.fmz.com/strategy/385745

この取引方法は,傾向を掴むのに比較的信頼性があるように見えます. この考えに基づいて設計を最適化することができます. 本記事では,双等線戦略の考えだけでなく,石油管の戦略を処理,学習する方法も学びました.OK,上記の戦略コードは単に小編です.


関連性

もっと

ファンタダングこの戦略は参数にも当てはまるのでしょうか?

hyc1743ドラムダ,なぜアイコンに信号が表示され,実機には開封されていないのか? /upload/asset/23cc031609caa7a896da3.jpg /upload/asset/23cc031609caa7a896da3.jpg /upload/asset/23cc031609caa7a896da3.jpg /upload/asset/23cc031609caa7a896da3.jpg /upload/asset/23cc031609caa7a896da3.jpg /upload/asset/23cc031609caa7a896da3.jpg /upload/asset/23cc031609caa7a896da3.jpg /upload/asset /upload/asset/23cae1c5d5b26ec763ea6.jpg /upload/asset/23cae1c5d5b26ec763ea6.jpg /upload/asset/23cae1c5d5b26ec763ea6.jpg /upload/asset/23cae1c5d5b26ec763ea6 /upload/asset/23d49ff4aec3475793e5e.jpg /upload/asset/23d49ff4aec3475793e5e.jpg /upload/asset/23d49ff4aec3475793e5e.jpg /upload/asset/23d49ff4aec3475793e5e.jpg /upload/asset/23d49ff4aec3475793e5e.jpg /upload/asset/23d49ff4aec3475

軽い雲マンダは,油管から代表的な2つまたは3つを探し,より難易度,関数,パラメータ,処理方法の書き換えが多くなる戦略をいくつかの文字版のチュートリアルにすることをお勧めします. 例えば,line.deleteのような類似のチュートリアル......................................... この双均線戦略で,私は,非常に複雑な組み合わせの戦略をいくつか変更することを学びました. 12つの組み合わせの戦略を変更しました. そのうちの1つまたは2つは,21年22年のデータ復習の結果が非常に良いものです. 実行した実盤でテストしましたが,複雑な関数参数処理に遭遇しました. 例えばヒント:line: 62 Could not find function or function reference 'line.delete', しかしFMZ PINE Script 文書では,line.delete に関する説明は見つかりませんでした. ありがとうございました.

ハイゴ4月21日 (火) 10月21日 (日) BTCはかなり惨めだった

インジュン標準値30は,BTCが30ドル下がったことを意味します. 損失を停止します. 標準値30は,BTCが30ドル下がったことを意味します. 損失を停止します.

軽い雲マンダ,PINEでちょっと複雑な禁煙法を書けるの? レベルアップの禁煙法など? ありがとう. JSにPINEを組み込むことが可能なら,例えばPINEで指標を書いたり,JSで取引を書いたりすると便利です.

インジュンリアルディスクは2022年に失敗する

fmゼロ保存策は,この遊びを提示しています. REST: sql: no rows in result set 検索結果セットには行がない

fmゼロ夢は強暴だ

小さな夢ハーハ,トレンド戦略は,未来にトレンドがあるなら,動揺戦略をする.

小さな夢嫌なことをする.

hyc1743ありがとうございました.

小さな夢こんにちは.これは,グラフ上のBUYマークは,記事の指標のサインのみであり,その後に均線が加わっているからです. ` ` 売る 買える 売る 売る 売る plotshape ((longCondition, title = "Buy Signal", text ="BUY", textcolor = color.white, style=shape.labelup, size = size.normal, location=location.belowbar, color = color.new(color.green, 0)) 詳細はこちら plotshape ((shortCondition, title = "Sell Signal", text ="SELL", textcolor = color.white, style=shape.labeldown, size = size.normal, location=location.abovebar, color = color.new(color.red, 0)) サイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイトを表示するサイト ` ` plotshape ((longCondition, title = "Buy Signal", text ="BUY 図が表示されているとき,longCondition の条件のみが満たされている. 条件は以下の通りです. ` ` if buy 条件と戦略.position_size == 0 strategy.entry (("long",strategy.long, amount) "戦略.長い,金額"など) strategy.exit (("exit_long", "long", amount, loss=loss, trail_points=trailPoints, trail_offset=trailOffset) ストラテジーの出口は,この2つのポイントで決まる. if sell 条件と戦略.position_size == 0 strategy.entry (("short",strategy.short, amount) "戦略.エントリー" (short, strategy.short, amount) "戦略.短" (short, strategy.short, amount) "戦略.短" (short, strategy.short, amount) "戦略.短" (short, amount) "戦略.短" (strategy.entry) "戦略" (short, amount) "戦略" (short, amount) "戦略.短" (short, amount) " strategy.exit (("exit_short", "short", amount, loss=loss, trail_points=trailPoints, trail_offset=trailOffset) "というサイトを立ち上げました. ` `

軽い雲驚くことではありません 分かりました ありがとうございました

小さな夢line このオブジェクトはFMZで一時的にサポートされていないため,いくつかの帯線のようなものが変更できない可能性があります. いくつかのポリシーではこのオブジェクトを使用して計算に参加しています.

小さな夢復習時間が長すぎたり,データ量が多すぎたりしたのでしょう.

小さな夢パイン言語のチュートリアルには,章や説明があります. http://www.fmz.com/bbs-topic/9390#%E5%B8%A6%E8%B7%F%E8%B8%AA%E6%AD%A2%E6%8D%9F%E6%AD%A2%E7%9B%88%E7%9A%84%E8%B6%85%E7%BA%A7%E8%B6%8B%E5%8A%BF%E7%AD%96%E7%95%A5

軽い雲"年か10ヶ月で,基本的には完成し,1年後には,このヒントや他のヒントが来る"

小さな夢制限がないので,このエラー報告は,復習時間の範囲が大きすぎると考えられます.

軽い雲PINEの回線時間帯に制限がありますか?私は2021年1月1日から2022年10月11日までを選択しました. RunError: abort: js(undefined) at Error atStackTrace (eval at self.onmessage (https://www.fmz.com/scripts/worker_detours.393054f7.js:1:147), :1:2096171) at stackTrace (eval at self.onmessage (https://www.fmz.com/scripts/worker_detours.393054f7.js:1:147), :196345) at abort (eval at self.onmessage (https://www.fmz.com/scripts/worker_detours.393054f7.js:147), :192xxx:1478) at _aborttime at.message (https://www.fmz.com/scripts/detours.f7.js:147), :20961747] at at at.evaluation (eval at self.onmessage (https://www.fmz.fmz.com/scripts しかし,時間帯を変えなければ正常な再測ができます。。。 /upload/asset/5a09837c7498543a0c5c.jpg

小さな夢Pine は,JS コードに埋め込まれたより複雑なブロックを設計すべきだ.

小さな夢この記事へのトラックバック一覧です.

小さな夢メールのアドレスが間違っていたので,変更しました.