![通过MQL5社区和服务探索MetaTrader 5的新机遇 通过MQL5社区和服务探索MetaTrader 5的新机遇](https://c.mql5.com/36/48/mql5-metatrader-5.png)
- 2021.04.26
- www.mql5.com
- 各位大神。MT4更新后我的EA模拟账户可以用,但是实盘账户却用不了,这是为啥?
- PROBLEM
- 请帮助我 [已解决]
跪求跪求~!
去自由职业者版块,发布您的需求,响应会更快
//+------------------------------------------------------------------+
//| 123.mq5 |
//+------------------------------------------------------------------+
#property copyright "柒侠伍义_初级EA教程_商业版本MT5版"
#property link "https://www.mql5.com/zh/users/sohoguhu"
#property description "by MQL5社区会员 sohoguhu 改编自某莫名的MT4EA"
#property description "只保证语法正确,不管逻辑正误。"
#property version "21.05"
datetime 限制一根柱子下注一次;
input double 下注数量=0.1;
input int 止损=200;
input int 止盈=200;
input int 滑点=30;
input string ea名字="澳美";
input int 魔术号码=16384;
input int 柱子数=5;
int 一段天数的平均价位;
#include <Trade\Trade.mqh>
CTrade YouTrade;
int OnInit()
{
TesterHideIndicators(true);
一段天数的平均价位=iMA(NULL,PERIOD_M5,柱子数,0,MODE_SMA,PRICE_CLOSE);
YouTrade.SetExpertMagicNumber(魔术号码);
return(INIT_SUCCEEDED);
}
void OnDeinit(const int reason)
{
}
void OnTick()
{
double ma[];
ArraySetAsSeries(ma,true);
CopyBuffer(一段天数的平均价位,0,0,柱子数,ma);
double 澳美=SymbolInfoDouble(Symbol(),SYMBOL_ASK);
MqlDateTime stm;
TimeCurrent(stm);
datetime Time0=iTime(NULL,0,0);
YouTrade.SetDeviationInPoints(滑点);
if(PositionsTotal()<=100
&& 澳美<ma[0]
&& 限制一根柱子下注一次!=Time0
&& stm.day_of_week!=6
&& stm.day_of_week!=7)
{
YouTrade.Buy(下注数量,NULL,0,SYMBOL_ASK-止损*_Point,SYMBOL_ASK+止盈*_Point,ea名字);
限制一根柱子下注一次=Time0;
}
if(PositionsTotal()<=100
&& 澳美>ma[0]
&& 限制一根柱子下注一次!=Time0
&& stm.day_of_week!=6
&& stm.day_of_week!=7)
{
YouTrade.Sell(下注数量,NULL,0,SYMBOL_BID+止损*_Point,SYMBOL_BID-止盈*_Point,ea名字);
限制一根柱子下注一次=Time0;
}
}
![Nianfu Li Nianfu Li](https://c.mql5.com/36/48/nianfu-li.jpg)
When you post code please use the CODE button (Alt-S)!
Thank you.