Mod_ATR_Trailing_Stop - MetaTrader 5脚本
- 显示:
- 1137
- 等级:
- 已发布:
- 2018.06.11 17:11
- 需要基于此代码的EA交易或指标吗?请在自由职业者服务中订购 进入自由职业者服务
指标显示价格图表上可能的止损价位。 多头仓和空头仓分别显示。
它有两个参数:
- Period - 计算周期;
- Coefficient - 自价格的距离。
计算:
-
如果 Close[i] < TS[i-1] and Close[i-1] < TS[i-1]
TS[i] = Min(TS[i-1], Close[i] + loss) -
Если CClose[i] > TS[i-1]
TS[i] = Close[i] - loss -
如果 CClose[i] < TS[i-1]
TS[i] = Close[i] + loss
其中
loss = Coeff*WMA(Diff, Period), WMA - Wilder Exponential Moving Average, Diff[i] = Max(HiLo, Href, Lref), HiLo[i] = Min(High[i] - Low[i], MVA(High - Low, Period))
-
如果 CLow[i]<=High[i-1]
Href[i] = High[i] - Close[i-1] -
如果 CLow[i]>High[i-1]
Href[i] = (High[i] + High[i-1] - Low[i] - Close[i-1])/2 -
如果 CHigh[i]>=Low[i-1]
Lref[i] = Close[i-1] - Low[i] -
如果 CHigh[i]<Low[i-1]
Lref[i] = (Close[i-1] + High[i] - Low[i-1] - Low[i])/2
由MetaQuotes Ltd译自俄语
原代码: https://www.mql5.com/ru/code/20423