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)

//标记指示

相关内容

热门资讯

透视模拟器!aapoker如何... 透视模拟器!aapoker如何设置胜率(透视)aapoker发牌逻辑,专业教程(有挂插件);透视模拟...
透视脚本!aapoker公共底... 透视脚本!aapoker公共底牌(透视)aapoker怎么控制牌,可靠教程(有挂详情);1、上手简单...
透视计算!aapoker公共底... 透视计算!aapoker公共底牌(透视)aapoker透视脚本下载,切实教程(有挂脚本)1、下载好a...
透视透视!aapoker真的假... 透视透视!aapoker真的假的(透视)aapoker插件下载,2025新版(有挂教程)1、aapo...
透视能赢!aa poker透视... 透视能赢!aa poker透视软件(透视)aapoker真的假的,德州教程(有挂规律)1、每一步都需...
透视软件!aapoker脚本怎... 透视软件!aapoker脚本怎么用(透视)aapoker俱乐部靠谱吗,线上教程(有挂方法)1、进入到...
透视实锤!aapoker发牌逻... 透视实锤!aapoker发牌逻辑(透视)aapoker怎么拿好牌,2025新版教程(有挂教程)1、每...
透视线上!aapoker辅助软... 透视线上!aapoker辅助软件合法吗(透视)aapoker辅助器是真的吗,规律教程(有挂辅助);进...
透视插件!aapoker透视脚... 透视插件!aapoker透视脚本(透视)aapoker辅助工具安全吗,实用技巧(有挂规律);1、玩家...
透视数据!wepoker免费脚... 透视数据!wepoker免费脚本咨询,wepoker可以透视码(详细开辅助能查到)1、进入游戏-大厅...