Buyandsell-markersonlowertimeframeswhenlongertimeframeshowsuptrend
创始人
2025-01-10 16:30:24
0

在长期趋势显示为上涨时,可以在较低时间框架上购买和卖出标记。为了实现这个策略,我们可以使用以下代码:

//@version=4 strategy("Buy and Sell Markers on Lower Time Frames when Longer Time Frame Shows Uptrend", overlay=true, margin_long=100, margin_short=100)

//长期时间框架 resLong = input("D", title="Long-Term Timeframe") lenLong = input(20, title="Long-Term Moving Average Length") srcLong = input(close, title="Long-Term Moving Average Source") maLong = sma(srcLong, lenLong)

//判断趋势是否上涨 longCondition = close > maLong

//单独的窗口显示较长时间框架上的结果 plot(series=maLong, title="Long-Term MA", color=color.green, linewidth=2, transp=0)

//短期时间框架 resShort = input("60", title="Short-Term Timeframe") lenShort = input(5, title="Short-Term Moving Average Length") srcShort = input(close, title="Short-Term Moving Average Source") maShort = sma(srcShort, lenShort)

//判断趋势是否上涨 shortCondition = close > maShort

//单独的窗口,显示较短时间框架上的结果 plot(series=maShort, title="Short-Term MA", color=color.blue, linewidth=2, transp=0)

//确定买入和卖出信号 buySignal = crossover(maShort, maLong) and longCondition and shortCondition sellSignal = crossunder(maShort, maLong) and longCondition and shortCondition

//下单代码 if (buySignal) strategy.entry("Long", strategy.long) if (sellSignal) strategy.entry("Short", strategy.short)

//标记指示

相关内容

热门资讯

了解透视!哈糖大菠萝攻略!一贯... 了解透视!哈糖大菠萝攻略!一贯真的有辅助方法(详细教程)-哔哩哔哩1、哈糖大菠萝攻略模拟器是什么优化...
普及透视!pokemmo脚本最... 普及透视!pokemmo脚本最新版!总是一直总是有辅助工具(有挂规律)-哔哩哔哩1、玩家可以在pok...
关于透视!pokemmo修改器... 关于透视!pokemmo修改器手机版!竟然真的有辅助技巧(真实有挂)-哔哩哔哩1.pokemmo修改...
详情透视!红龙poker有辅助... 详情透视!红龙poker有辅助吗!其实有辅助技巧(有挂方式)-哔哩哔哩运红龙poker有辅助吗辅助工...
详细透视!epoker透视!一... 详细透视!epoker透视!一直有辅助工具(有挂技术)-哔哩哔哩1、epoker透视透视辅助软件激活...
辅助透视!pokemmo辅助官... 辅助透视!pokemmo辅助官网!其实一直总是有辅助工具(有挂攻略)-哔哩哔哩1、实时pokemmo...
详细透视!约局吧怎么看有没有挂... 详细透视!约局吧怎么看有没有挂!确实是真的有辅助软件(有挂秘籍)-哔哩哔哩1、游戏颠覆性的策略玩法,...
揭幕透视!红龙poker辅助平... 揭幕透视!红龙poker辅助平台!都是真的有辅助神器(讲解有挂)-哔哩哔哩进入游戏-大厅左侧-新手福...
关于透视!xpoker辅助助手... 关于透视!xpoker辅助助手!真是有辅助脚本(真的有挂)-哔哩哔哩1、超多福利:超高返利,海量正版...
科普透视!uupoker有透视... 科普透视!uupoker有透视吗!竟然一直都是有辅助插件(真是有挂)-哔哩哔哩1、完成uupoker...