[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 367

 
shljachov:
but the number it returns is not compared to 1 or 2 (a normal integer)
TimeSeconds returns the number of seconds elapsed since the start of the minute for the specified time. So the function will return an integer number.
 
paladin80:
Please, clarify. Do you mean one market position opened or one pending order? In either case, we need to check if there is a position/order in the market, and if there is, then before we set an order, we need to return(0).

For example, I opened a Buy position using the following condition OPEN[0]> OPEN[3] and closed TakeProfit. After the order is closed, the Buy position is still active, so the Expert Advisor will open another Buy position. I need to avoid opening more orders when TakeProfit is reached. I mean 1 market order not a pending order!

 
lowech:

For example, I opened a Buy position using the following condition OPEN[0]> OPEN[3] and closed TakeProfit. After the order is closed, the Buy position is still active, so the Expert Advisor will open another Buy position. I need to avoid opening more orders when TakeProfit is reached. I mean 1 market order, not a pending order!

Put such a piece of code before the position opening condition:

if (OrdersTotal()>0) //находит общее кол-во позиций/ордеров
{  for (int i=OrdersTotal()-1; i>=0; i--) // их перебор
   {  if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) // перебирает только среди позиций
      {  if (OrderSymbol()!=Symbol()) continue; // перебирает только позиции по тому символу
                                                // на чей график кинули советник
         if (OrderTicket()>0) return(0); // если обнаружена позиция - конец действия программы
}  }  }
 
paladin80:

Put this piece of code before the position opening condition:


Thank you very much! Let's try it!

I tried it! It still opens a bunch of orders! Is there any way to make TakeProfit expert to be disabled when the order is closed?

 
lowech:

Thank you very much! Let's try it!

I tried it! It still opens a bunch of orders! Is there any way to disable TakeProfit Expert Advisor when an order is closed?

If you are correct in putting this piece of code before the condition of position opening, your EA should not open more than 1 position for this currency. As for disabling the EA after TakeProfit - there is no need to disable it. It is better to do the right code right away.
 
paladin80:
If you are correct in putting this piece of code before the condition of position opening, your Expert Advisor obviously should not open more than 1 position for a given currency. As for disabling the EA after TakeProfit - there is no need to disable it. It's better to do the right code right away.

if(OrdersTotal()>0) //finds the total number of positions/orders

{  for (int i=OrdersTotal()-1; i>=0; i--) // их перебор
   {  if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) // перебирает только среди позиций
      {  if (OrderSymbol()!=Symbol()) continue; // перебирает только позиции по тому символу
                                                // на чей график кинули советник
         if (OrderTicket()>0) return(0); // если обнаружена позиция - конец действия программы 
}  }  }

This code, as I understand it, is looking for open positions! My problem is that the EA opens order after order, not in a row, and after the previous order closes TakeProfit or StopLoss, the position will open again and only 1 order !

 
lowech:

if(OrdersTotal()>0) //finds the total number of positions/orders

This code, as I understand it, is looking for open positions! My problem is that the EA opens order after order, not in a row, and after the previous order closes TakeProfit or StopLoss, the position will be open again and only 1 order !

Have I understood the algorithm correctly?
After the entry condition is triggered, only one position is opened. If it closes on profit or loss, do not trade on the day it closed. By the way, do you trade on one symbol or several?
I do not know about the disabling of the EA because I do not use it, maybe someone who knows here will write whether it is possible.
 
The SendFTP function sends a text file to the server. But on the server the file is empty - 0 KB. What could be the problem?
 
serler2:
The SendFTP function sends a text file to the server. But on the server the file is empty - 0 KB. What could be the problem?
And on the client?
 
Reshetov:
And on the client?

I've tried many options. Both picture and text and stats. All come with zero volume. On the local computer, of course, the files are not empty.

Reason: