No, about bicycles does not fit. I need to make a time correction - the difference between the time zones of two different terminals. It's a matter of hours. I'll look for the glitch myself.
Aleksander: at start - call the function to check if there is a buy order in the SellStop order loop... and remove it - if there is no buy order amongst the open orders...
I don't understand the phrase " Buy order is present in the SellStop order loop " .
The order open time is the sixth parameter in the line. It was read into the datetime type variable by the commands:
Stroka=FileReadString(FileHandle);// Open time r_master_OpenTime[i]=StrToTime(Stroka);// Opening time
As a result, we got a God knows what value in variable r_master_OpenTime[i]. But as soon as I changed its type from datetime to int, everything is ok. I've been programming with mql4 for more than five years, and I still can't stop wondering... :)
- If it is a SellStop (remember its magic number - it is also a buy order ticket {
via
The bool OrderSelect(
int index, int select, int pool=MODE_TRADES)
we check whether the order exists... - this is your buy order...
if it is not there - then delete the current SellStop order
}
End of order loop...
I wrote this nonsense
int i, k=OrdersTotal();
for (i=0; i<k; i++)
if(OrderType()==OP_SELLSTOP)
if(OrderMagicNumber()==ticket)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
if(OrderType()==OP_BUY)return(-1);
else
OrderDelete(OrderTicket());
The order open time is the sixth parameter in the string. It was read into the variable of datetime type by commands:
Stroka=FileReadString(FileHandlе);// Время открытия
r_master_OpenTime[i]=StrToTime(Stroka);// Время открытия
As a result, the r_master_OpenTime[i] variable would contain an unimportant value. But as soon as I changed its type from datetime to int, everything is ok. I've been programming with mql4 for more than five years, and I still can't stop wondering... :)
I have tried to write an indicator, it seems to work, but only on the history it draws as planned and then when new quotes come in it draws a usual mask.
The code is attached:
int start() { int counted_bars=IndicatorCounted(); int i,n; double Stark=0; //---- i=Bars-counted_bars-1;//+50; // n=Bars-counted_bars-1; while(i>=0) { //----
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.
InitsializeRealMasterOrders -- look for a fault here.
And here's another thing -- so as not to make bicycles -- https://docs.mql4.com/ru/convert/timetostr
at start - call the function to check if there is a buy order in the SellStop order loop... and remove it - if there is no buy order amongst the open orders...
see...
Round robin of set orders (start)
we take the order
- If it is a SellStop (remember its magic number - it is also a buy order ticket {
via
we check whether the order exists... - this is your buy order...
If it is not there, then we delete the current SellStop order
}
} End of order loop...
InitsializeRealMasterOrders -- look for a fault here.
And here's something else - not to make a bicycle - https://docs.mql4.com/ru/convert/timetostr
Still a glitch. In the subroutine the code reads data from the lines of the text document:
4;NZDUSD;98537467;1;0.5;1340809155;0;0.7881;0;0.7939;0;0
4;NZDUSD;98537450;1;0.5;1340809147;0;0.788;0;0.7939;0.787;0
The order open time is the sixth parameter in the line. It was read into the datetime type variable by the commands:
Stroka=FileReadString(FileHandle);// Open time
r_master_OpenTime[i]=StrToTime(Stroka);// Opening time
As a result, we got a God knows what value in variable r_master_OpenTime[i]. But as soon as I changed its type from datetime to int, everything is ok. I've been programming with mql4 for more than five years, and I still can't stop wondering... :)
see...
Round robin of set orders (start)
we take the order
- If it is a SellStop (remember its magic number - it is also a buy order ticket {
via
we check whether the order exists... - this is your buy order...
if it is not there - then delete the current SellStop order
}
End of order loop...
I wrote this nonsense
drknn: Все равно глюк. В подпрограмме код считывает данные из строк текстового документа:
4;NZDUSD;98537467;1;0.5;1340809155;0;0.7881;0;0.7939;0;0
4;NZDUSD;98537450;1;0.5;1340809147;0;0.788;0;0.7939;0.787;0
The order open time is the sixth parameter in the string. It was read into the variable of datetime type by commands:
As a result, the r_master_OpenTime[i] variable would contain an unimportant value. But as soon as I changed its type from datetime to int, everything is ok. I've been programming with mql4 for more than five years, and I still can't stop wondering... :)
Please advise what to do if:
In the tester is working fine, all according to plan, but on the realsk does not open the transaction.
P.S. Really need some help, it's a matter of life or death
Good day to all.
I have tried to write an indicator, it seems to work, but only on the history it draws as planned and then when new quotes come in it draws a usual mask.
The code is attached:
int start()
{
int counted_bars=IndicatorCounted();
int i,n;
double Stark=0;
//----
i=Bars-counted_bars-1;//+50;
// n=Bars-counted_bars-1;
while(i>=0)
{
//----
double Ma=iMA(NULL,0,PerMa,Shift,MODE_EMA,PRICE_CLOSE,i);
//double Ma1=iMA(NULL,0,PerMa,Shift,MODE_EMA,PRICE_CLOSE,i+1);
if(Stark+Step*Point<Ma)Stark=Ma;
if(Stark-Step*Point>Ma)Stark=Ma;
ABuf[i]=Stark;
//----
i--;
}
return(0);
}
Please help me to fix it so it will keep drawing steps.
I would really appreciate it.
Gek.