Spinn: I have no idea what causes it.
|
|
whroeder1:
I realize now that I should have added the complete loop. Sorry. Updated the original post.
|
Spinn:
I realize now that I should have added the complete loop. Sorry. Updated the original post.
Are you joking ? There is not even an OrderSend() in your code.
I realize now that I should have added the complete loop. Sorry. Updated the original post.
You were absolutely right, Mr. Alain.
Somehow part of my code did not get copied over. Brainfart, I guess. :s
I corrected it (again, sigh)
Fixed it !
Had a problem with the expiry time
Spinn: I realize now that I should have added the complete loop. Sorry. Updated the original post.
if (OrderType() > 1) expiry = TimeCurrent() + (PendingExpiryMinutes * 60);
You can not use any Trade Functions until you select an order.RefreshRates(); if (type == OP_BUY) price = MarketInfo(symbol, MODE_ASK); if (type == OP_SELL) price = MarketInfo(symbol, MODE_BID); while(IsTradeContextBusy()) Sleep(100);//Put here so that excess slippage will cancel the trade if the ea has to wait for some time.
If you sleep price may not be valid. Sleep, RefreshRates, then get price.if (ticket < 0){ : " Bid = ", DoubleToStr(Bid, Digits), ...
This prints the values you had before the OrderSend. Server calls take time, up to minutes during news releases. You must RefreshRates after server calls.- What is the purpose of the loop, when you break on success and return on the first failure?
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
Hello world :)
EDIT: I added the complete loop (should have done that right away, apologies)
I have a few MT4-coding miles on my counter but I bumped into an error that I simply cannot seem to correct.
I have an EA that opens orders with a loop
It obviously gets all the inputs it needs and then needs to open the trade.
I do however run into this error 3 that pops up every few seconds. (see screenshot)
I have no idea what causes it. For debugging purposes I print all the values a BUYSTOP takes. The price at which the EA wants to open a position is clearly above the Ask, so I don't see what's wrong.
Does anyone have an idea why it errors out ??
All help welcome. Thanks in advance !!