资源加载中... loading...

Midas Mk.II-终极震荡策略

Author: 雨幕(youquant), Date: 2022-06-01 16:05:14
Tags: smaMACD

此纸条仅用于4小时图表

其工作原理-为了在4小时K线BAR中进行交易,这比较短时间范围的烛光范围大得多,脚本使用较长时间范围的ema、sma和MACDs来解释这种情况。当ema和sma交叉且MACD直方图的变化率有利于方向时,系统提供多/空信号。 如何使用-当信号与其他分析(趋势、谐波模式等)一致时,脚本最有效。此脚本不提供任何退出信号,因此我建议在K线BAR脱离结构或其他策略时退出。

更新或修订将记录在评论中。祝这个脚本好运!

回测测试

img

img

img


/*backtest
start: 2021-12-01 00:00:00
end: 2022-05-31 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_CTP","currency":"FUTURES"}]
args: [["ContractType","rb2210",360008]]
*/

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

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

//@version=5
indicator(title="Midas Mk. II - Ultimate Crypto Swing", overlay=true)

[MACD_line, Signal_line, hist] = ta.macd(close, 55, 89, 9)

// Strategy conditions
crossover = ta.crossover(ta.ema(close, 21), ta.sma(close, 55))
crossunder = ta.crossunder(ta.ema(close, 21), ta.sma(close, 55))

long_entry_condition = crossover and (hist >= 0 or (hist[0] > hist[1] and hist[1] > hist[2]))
short_entry_condition = crossunder and (hist <= 0 or (hist[0] < hist[1] and hist[1] < hist[2]))

simple_crossover = crossover and not long_entry_condition
simple_crossunder = crossunder and not short_entry_condition


// Plot on the chart
plotchar(long_entry_condition,  "Go Long",  "▲", location.belowbar, color.lime, size = size.small, text = "long")
plotchar(short_entry_condition, "Go Short", "▼", location.abovebar, color.red, size = size.small, text = "short")
plotchar(simple_crossover, "Crossing Up", "▲", location.belowbar, color.lime, size = size.tiny)
plotchar(simple_crossunder, "Crossing Down", "▼", location.abovebar, color.red, size = size.tiny)


if long_entry_condition
    strategy.entry("Enter Long", strategy.long)
else if short_entry_condition
    strategy.entry("Enter Short", strategy.short)
template: strategy.tpl:40:21: executing "strategy.tpl" at <.api.GetStrategyListByName>: wrong number of args for GetStrategyListByName: want 7 got 6