[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 370
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I have done as you advised.
datetime LastTime;
datetime Pause=3600;
int start()
{
if(TimeCurrent()<LastTime+Pause)return(0);
...
bool cl() {if(OrderSelect(0,SELECT_BY_POS)==true){ int t=OrderType();
double l=OrderLots();
int tik=OrderTicket();Alert("tik=", tik);
}
if (t==OP_BUY) OrderClose(tik,l,Bid,3,Red);
if (t==OP_SELL) OrderClose(tik,l,Ask,3,Green);
LastTime=TimeCurrent();
}
But in the Strategy Tester, the order opens in accordance with the conditions, but it does not react to time.
In addition, the tester does not react to the parameter "time of existence of the pending order", i.e. it is not deleted when it is time to delete it.
Is it supposed to be like that?
How can we make the tester consider the time passed since the order was closed?
Secondly, it is not very nice to assign value to global variable in some obscure function, you have two ways out, either by passing by reference, or as long as you function returns value of Boolean type, then if it completed successfully, you can assign value to global variable, of course variables for if too it is alerting, but it's your business .... but that's just a saying))) It's not clear from your code when this function is called and whether it is called at all. Try to check the results in the log file and you will understand.Here's the full code, I've removed all the functions, declared the variables as it should be, but the result is the same - in the test mode, it doesn't react to time, it places extra orders on the same bar.
What does it need?
double q0=0;
double q1=0;
double q2=0;
double q3=0;
datetime LastTime;
datetime Pause=3600;
int typ, tik;
double l;
int start()
{
datetime t=Hour();
if (t==8) {q0=0; q1=0; q2=0; q3=0;}
if (t>=9) {
int i0=0;
while (q0==0) { q0=iCustom(NULL,0, "MorningFlat_V3",0,15,8,45,161.8,Turquoise,Red,Gold, Silver,0,i0); i0++; }
int i1=0;
while (q1==0) { q1=iCustom(NULL,0, "MorningFlat_V3",0,15,8,45,161.8,Turquoise,Red,Gold, Silver,1,i1); i1++; }
int i2=0;
while (q2==0) { q2=iCustom(NULL,0, "MorningFlat_V3",0,15,8,45,161.8,Turquoise,Red,Gold, Silver,2,i2); i2++; }
int i3=0;
while (q3==0) { q3=iCustom(NULL,0, "MorningFlat_V3",0,15,8,45,161.8,Turquoise,Red,Gold, Silver,3,i3); i3++; }
Comment("g0=",q0, "\n", "g1=",q1, "\n", "g2=",q2, "\n", "g3=",q3 ); }
double os0=iOsMA(NULL,0,5,26,9,4,0);
double os1=iOsMA(NULL,0,5,26,9,4,1);
// see from here
if(TimeCurrent()<(LastTime+Pause))return(0);
if ( OrdersTotal()==0) { if (Bid>q0 && t>=9 && t<=20 && os1>0) OrderSend(Symbol(),OP_BUY,0.1,Ask,3,(Bid-30*Point),0,"__",555,0,Red );
if (Ask<q1 && t>=9 && t<=20 && os1<0) OrderSend(Symbol(),OP_SELL,0.1,Bid,3,(Ask+30*Point),0,"__",444,0,Green);}
if (OrdersTotal()==1) {OrderSelect(0,SELECT_BY_POS);
typ=OrderType();
tik=OrderTicket();
l=OrderLots();
if (typ==OP_BUY && os1<0) { LastTime=TimeCurrent(); OrderClose(tik,l,Bid,3,Red);}
if (typ==OP_SELL && os1>0) { LastTime=TimeCurrent();OrderClose(tik,l,Ask,3,Green);}
}
return(0);
}
//+------------------------------------------------------------------+
Hello.
Question for the experts
The situation is the following: the Expert Advisor is hanging on the demo account, the quotes pass, the prices change, but the Expert Advisor has stopped trading since some time, an error is generated in the log :
2009/12/30 16:46:06 --- Fynktsia put_BUYSTOP_tsina_vhdn_par: pomulka vunuknyla pru vukonanni koda OrderSend() -- Error code = 136. No prices
2009.12.30 16:46:06 --- Fynktsia put_BUYSTOP_tsina_vhdn_par: pomulka vunuknyla pru vukonanni koda OrderSend() -- Error code = 136. No prices
2009.12.30 16:46:07 --- Fynktsia put_BUYSTOP_tsina_vhdn_par: pomulka vunuknyla pru vukonanni koda OrderSend() -- Error code = 136. No prices
2009.12.30 16:46:07 --- Fynktsia put_BUYSTOP_tsina_vhdn_par: pomulka vunuknyla pru vukonanni koda OrderSend() -- Error code = 136. No prices
2009.12.30 16:46:08 --- Fynktsia put_BUYSTOP_tsina_vhdn_par: pomulka vunuknyla pru vukonanni koda OrderSend() -- Error code = 136. No prices
2009.12.30 16:46:09 --- Fynktsia put_BUYSTOP_tsina_vhdn_par: pomulka vunuknyla pru vukonanni koda OrderSend() -- Error code = 136. No prices
2009.12.30 16:46:09 --- Fynktsia put_BUYSTOP_tsina_vhdn_par: pomulka vunuknyla pru vukonanni koda OrderSend() -- Error code = 136. No prices
2009.12.30 16:46:10 --- Fynktsia put_BUYSTOP_tsina_vhdn_par: pomulka vunuknyla pru vukonanni koda OrderSend() -- Error code = 136. No prices
2009.12.30 16:46:10 --- Fynktsia put_BUYSTOP_tsina_vhdn_par: pomulka vunuknyla pru vukonanni koda OrderSend() -- Error code = 136. No prices
2009.12.30 16:46:11 --- Fynktsia put_BUYSTOP_tsina_vhdn_par: pomulka vunuknyla pru vukonanni koda OrderSend() -- Error code = 136. No prices
2009.12.30 16:46:11 --- Fynktsia put_BUYSTOP_tsina_vhdn_par: pomulka vunuknyla pru vukonanni koda OrderSend() -- Error code = 136. No prices
2009.12.30 16:46:12 --- Fynktsia put_BUYSTOP_tsina_vhdn_par: pomulka vunuknyla pru vukonanni koda OrderSend() -- Error code = 136. No prices
2009.12.30 16:46:13 --- Fynktsia put_BUYSTOP_tsina_vhdn_par: pomulka vunuknyla pru vukonanni koda OrderSend() -- Error code = 136. No price
Pair - USDCAD
Started on 2009.12.30 16:46:06 and stopped on
2009.12.30 17:29:58 --- Fynktsia put_BUYSTOP_tsina_vhdn_par: pomulka vunuknyla pru vukonanni koda OrderSend() -- Error code = 128. Waiting time for transaction expired
Agree 43 minutes is significant, what's worse it messes up the ekspert's algorithm.
Even more interesting is the error that appears when I try to send an OP_BUYSTOP order :-0 (what kind of quotes can there be for pending orders?)
136 NO PRICES = OFF QUOTES:
Why are there no prices if they are constantly changing on the screen?
The issue has been raised here https://www.mql5.com/ru/forum/105903/page2 by a respected goldtrader, but has not been officially resolved (I hope this issue is not a kind of TABO that we don't want to discuss in plain view)
I'd like to know "why this is" and "how to prevent or handle this kind of errors".
I hope it is not a TABOO that people do not want to discuss in public). Thanks in advance for the reply.
Hello.
Question for experts -
The situation is the following: Expert Advisor on a demo account, quotes are passed, prices change, but Expert Advisor has stopped trading for some time, the error is generated in the log :
2009.12.30 16:46:06 --- Fynktsia put_BUYSTOP_tsina_vhdn_par: pomulka vunuknyla pru vukonanni koda OrderSend() -- Error code = 136. No prices
2009.12.30 16:46:06 --- Fynktsia put_BUYSTOP_tsina_vhdn_par: pomulka vunuknyla pru vukonanni koda OrderSend() -- Error code = 136. No prices
2009.12.30 16:46:07 --- Fynktsia put_BUYSTOP_tsina_vhdn_par: pomulka vunuknyla pru vukonanni koda OrderSend() -- Error code = 136. No prices
2009.12.30 16:46:07 --- Fynktsia put_BUYSTOP_tsina_vhdn_par: pomulka vunuknyla pru vukonanni koda OrderSend() -- Error code = 136. No prices
2009.12.30 16:46:08 --- Fynktsia put_BUYSTOP_tsina_vhdn_par: pomulka vunuknyla pru vukonanni koda OrderSend() -- Error code = 136. No prices
2009.12.30 16:46:09 --- Fynktsia put_BUYSTOP_tsina_vhdn_par: pomulka vunuknyla pru vukonanni koda OrderSend() -- Error code = 136. No prices
2009.12.30 16:46:09 --- Fynktsia put_BUYSTOP_tsina_vhdn_par: pomulka vunuknyla pru vukonanni koda OrderSend() -- Error code = 136. No prices
2009.12.30 16:46:10 --- Fynktsia put_BUYSTOP_tsina_vhdn_par: pomulka vunuknyla pru vukonanni koda OrderSend() -- Error code = 136. No prices
2009.12.30 16:46:10 --- Fynktsia put_BUYSTOP_tsina_vhdn_par: pomulka vunuknyla pru vukonanni koda OrderSend() -- Error code = 136. No prices
2009.12.30 16:46:11 --- Fynktsia put_BUYSTOP_tsina_vhdn_par: pomulka vunuknyla pru vukonanni koda OrderSend() -- Error code = 136. No prices
2009.12.30 16:46:11 --- Fynktsia put_BUYSTOP_tsina_vhdn_par: pomulka vunuknyla pru vukonanni koda OrderSend() -- Error code = 136. No prices
2009.12.30 16:46:12 --- Fynktsia put_BUYSTOP_tsina_vhdn_par: pomulka vunuknyla pru vukonanni koda OrderSend() -- Error code = 136. No prices
2009.12.30 16:46:13 --- Fynktsia put_BUYSTOP_tsina_vhdn_par: pomulka vunuknyla pru vukonanni koda OrderSend() -- Error code = 136. No price
Pair - USDCAD
Error started on 2009.12.30 16:46:06 and stopped on
2009.12.30 17:29:58 --- Fynktsia put_BUYSTOP_tsina_vhdn_par: pomulka vunuknyla pru vukonanni koda OrderSend() -- Error code = 128. Waiting time for transaction expired
You should agree that 43 minutes is a considerable time; what's worse, it spoils the algorithm of the Expert Advisor.
Even more interesting is the error that appears when trying to send an OP_BUYSTOP order :-0 (what kind of quotes can there be for pending orders?)
136 NO PRICES = OFF QUOTES:
Why no prices if on the screen they are constantly changing ?
The issue has been raised here https://www.mql5.com/ru/forum/105903/page2 by a respected goldtrader, but has not been officially resolved (I hope this is not a kind of TABU issue that you don't want to discuss in plain view)
I would like to know "why" and "how to prevent or handle this kind of errors".
what is the platform revision?
It's been discussed more than once about different data streams. For automated trading, the flow has closed. Apparently.
136 NO PRICES = OFF QUOTES:
This often happens before the news comes out. There is nothing you can do, unless you place an order in advance and pull it behind the price as long as possible. 43 minutes is too long.
Here's the full code, removed all functions, declared variables as needed, but the result is the same - in test mode it doesn't react to time, makes extra orders on the same bar.
The question was about a pause after the close. There will be a pause after the close.
-
There are several openings on one bar. After an open you should memorize the time of the bar and before an open you should check that the time of the bar is not equal to the time of the last open. It is better to use GlobalVariable to remember this time.
-
In all while it would be a good idea to add while (q0==0 && i<Bars).
-
LastTime=TimeCurrent(); - better to do this after checking if the order has really closed: if(OrderClose(...))LastTime=TimeCurrent();
The question was about a pause after closing time. There will be a pause after closing.
-
Multiple openings on the same bar. After opening it is necessary to remember bar time, and before opening check that bar time is not equal to the time of the last opening. It is better to use GlobalVariable to remember this time.
-
In all while it would be a good idea to add while (q0==0 && i<Bars).
-
LastTime=TimeCurrent(); - better to do this after checking if the order has really closed: if(OrderClose(...))LastTime=TimeCurrent();
From the tutorial - a GV variable can only have the double type - how should we put the number of seconds there then?
I have checked if an order has been closed, but it still fails and we still get an error.
if(Time[0]<(LastTime+Pause))return(0);
if ((OrdersTotal()==0) { if (Bid>q0 && t>=9 && t<=20 && os1>0) OrderSend(Symbol(),OP_BUY,0.1,Ask,3,(Bid-30*Point),0,"__",555,0,Red );
if (Ask<q1 && t>=9 && t<=20 && os1<0) OrderSend(Symbol(),OP_SELL,0.1,Bid,3,(Ask+30*Point),0,"__",444,0,Green);}
if (OrdersTotal()==1) {OrderSelect(0,SELECT_BY_POS;)
typ=OrderType();
tik=OrderTicket();
l=OrderLots();
if (typ==OP_BUY && os1<0) if (OrderClose(tik,l,Bid,3,Red)) LastTime=Time[0];
if (typ==OP_SELL && os1>0) if (OrderClose(tik,l,Ask,3,Green)) LastTime=Time[0];
}
Could you give us an example or a link where the task of delaying the opening of the next order by one hour after the previous one has been successfully implemented?
From the textbook - a GV variable can only have the type double - then how do you put the number of seconds in it?
Ahhhh, then forget everything and have a happy new year!
Happy New Year to all!
I was working with one indicator, everything was fine, then when I switch timeframe the terminal started to freeze, I reinstall Windows, it still freezes. Why(((((((((((((
The indicator light should probably be thrown out. Or ask Father Christmas. It's New Year's Eve.