Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 1133
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
prıvet .podzajajajte pojalusta pogu na demo schete ne mogu otkrıt zdelkı
trade is disablet .oshıbka
No sins, what does it swear at.
What are the compiler errors
Something to do with the fact that the function must be global and waiting for commas in places where it makes no sense to put them! For example at the separator between information about broker and traded pair
A word of advice for a dummy. How do I open a live account?
What do you mean "none"? Sort by ticket - there will always be an order and no contradiction with documentation, it says about sorting by serial number, not by ticket, they are different things.
We have this list of orders at one moment (by ticket)
- Buy #1
- Buy #2
- BuyStop #3
- Sell #4
The order of the tickets in the list is: #1,#2,#3,#4After BuyStop #3 what order will the tickets be in the list?
Is it #1,#2,#4,#3?
So the tickets don't guarantee orderliness either.
Another problem I've encountered! Don't judge, I've been studying the language for 2-3 weeks, maybe I'm just dumb!
The task on the Expert Advisor is to notify the trader via email every 4 hours, if the free margin on the account has added a certain value.
In the subject of the message you have to write the name of the broker and the traded pair, and in the body of the message "Danger! The drawdown is over the limit. Take the necessary measures".
The compiler is malfunctioning, I'm not good at English and I can't figure out what the error is!
double Sag;
void OnTick()
{
Sag = NormalizeDouble(100-100*(AccountInfoDouble(ACCOUNT_FREEMARGIN)/AccountInfoDouble(ACCOUNT_BALANCE)), 1); //находим процент просадки и округляем до 1 знака
if(Sag > MessageMail && iVolume(NULL,PERIOD_H4,0)<3) //если просадка больше заданного и начата новая свеча на 4ч таймфрейме
{
Alert(Symbol(), ": Просадка = ", Sag, " % ", " > ", MessageMail, " % "); //вывести предупреждение в терминале
//Сюда нужно вставить команду SendMail для отправки сообщения, а что и как не понятно
// пробовал bool SendMail( AccountInfoString(ACCOUNT_COMPANY)|Symbol, "Опасность! Просадка привысила допустимое значение. Примите необходимые меры")
//что то не выходит
}
}
PS: Maybe in general there is an easier solution for this kind of problem, but so far I see it only this way)
//| exTestSendMail.mq4 |
//| Copyright 2017, Artem A. Trishkin, Skype artmedia70 |
//| https://login.mql5.com/ru/users/artmedia70 |
//+------------------------------------------------------------------+
#property copyright "Copyright 2017, Artem A. Trishkin, Skype artmedia70"
#property link "https://login.mql5.com/ru/users/artmedia70"
#property version "1.00"
#property strict
input double MessageMail = 50.0;
//---
double Sag=0;
string MailSubject="";
datetime PrevTime=0;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
MailSubject="Mail from EA "+MQLInfoString(MQL_PROGRAM_NAME);
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
//--- Находим процент просадки и округляем до 1 знака
Sag=NormalizeDouble(100-100*(AccountInfoDouble(ACCOUNT_MARGIN_FREE)/AccountInfoDouble(ACCOUNT_BALANCE)),1);
//--- Если открыт новый бар на H4
if(iTime(Symbol(),PERIOD_H4,0) !=PrevTime) {
//--- если просадка больше заданного
if(Sag>MessageMail) {
Alert(Symbol(), ": Просадка = ", DoubleToString(Sag,1), " % ", " > ", MessageMail, " % "); //вывести предупреждение в терминале
string MailText=AccountInfoString(ACCOUNT_COMPANY)+" > Опасность! Просадка ("+DoubleToString(Sag,1)+"%) привысила допустимое значение. Примите необходимые меры.";
SendMail(MailSubject,MailText);
}
PrevTime=iTime(Symbol(),PERIOD_H4,0);
}
}
//+------------------------------------------------------------------+
Thank you! Set up to send letters!
how to fixthe return value '' OrderClose must be checked??????????????????????????????
Dear programmers, please help a newbie in this business.
The EA is opening buy and sell orders sequentially after a certain period of time. I want it to modify all previous orders (specifically, all previous ones should be closed by Take Profit of the last one. I.e. if the last buy order and previous sell order, then the stop loss of the previous order is set to the take profit level of the last one,
If the previous buy buy, then its TakeProfit will be set on the level of the last TakeProfit. The point is that when takeprofit of the last order comes, all orders must be closed).
I hope I explained it clearly, although it is difficult to understand how it should be implemented. Thank you in advance.
I understand that we can go through all open orders and modify them, but how can we skip the last order?
Dear programmers, please help a newbie in this business.
The EA is opening buy and sell orders sequentially after a certain period of time. I want it to modify all previous orders (specifically, all previous ones should be closed by Take Profit of the last one. I.e. if the last buy order and previous sell order, then the stop loss of the previous order is set to the take profit level of the last one,
If the previous buy buy, then its TakeProfit will be set on the level of the last TakeProfit. Well, etc. The point is that when takeprofit of the last order comes, all orders must be closed).
I hope I explained it clearly, although it is difficult to understand how it should be implemented. Thank you in advance.
I understand that we can go through all open orders and modify them, but how can we skip the last one?
The most important thing in all this is understanding what should happen.
What is the "last order"? Is it last by opening time? Or by opening price level?
What if we consider "the last" order as "BUY", but the price will fuck up? Or vice versa, the last order will be SELL, but the price goes north? Then which one should be considered the last? This is what we have to realize.