[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 502
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
edit | delete Help to find a function for placing orders that takes slippage into account and without 130-134 errors.
Show me your variant.
Print(GetLastError());
With any values of SL and TP it gives out 134, it often doesn't place an order at all.
opens on condition if(NumberOfOrders(NULL)==0)
In the tester, instead of one order it always places a bunch, i.e. i can not understand why it should place an order if there are no other open orders on this pair
NumderOrder=OrderSend(Symbol(),OP_BUY,0.01,Ask,3,Ask-SL*Point,Ask+TP*Point, "BUY",0,0,Red);
Print(GetLastError());
With any values of SL and TP it gives out 134, it often doesn't place an order at all.
opens on condition if(NumberOfOrders(NULL)==0)
In the tester, instead of one order it always places a bunch, i.e. i can not understand why it should place an order if there are no other open orders on this pair
ERR_NOT_ENOUGH_MONEY 134 Not enough money to complete the transaction
Good day. I am making an EA, it opens 2 orders in a certain condition (figuratively speaking: when the price goes up and down). When the price goes up, it opens 2, when the price goes down, it closes those 2 and opens a new 2. One order goes without a take profit, the second order with a take profit. There is a problem with the second one. At the time when its time of death comes, it is not selected, here is the code to remove orders:
Same for OP_BUY. I'm comparing comments to know for sure it's an order opened by my EA and not manually or by another EA. Here's the problem with OrderSelect, it just doesn't want to select an order with a take profit. When it gets a to its number, OrderSelect returns false. There is no error in the tester log, GetLastError also says everything is fine (returns 0). Why is it not being selected? Why no error if it couldn't select it? Thank you all.
the condition
is checked at each iteration.
Think about what a equals and what OrdersTotal() -1 equals after the first iteration
OrderClose(OrderTicket(), NormalizeDouble(OrderLots(), Digits), NormalizeDouble(Ask, Digits), 0);
Solree:
NormalizeDouble(OrderLots(), Digits)
You need to take into account the allowable step of lot change.
For example, if the step is 0.01, then normalize by 2
and if the step is 0.1, then the normalization should be 1