arrows are not named "out of the blue" =) and multiplying 2 arrows per position is not economical. For example, for a Sell Stop order, the name of the arrow is "#833894 sell stop", it needs a discription ;) something like this:
int _OrderTicket=OrderSend(Symbol(),_OrderType,Lots,Ask,Slippage,0.0,0.0,_Comment,ExpertMagicNumber,0,Blue);
if(_OrderTicket<0)
{
Print("OrderSend failed with error #",GetLastError());
return(0);
}
string _OrderType_string;
switch ( _OrderType )
{
case OP_BUY: _OrderType_string = " buy"; break;
case OP_SELL: _OrderType_string = " sell"; break;
case OP_BUYLIMIT: _OrderType_string = " buy limit"; break;
case OP_SELLLIMIT: _OrderType_string = " sell limit"; break;
case OP_BUYSTOP: _OrderType_string = " buy stop"; break;
case OP_SELLSTOP: _OrderType_string = " sell stop"; break;
}
string arrow_name = "#" + _OrderTicket + _OrderType_string;
ObjectSetText(arrow_name,_Comment,10);
BUY when any of the SELL conditions are met SELL at any BUY condition.
For example, we have 150 separate BUY conditions and 150 separate SELL conditions.
We suggest adding all 150 SELL conditions to the BUY closing once again and then adding them once more to the BUY closing. then add 150 Buy conditions into the SELL close.
Regarding closing <br / translate="no"> BUY upon occurrence of any of the SELL conditions SELL in all BUY conditions.
For example, we have 150 separate conditions for BUY and 150 separate conditions for SELL.
We would like to add all 150 SELL conditions to the BUY closure once again, and then add another 150 BUY conditions. then add 150 Buy conditions into the SELL close.
Could it be done in a more optimal way?
No, why? If the Sell condition triggers, we automatically close BUY. There's no sense to write the same thing twice.
I wonder what the respected experts have to say about the structure of the EA code, MQ's proposed structure
Инициализация переменных
Первичные проверки данных
проверка графика, количество баров на графике
проверка значений внешних переменных Lots, S/L, T/P, T/S
Установка внутренних переменных для быстрого доступа к данным
Проверка торгового терминала – пустой ли? Eсли да, то:
проверки: если ли деньги на счету и тд...
можно встать в длинную позицию(BUY)?
открыть длинную позицию и выйти
можно встать в короткую позицию(SELL)?
открыть короткую позицию и выйти
выход из эксперта...
Контроль открытых ранее позиций в цикле
если это длинная позиция
нужно ли закрыть?
нужно ли передвинуть трейлинг-стоп?
если это короткая позиция
нужно ли закрыть?
нужно ли передвинуть трейлинг-стоп?
I wonder, what the respected say about the structure of EA code, the structure offered by MQ <br / translate="no"> does not seem to include all the subtleties of writing an EA.
primitive =)))
This structure was outlined to give you some idea of the possible structure of the Expert Advisor. I think that such an EA would not work even in a demo. Not a word about the real one ) But it is remarkable that most EA writers started with MACD-Sample analysis =))) Just have nothing else to do (
Интересно, а вот что скажут уважаемые насчет структуры кода эксперта, предлагаемая MQ структура судя по всему не включает в себя все тонкости написания эксперта.
primitive =)))
this structure was laid out for some idea of the possible structure of an EA. I think such an EA would not work even in a demo. Not a word about the real one ) But it is remarkable that most EA writers started with MACD-Sample analysis =))) Just have nothing else to do (
That is why I am interested, because the set is really more or less stable for all EAs
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.
arrows are not named "out of the blue" =) and multiplying 2 arrows per position is not economical.
For example, for a Sell Stop order, the name of the arrow is "#833894 sell stop", it needs a discription ;)
something like this:
int _OrderTicket=OrderSend(Symbol(),_OrderType,Lots,Ask,Slippage,0.0,0.0,_Comment,ExpertMagicNumber,0,Blue); if(_OrderTicket<0) { Print("OrderSend failed with error #",GetLastError()); return(0); } string _OrderType_string; switch ( _OrderType ) { case OP_BUY: _OrderType_string = " buy"; break; case OP_SELL: _OrderType_string = " sell"; break; case OP_BUYLIMIT: _OrderType_string = " buy limit"; break; case OP_SELLLIMIT: _OrderType_string = " sell limit"; break; case OP_BUYSTOP: _OrderType_string = " buy stop"; break; case OP_SELLSTOP: _OrderType_string = " sell stop"; break; } string arrow_name = "#" + _OrderTicket + _OrderType_string; ObjectSetText(arrow_name,_Comment,10);Should work, but haven't checked =)
BUY when any of the SELL conditions are met
SELL at any BUY condition.
For example, we have 150 separate BUY conditions and 150 separate SELL conditions.
We suggest adding all 150 SELL conditions to the BUY closing once again and then adding them once more to the BUY closing.
then add 150 Buy conditions into the SELL close.
Can it be done in a better way?
BUY upon occurrence of any of the SELL conditions
SELL in all BUY conditions.
For example, we have 150 separate conditions for BUY and 150 separate conditions for SELL.
We would like to add all 150 SELL conditions to the BUY closure once again, and then add another 150 BUY conditions.
then add 150 Buy conditions into the SELL close.
Could it be done in a more optimal way?
No, why?
If the Sell condition triggers, we automatically close BUY. There's no sense to write the same thing twice.
yes, frills and trinkets =) but it makes the work more pleasant
Can't it be done in a better way?
Collect all conditions into two variables like -
and then use them as many times as you need.
Инициализация переменных Первичные проверки данных проверка графика, количество баров на графике проверка значений внешних переменных Lots, S/L, T/P, T/S Установка внутренних переменных для быстрого доступа к данным Проверка торгового терминала – пустой ли? Eсли да, то: проверки: если ли деньги на счету и тд... можно встать в длинную позицию(BUY)? открыть длинную позицию и выйти можно встать в короткую позицию(SELL)? открыть короткую позицию и выйти выход из эксперта... Контроль открытых ранее позиций в цикле если это длинная позиция нужно ли закрыть? нужно ли передвинуть трейлинг-стоп? если это короткая позиция нужно ли закрыть? нужно ли передвинуть трейлинг-стоп?does not seem to include all the subtleties of writing an EA.
primitive =)))
This structure was outlined to give you some idea of the possible structure of the Expert Advisor. I think that such an EA would not work even in a demo. Not a word about the real one )
But it is remarkable that most EA writers started with MACD-Sample analysis =))) Just have nothing else to do (
судя по всему не включает в себя все тонкости написания эксперта.
primitive =)))
this structure was laid out for some idea of the possible structure of an EA. I think such an EA would not work even in a demo. Not a word about the real one )
But it is remarkable that most EA writers started with MACD-Sample analysis =))) Just have nothing else to do (
That is why I am interested, because the set is really more or less stable for all EAs