Hello admin,,i just make a simple EA named as tes.mq5,,here is code below :
int timer1=0;
int timer2=10;
int OnStart(void){
timer1++;
double y=iClose(Symbol(),PERIOD_M1,0);
double Ask = SymbolInfoDouble(_Symbol,SYMBOL_ASK);
double Bid = SymbolInfoDouble(_Symbol,SYMBOL_BID);
if(
timer1>timer2
){
//buy
MqlTradeRequest request_buy={0};
request_buy.action=TRADE_ACTION_DEAL;
request_buy.magic=1234;
request_buy.symbol=_Symbol;
request_buy.volume=0.1;
request_buy.sl=NormalizeDouble(Ask+100*Point(),Digits());
request_buy.tp=NormalizeDouble(Bid-200*Point(),Digits());
request_buy.type=ORDER_TYPE_BUY;
//request.price=GetRandomPrice(request.type); // open price
MqlTradeResult result_buy={0};
OrderSend(request_buy,result_buy);
//sell
MqlTradeRequest request_sell={0};
request_sell.action=TRADE_ACTION_DEAL;
request_sell.magic=1234;
request_sell.symbol=_Symbol;
request_sell.volume=0.1;
request_sell.sl=NormalizeDouble(Ask+20*Point(),Digits());
request_sell.tp=NormalizeDouble(Bid-40*Point(),Digits());
request_sell.type=ORDER_TYPE_SELL;
//request.price=GetRandomPrice(request.type); // open price
MqlTradeResult result_sell={0};
OrderSend(request_sell,result_sell);
}
return(0);
}
This code no error on compile,,but i cant tes this code on tester.
Maybe admin or senior MQL5 developer in here can give me a very very simple EA MQL5 script for learning, give me a very simple sample tutor, so i can easy practice and test it on tester metatrader5, thanks
Files:
screenshot3.png
72 kb
screenshot1.png
68 kb
screenshot2.png
104 kb
- simple question about OrderSend
- Errors, bugs, questions
- need an example of buy 1.8 LOT EURUSD SL 35 TP 70 pip comment kelly
Forum on trading, automated trading systems and testing trading strategies
When you post code please use the CODE button (Alt-S)!

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register