Questions from Beginners MQL5 MT5 MetaTrader 5 - page 596

 
I can not understand why in the loop stops finding and closing positions, I've already turned the loop and increased the number of positions, in the tester still skips (leaves) position. advise if you can see where and what is wrong ...
int positions=PositionsTotal();
       for(int x1=-1;x1<positions;x1++) 
          {
           ulong pos_tiket11=PositionGetTicket(x1);
           if(PositionSelectByTicket(pos_tiket11))
             {
              string comment11=PositionGetString(POSITION_COMMENT);
              Print("ПОЗИЦИЯ ТИКЕТ + "+(string)pos_tiket11+" "+comment11+" ТИП "+(string)PositionGetInteger(POSITION_TYPE));
              if(pos_tiket11!=TIKET11) 
                {
                 ENUM_POSITION_TYPE type11=(ENUM_POSITION_TYPE)PositionGetInteger(POSITION_TYPE);
                 if(type11==POSITION_TYPE_BUY)
                   {
                    Print("ПОЗИЦИЯ ВЫБРАНА КОМЕНТ = "+comment11);
                    mytrade111.PositionClose(pos_tiket11,15);
                    TIKKET=0;    
                    dolivka_P1=1;
                   } 
                }
             }
          }
|
delete
|

 
Anatolii Zainchkovskii:
I can't understand why the search and close positions stops in the loop, I've already turned the loop and increased the number of positions, in the tester still skips (leaves) position. advise me if you can see where and what is wrong ...
|
delete
|

I take it you have hedging? It goes like this:

int positions=PositionsTotal();
       for(int x1=PositionsTotal()-1;x1>=0;x1--) 
          {
              // далее без изменений
 
Alexey Volchanskiy:

I take it you are hedging? It should go like this:

Thank you for your answer. I've tried it that way. Well, it must be something else. I'll keep looking.
 

Please help me to solve this problem!

I need to load once in an EA or indicator in MT4 anothercustom indicator to learn from it reference points in the form of results of calculation of this indicator. The indicator I want to get data from is a wasteful one and is not needed for further work. How can I unload this indicator without unloading the Expert Advisor (indicator) that used this indicator once?

 
-Aleks-:

Please help me to solve this problem!

I need to load once in an EA or indicator in MT4 anothercustom indicator to learn from it reference points in the form of results of calculation of this indicator. The indicator I want to get data from is a wasteful one and is not needed for further work. How can I unload this indicator without unloading the Expert Advisor (indicator) which has used this indicator once?

In fiveIndicatorRelease, in four no way

 
Alexey Volchanskiy:

In fiveIndicatorRelease, in four no way

Pity, thanks for the reply.
 
advise how to solve this problem: when the Expert Advisor on MT5 on Sishka, the bot opened a position. after the day clearing, the Expert Advisor took the clearing price and closed the trade at a loss. the average price was on a totally different level. is it possible to ignore the clearing price? or should I prescribe in the Expert Advisor to save my average price. thanks in advance for the substantial answers.
 
vovka40:
i would like to advise how to solve this problem: when the Expert Advisor on MT5 is running on syshka, the bot opened a position. after the day clearing, the Expert Advisor took the clearing price and closed the trade at a loss. the average price was on a totally different level. is it possible to ignore the clearing price? or should i specify in the Expert Advisor to save the average price. thanks in advance for the substantial answers.
The opening price should be memorized by the Expert Advisor itself. You cannot go by the opening price after the clearing.
 
Vasiliy Sokolov:
The opening price of a position must be memorised by the advisor himself. You cannot use the opening price after clearing.
The question is whether it is possible to teach the Expert Advisor to ignore the clearing price by memorizing its own average transaction price?
 
vovka40:
The question is whether it is possible to teach the Expert Advisor to ignore the clearing price by memorizing its average transaction price?
Write it down on a piece of paper - it's safer to put it in a file.