HPotter

Moving Average Envelopes Backtest

Moving Average Envelopes are percentage-based envelopes set above and
below a moving average. The moving average, which forms the base for
this indicator, can be a simple or exponential moving average . Each
envelope is then set the same percentage above or below the moving average.
This creates parallel bands that follow price action. With a moving average
as the base, Moving Average Envelopes can be used as a trend following indicator.
However, this indicator is not limited to just trend following. The envelopes
can also be used to identify overbought and oversold levels when the trend is
relatively flat.

You can change long to short in the Input Settings
WARNING:
- For purpose educate only
- This script to change bars colors.
从常用脚本中删除 添加到常用脚本

评论

Thx for this work - I analysed this one - can you explain me these lines of code?
pos = iff(close > xHighBand, 1,
iff(close <xLowBand, -1, nz(pos, 0)))
possig = iff(reverse and pos == 1, -1,
iff(reverse and pos == -1, 1, pos))

Are you calculating the bearish or bullish?
+1 回复
TomBully TomBully
When he close higher then the Upperbnad the you draw a green line when the close LowBand than you draw a red one - but waht is the reason behind?
回复
HPotter TomBully
@TomBully, This pos - for get trade signal 1-long -1 short. possig - for trade reverse.
回复
Would it be possible to modify the backtest to go long on any test of the lowband at the time of the test versus upon the close of the candle?
回复
HPotter JMVala_Trades
@JMVala_Trades, Results will be incorrect, because backtest use open\close price for entry\exit. Your logic need to be tested on the realtime data.
回复
How do we select the stocks for trading MA envelope? High Beta or High Volatility stocks, which will go well? Please suggest.
回复
HPotter MarketAlpha
@MarketAlpha, I do not trading stocks. Sorry
回复
Thank you!
How can i change this to start backtesting from year 2015?
回复
How can I change this to long only trades?
回复
HPotter Lars1
@Lars1, To change line 33 on strategy.close_all()
+1 回复
首页 股票筛选器 外汇筛选器 加密货币筛选器 财经日历 如何运作 图表功能 价格 推荐朋友 网站规则 帮助中心 网站 & 经纪商解决方案 插件 图表解决方案 轻量图表库 博客 & 新闻 Twitter
概览 个人资料设置 账户和账单 推荐朋友 代币 我的客服工单 帮助中心 已发表观点 粉丝 正在关注 私人消息 在线聊天 退出