Questions from Beginners MQL5 MT5 MetaTrader 5 - page 638

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
Can you tell me who has encountered and knows how to get from this line:
29301441,1475681547,0,0.01,EURUSD,1.1207,0.0000,0.0000,1475690944,1.1213,0.00,0.00,0.60,,13134545
like this:
-118,120,-39,52,-58,-76,62,-66,-49,-97,-38,-86,-125,-52,-70,-96,89,-23,13,-91,111,74,-79,16,65,127,116,-76,99,5,27,48,42,44,55,-94,84,-72,-63,115,26,18,-47,-46,5,-55,32,68,114,-20,46,-7,79,7,82,78,-91,41,82,-114,121,112,-64,-106,35,-10,24,-128,58,-81,-69,92,34,79,64,-97,52,-95,127,-18,-46,104,104,85,56,93,8,100,14,-52,-88,-38,-28,-76,-49,35,-74,27,120,74,53,124,-104,-59,-1,41,-127,-99,103,104,-38,2,47,-93,68,35,-15,44,123,47,78,-117,15,-114,-46,-98,-108,-26,
Thank you!
Good afternoon.
I am not a programmer myself, but I want to make my EAs to send me email notifications of the signals. The task is simple and seems to work, but when the signal condition is fulfilled they send infinite number of emails.
Please help me to send only one email at each signal.
Here is an example of my code for the simple moving average. What should I add or fix?
Good afternoon.
I am not a programmer myself, but I want to make my EAs to send me email notifications of the signals. The task is simple and seems to work, but when the signal condition is fulfilled they send infinite number of emails.
Please help me to send only one email at each signal.
Here is an example of my code for the simple moving average. What should I add or fix?
Add datetime mailTime and remember the time before sending, so that you don't have to re-send the message
ps. it's time to switch from start() to OnTick() in EAs
pps. mailTime should also be saved in global variables of the terminal in case of restart of Expert Advisor.
add datetime mailTime and remember the pre-send time so you don't have to re-send the email
ps. It's time to switch from start() to OnTick() in EAs
pps. The mailTime should also be saved in the terminal's global variables in case the EA is restarted.
It did not work. It keeps sending the messages all the time.
Good afternoon.
I am not a programmer myself, but I want to make my EAs to send me email notifications of the signals. The task is simple and seems to work, but when the signal condition is fulfilled they send infinite number of emails.
Please help me to send only one email at each signal.
Here is an example of my code for the simple moving average. What should I add or fix?
static datetime TimeN=0;
With this year no emails are sent at all((
So what is ma equal to? Isn't it ma on the zero bar by any chance?
ma=iMA(NULL,0,MovingPeriod,MovingShift,MODE_SMA,PRICE_CLOSE,0);
ma=iMA(NULL,0,MovingPeriod,MovingShift,MODE_SMA,PRICE_CLOSE,0);
Then everything is clear. The Mach on the zero bar is constantly recalculated - so the signals will come at every tick.
Try it this way:
static datetime TimeN=0;
int Signal=0;
int init()
{
return(0);
}
start()
{
//Операции выполняются только при появлении следующего бара
datetime TimeC=iTime(NULL,TF,0);
if(TimeN==0)TimeN=TimeC;
if(TimeN==TimeC && Signal==1) return;
TimeN=TimeC;
Signal=0;
//-----------------------------------------------------------------------------------------------------
// Сигналы
//-----------------------------------------------------------------------------------------------------
if(Open[1]>ma && Close[1]<ma)
{
bool res = SendMail("Сигнал", " Покупай");
Signal=1;
}
if(Open[1]<ma && Close[1]>ma)
{
SendMail("Сигнал", "Продавай");
Signal=1;
}
return(0);
}
In general, usually do a comparison
ma=iMA(NULL,0,MovingPeriod,MovingShift,MODE_SMA,PRICE_CLOSE,1);
ma>Open[0];
the second string is more than similar to a signed char array. That is, the whole "string" may be just a binary structure printed byte-by-byte, and it may have been encrypted first, so there is no 0