Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 841

 
MiroshA:
Thanks for the reply, but I meant what mql4 functions can implement this?
Different ones. Depending on the algorithm you decide to develop.
 

Hello. My Expert Advisor is attached to many windows of currency pairs and buys at the most probable pullbacks. I use global variables for exchange of information between running copies of the EA. the data is updated every second. I had a thought to save all this information in a file, but I didn't do it because it would recourse to flash drive too often.

I can't really think of a way around this, the only way is to set each currency to a specific number by default and use the same global variables for example 01023334455 where 01 is USD, 02 is EUR, 3, 4, 5 is the data for the exchange.

 
pycha:

Hello. My Expert Advisor is attached to a lot of currency pair windows and buys at the most probable pullbacks. I use global variables for exchange of information between running copies of the EA. the data is updated every second. I had a thought to save all this information in a file, but I didn't do it because it would recourse to flash drive too often.

I can't really think of a way around this, the only way is to set each currency to a specific number by default and use the same global variables for example 01023334455 where 01 is USD, 02 is EUR, 3, 4, 5 is the data for the exchange.

What about the symbol in the variable name? Accordingly, if there is such a GV variable ... ...and it is possible to store a value in it. In this way, we have 1 variable, which serves 2 purposes.

 

I just want the software to be more universal. in this way you can put 01 -usd , 02 eur in a file and when you open the usdaud window it will find that aud is not on the list and will give it the number 03, saving information in the file. in this way i don't need to recompile the software every time i open a new currency which has not been tried

 
AlexeyVik:

But what about inserting a symbol into a variable name? Correspondingly, if there is such a GV variable ... ...and a value can be written into it. So, we have 1 variable that serves 2 purposes.


I will explain why it doesn't work. Once a certain amount of time, the program deletes all its variables to remove unnecessary rubbish, if any. GV1 GV2 and so on until it runs out. so if there is a variable created by another copy of the program, it will also be deleted, and they are restored after 1 second. and if I name a variable by a symbol, I have to go through all possible symbol variations to remove all.



My question is - are there any other tricks besides GV - variables that allow you to pass data from one instance of a program to another through the operating system?

 
pycha:

I just want the software to be more universal. in this way you can put 01 -usd , 02 eur in a file and when you open the usdaud window it will find that aud is not on the list and will give it the number 03, saving information in the file. in this way i don't need to recompile the software every time i open a new currency which has not been tried


Why do I need to reassign it? There is a list of symbols. It is independent of sorting. It turns out that you can find the symbol number in the list and use it.
 
OK, thank you all
 
pycha:

I will explain why it does not work. once for a certain amount of time the program deletes all its variables to remove unnecessary rubbish if any. GV1 GV2 and so on until it runs out. thus, if there is a variable created by another copy of the program it will also be deleted, and they are restored after 1 second. and if you make a variable name by a symbol, you have to go through all possible symbol variations to remove all .



My question is - are there any other tricks besides GV - variables which allow to transfer data from one copy of the program to another via RAM?

Well then try to make a structure in a library, fill and read from there.
 

Good evening! Help me understand the code below, sell is written on the same principle, why three options to open, because I had to fiddle with the option to avoid opening an order then - when the order opens on the current bar and closes on a no draw,

and the signal remains and opens again, so I have had to write it like this. The problem is that only one buy and sell order is opened and all else is silent. I am grateful in advance.

//+------------------------------------------------------------------+
//| Open Order Buy                                                   |
//+------------------------------------------------------------------+
if (!OrdersTotal()==true)
{
if (PLO0>S0 && PLO1<=S1 && PLO2<S2)
if (!OrdersHistoryTotal()==true)
{
ticket=OrderSend(Symbol(),OP_BUY,Lot,Ask,3,StopLossBuy,0,NULL,0,0,clrGreen);
RefreshRates();
{
if(ticket<0)
{
Print("OrderSend OP_BUY завершилась с ошибкой #",GetLastError());
}
else
Print("Функция OrderSend OP_BUY успешно выполнена");
}
}
if (OrdersHistoryTotal()==true)
if(OrderSelect(ticket,SELECT_BY_TICKET)>0 && OrderCloseTime()>0 && OrderType()==OP_BUY && OrderSymbol()==Symbol()&& PLO0>S0 && PLO1<=S1 && PLO2<S2 && OrderCloseTime()< Time[0])
{
ticket=OrderSend(Symbol(),OP_BUY,Lot,Ask,3,StopLossBuy,0,NULL,0,0,clrGreen);
RefreshRates();
{
if(ticket<0)
{
Print("OrderSend OP_BUY завершилась с ошибкой #",GetLastError());
}
else
Print("Функция OrderSend OP_BUY успешно выполнена");
}
}
if (OrdersHistoryTotal()==true)
if(OrderSelect(ticket,SELECT_BY_TICKET)>0 && OrderCloseTime()>0 && !OrderType()==OP_BUY && OrderSymbol()==Symbol()&& PLO0>S0 && PLO1<=S1 && PLO2<S2)
{
ticket=OrderSend(Symbol(),OP_BUY,Lot,Ask,3,StopLossBuy,0,NULL,0,0,clrGreen);
RefreshRates();
{
if(ticket<0)
{
Print("OrderSend OP_BUY завершилась с ошибкой #",GetLastError());
}
else
Print("Функция OrderSend OP_BUY успешно выполнена");
}
}
}
 

OrderClose(OrderTicket(),0.01,Bid,2);

in "experts" it says "invalid ticket for OrderClose function".

Help? my goal is to close order on current chart.