Hello! I mastered MQL4 a year ago with ease. Now I'm trying to translate my EAs in MQL5, but I cannot even grasp the basics of the new language. If you can, please send me a simple program for opening a position at crossing a fast and a slow moving indicator with setting of Stop and Profit. Here is an example of a program that works in MQL4:
#define Lot 0.1
extern int Magic = 105;
extern int St=70;
extern int Pr=50;
static int prevtime = 0;
extern int PerF=15;
extern int PerL=55;
int init() { return(0); } int deinit() { return(0); }
Reshetov: Install Internet Explorer version 8 or higher, even if you never use it. Did the developers tie the Market in the terminal to this browser for some reason?
if(OrderSelect(tik)==true)
{
if(ORDER_TYPE_BUY)
{
if(Bid-ORDER_PRICE_OPEN>_Point *(TrailingStop/10))
{
if(ORDER_SL<Bid-_Point*(TrailingStop/10))
{
bool Ans=trade.OrderModify(tik,ORDER_PRICE_OPEN,NormalizeDouble(Bid-_Point*(TrailingStop/10),5),ORDER_TP,ORDER_TIME_GTC,ORDER_TIME_EXPIRATION);
if(Ans==true)
{
Alert("Цена Stop Loss ордера успешно модифицирована.");
return;
}
}
}
}return;
Заходя в первое условие перескакивает на return, хотя переменная tik определена и является глобальной. Подозреваю что неправильно получаю данные выбранного ордера, есть идеи в чем косяк?
romadd: There are various scalper EAs in the Market that show amazing results in the tester. But will they work on a real account?
This can only be tested on a real account if a free version of the EA is available. Many sellers put up Free versions of their paid EAs, so they can be tested not only in the tester.
But it is advisable, before testing on the real account, to make sure that we are not dealing with the tester grail on the demo accounts. Otherwise you will have no luck.
Заходя в первое условие перескакивает на return, хотя переменная tik определена и является глобальной. Подозреваю что неправильно получаю данные выбранного ордера, есть идеи в чем косяк?
Count the brackets for pairing. I counted more open than closed.
The condition is simple there, it duplicates what I wrote for Sell order type.
The question remains! Why doesn't it go further than the first condition?
Either attach the whole code or initialize your variables before the code snippet, please. I don't know what you have in your variables, for example in
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
When debugging, the EA crashes, although in theory it should cycle in OnTIck until the Tik==0 condition becomes false.
When debugging, the Expert Advisor crashes, although in idea it must execute a loop in OnTIck until the condition Tik==0 becomes false.
Look for errors. When compiling, pay attention to the error message.
says that you are trying to create a variable and the variable already exists in global declarations.
And so on and so forth.
Hello! I mastered MQL4 a year ago with ease. Now I'm trying to translate my EAs in MQL5, but I cannot even grasp the basics of the new language. If you can, please send me a simple program for opening a position at crossing a fast and a slow moving indicator with setting of Stop and Profit. Here is an example of a program that works in MQL4:
#define Lot 0.1
extern int Magic = 105;
extern int St=70;
extern int Pr=50;
static int prevtime = 0;
extern int PerF=15;
extern int PerL=55;
int init() { return(0); } int deinit() { return(0); }
int start() {
if (Time[0] == prevtime) return(0);
prevtime = Time[0];
if( iMA(NULL,0,PerF,0,MODE_SMMA,PRICE_MEDIAN,1)>iMA(NULL,0,PerL,0,MODE_SMMA,PRICE_MEDIAN,1)
&& iMA(NULL,0,PerF,0,MODE_SMMA,PRICE_MEDIAN,2)<iMA(NULL,0,PerL,0,MODE_SMMA,PRICE_MEDIAN,2) )
{ OrderSend(Symbol(),OP_BUY,Lot,Ask,3,Ask-St*Point,Ask+Pr*Point, "2014",Magic,0,Green);}
return(0); }
Install Internet Explorer version 8 or higher, even if you never use it. Did the developers tie the Market in the terminal to this browser for some reason?
There are various scalper EAs in the Market that show amazing results in the tester. But will they work on a real account?
This can only be tested on a real account if a free version of the EA is available. Many sellers put up Free versions of their paid EAs, so they can be tested not only in the tester.
But it is advisable, before testing on the real account, to make sure that we are not dealing with the tester grail on the demo accounts. Otherwise you will have no luck.
StrangerNet:
Count the brackets to see if they are paired. I have counted more open than closed.
The further condition is simple, it duplicates what I wrote for the Sell order type.
The question still remains. Why does not it go further than the first condition?
The condition is simple there, it duplicates what I wrote for Sell order type.
The question remains! Why doesn't it go further than the first condition?
Either attach the whole code or initialize your variables before the code snippet, please. I don't know what you have in your variables, for example in