Question for connoisseurs - page 11

 
Urain >> :

Acronis True Imidge software to create and restore Back Up . Back up your C drive.

Back Up and the system is as it was when it was created.

Back Up time is 4 min.

Thank you too.

 
rid >> :

>> Thank you too.

Dear rid, could you help me with a question here) https://forum.mql4.com/ru/15972/page145

 
MQLBankir >> :
Good day!
I have only been writing EAs for the first month.
I've got the simple ones figured out: you get a signal - open a position. What if I need several signals?
For example.
The 1st signal from an indicator
The 2nd signal comes later, but the 1st condition is already FALSE. I understand that the program is executed every tick, but I need to remember that the first condition (signal) is true and is not cancelled yet.
I was thinking maybe write it to a file. But I don't really understand it yet.
Perhaps there is another way out, through a function or something else?
Can you give me a hint?

I'm not really good at it.

But I suppose that if after 1st signal you "hang" the flag, let it hang.

Even if the 1st signal has already exhausted itself!

Then the 2nd signal will give a signal to open without any problem.

If I understand the question correctly...

 
Infinity >> :

Dear rid, could you help me out here with a question) https://forum.mql4.com/ru/15972/page145

Is that where you ask about closure? Look here.

'Closing positions. On a signal from an indicator.'

//------------------------

I, in my time, got into the subject there.

But in the code you posted - it's hard to understand there and I don't see any section on closing at all.

Here is a sample closing block for you:

//********* Закрытие позиций ****************************************
if ( AutoClose) { //если выключатель закрытия включен 
//----переменные для закрытия позиций ----
double Stochast_0 =iStochastic(NULL,0, Stochastic_period,3,3,MODE_SMA,0,MODE_MAIN,0);
double Stochast_1 =iStochastic(NULL,0, Stochastic_period,3,3,MODE_SMA,0,MODE_MAIN,1);
//----------------------------------------------------------------------
  for (int v=0; v<OrdersTotal(); v++)                             {       
      if (OrderSelect( v, SELECT_BY_POS, MODE_TRADES))               {           
        if (OrderSymbol()==Symbol()&& OrderMagicNumber()== MagicNum)   { 
//-----------------------------------------------------                  
if (OrderType() == OP_BUY) { 
      if( Stochast_1>75 && Stochast_0<75)     {
           OrderClose(OrderTicket(),OrderLots(),Bid,3,Green); // закрываем позицию
                 //return(0); // выходим
                }       
     }  
 //--------------------------------------------------------
if (OrderType() == OP_SELL) { 
      if( Stochast_1<25 && Stochast_0>25)    {
                 OrderClose(OrderTicket(),OrderLots(),Ask,3,Green); // закрываем позицию
                // return(0); // выходим
                }       
     }  
 //-------------------------------------------------------                       
    }  // Symbol()  
  } // select
 } //total
} //Close_
 
rid >> :

I'm not really an expert on this.

But the assumption is that if after the 1st signal you 'hang' the flag, then let it hang.

Even if the 1st signal is already exhausted!

Then the 2nd signal will give a signal to open without any problem.

If I understand the question correctly...



if the second signal comes after the first one, ..... and only so, but... maybe by checking the 2nd signal to open the 1st signal will already turn from false to true then it will be necessary to finish the calculation of the 2nd signal, and proceed to the passage of the first signal !

 
rid >> :

Is that where you ask about closure? Look here.

'Closing positions. On a signal from an indicator.'

//------------------------

I, in my time, got into this subject there.

But in that code, which you posted - it's hard to understand there and I don't see the section on closing at all.

Well, it's not there, .... I can't get the number of an open order to close the order, it keeps giving me an error... even if the number is found through other functions.

 

Look above. I added an example there.

Only instead of MagicNum you insert your mn

In external parameters add

extern bool AutoClose = true;

 
rid >> :

Only instead of MagicNum you insert your mn

In the external parameters add

extern bool AutoClose = true;

>> >> yeah yeah thanks, I got it.)

 
Infinity >> :

Well, it's not there, .... I can't get the number of an open order to close it, it keeps showing an error... even if the number is found through other functions.

Try to select the order by position: the function gives a ticket t position of the order in the list of the trading orders.

int Select_POS(int t)
{//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if(OrderSelect( t, SELECT_BY_POS, MODE_TRADES)) TIC[ t]=OrderTicket();
else TIC[ t]=-1;
return( TIC[ t]);
}//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
t = OrdersTotal() and decrease with each order processed.
 
Urain >> :

Try selecting an order by position: the function gives the ticket t position of the order in the list of trade orders.

t = OrdersTotal() and decrease with each processed order.


Thanks for the help! that would probably work too!!! I'll be sure to check it out!

The closing code worked.... Everything works now, the problem was really with the definition of the open order. Thanks again everyone!