Anybody know why this error occurs?
Not from the information you have supplied, no...
Hello Phy,
It's simply like that. But when MT4 preparing the test data, it produce numerous another error too, it's "TestGenerator: unmatched data error (volume limit 25 at 2007.12.10 22:25 exceeded)".
When I change the timeframe to 15 minutes or above, that error are still occurs but not as much as on 5 minutes timeframe.
When I remove the expiration parameter from the ordersend code, it's working fine on 5 minutes timeframe.
I'm using version 2.11, InterbankFX demo.
Any solution?
Thanks
It's simply like that. But when MT4 preparing the test data, it produce numerous another error too, it's "TestGenerator: unmatched data error (volume limit 25 at 2007.12.10 22:25 exceeded)".
When I change the timeframe to 15 minutes or above, that error are still occurs but not as much as on 5 minutes timeframe.
When I remove the expiration parameter from the ordersend code, it's working fine on 5 minutes timeframe.
I'm using version 2.11, InterbankFX demo.
Any solution?
Thanks
expire=TimeCurrent()+(Period()*60)-5;
Thank you Rosh, unfortunately it's still not working on 5 minutes tf.
Here is the complete code :
Here is the complete code :
//---- input parameters extern int TakeProfit = 12; extern double Lots = 0.1; int Gap = 25; int KeepLimitOrderFor=1; datetime Time0; //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- Time0=Time[0]; //---- return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { //---- if(Bars<100) { Print("bars less than 100"); return(0); } string comment="Test"; int spread=MarketInfo(Symbol(),MODE_SPREAD); int magic=12345; int expire=0; if(KeepLimitOrderFor>0) expire=TimeCurrent()+(KeepLimitOrderFor*Period()*60)-5; if(Time0!=Time[0]) { OrderSend(Symbol(),OP_BUYLIMIT,Lots,Open[0]-(Gap+spread)*Point,5,0,(Open[0]-(Gap+spread)*Point)+TakeProfit*Point,comment,magic,expire,SkyBlue); OrderSend(Symbol(),OP_SELLLIMIT,Lots,Open[0]+Gap*Point,5,0,(Open[0]-Gap*Point)-TakeProfit*Point,comment,magic,expire,Orange); Time0=Time[0]; } //---- return(0); } //+------------------------------------------------------------------+Something wrong with my code?
The expiration period should be more then 10 minutes! In other words:
int expirationPeriod=(KeepLimitOrderFor*Period()*60)-5; if (expirationPeriod<600) expirationPeriod=600; expire=TimeCurrent()+expirationPeriod;
I see..
Thanks a lot Rosh. That's something I really don't know.
Just a question, why 10 minutes?
Thanks a lot Rosh. That's something I really don't know.
Just a question, why 10 minutes?
why I can't see a chart?????? https://www.mql5.com/en/code/7060 help me??
no chart
Rosh:
The expiration period should be more then 10 minutes! In other words:
Oh one more. I'm usingThe expiration period should be more then 10 minutes! In other words:
int expirationPeriod=(KeepLimitOrderFor*Period()*60)-5; if (expirationPeriod<600) expirationPeriod=600; expire=TimeCurrent()+expirationPeriod;
int expire=0; if(KeepLimitOrderFor>0) expire=TimeCurrent()+(KeepLimitOrderFor*Period()*60)-5;is because, if KeepLimitOrderFor==0, the limit order will never expire.
Thanks
You're welcome.
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'm using this formula to calculate expiration time of my buy_limit order
so the buy limit order will expired at approximately 5 seconds before the candle ended.
It's working fine with 15 minutes timeframe and above, but when I test it on backtester, I receive numerous error messages : "GBPUSD,M5: OrderSend error 3"
Anybody know why this error occurs?
Thank you