2017/9/18 15:08:00
来源:互联网
浏览:1358
MM % 波动率脚本作者:max12
MM % 波动率脚本使用说明:
参考资产的波动率计算手数比并开仓。止损自动设置, 止盈 - 根据需求, 作为乘数 R。
LotSize:=RiskAmount/(PointPrice*StopLossPoints);
RiskAmount:=FreeMargin*RiskPercent/100;
StopLossPoints:=kATR*ATR(TimeFrame,RiskAtrPeriod)/PointSize;
TakeProfitPoints:=StopLossPoints*ProfitToLossRatio.
操作函数是 Trade, 在 Trade.mq4 库文件里。声明:
int Trade(string smb, int TimeFrame, int cmd, bool ShowQ, int Slippage, bool SetProfit, double MaxRiskPercent, int RiskAtrPeriod, double RiskMulATR, double ProfitToLossRatio), where:
smb - 资产名称;
TimeFrame - 用于检测 StopLossPoints;
cmd - OP_BUY 或 OP_SELL;
ShowQ - 显示确认对话框 (False - 无对话框);
Slippage - 滑点点数;
SetProfit - 若为 True - 将在订单里指定止盈;
MaxRiskPercent - 可用保证金的 %, 允许的风险 (2% - 典型, 5% - 激进, 更高 - 看运气了);
RiskAtrPeriod - 计算真实范围的最后柱线号码 (21 足够了);
RiskMulATR - 用于确定 StopLossPoints;
ProfitToLossRatio - R 的乘数 (例如, 5)。
附带脚本:
Buy.mq4/Sell.mq4 - 买/卖当前资产, 时间帧, 带确认对话框, 滑点 1 个点, 2% 风险, RiskAtrPeriod=21, RiskMulATR=1, ProfitToLossRatio=10;
Buy_nonQuery.mq4/Sell_nonQuery.mq4 - 设置相同, 但没有对话框, 且滑点=0。
如何安装:
Trade.mqh - 拷贝到 MetaTrader 根目录下的 'experts' 目录下的 'include' 子目录;
Trade.mq4 - 拷贝到 MetaTrader 根目录下的 'experts' 目录下的 'libraries' 子目录, 并编译;
Buy.mq4, Buy_nonQuery.mq4, Sell.mq4, Sell_nonQuery.mq4 - 拷贝到 MetaTrader 根目录下的 'experts' 目录下的 'scripts' 子目录, 并编译。
MM % 波动率脚本作者、使用说明信息为小编网络搜集不确保完全准确,望知