@luisneves:
1> I don't see any lotsize specified. Make sure the lotsize is not zero.
2> Are you copy & pasting codes from the book?
-if you are, I strongly recommend that you don't.
-You need to understand why you're doing something.
@luisneves:
1> I don't see any lotsize specified. Make sure the lotsize is not zero.
2> Are you copy & pasting codes from the book?
-if you are, I strongly recommend that you don't.
-You need to understand why you're doing something.
Hi ubzen,
Thank you for your attention to my issue.
Regarding your first observation are you say that Lotsize should be FixedLotSize as below ?
extern double FixedLotSize = 0.01;
and then,
LotSize = MathFloor(FixedLotSize/lotstep) * lotstep;
Regarding your second observation, am not copy paste from the book, tol this moment I've received support from several people and going from there trial and error and so on.
Last from your third observation, this is the way that am seen the code;
When an order open the code look for the orders that are from the ea making use of filters for symbol and magic number and last for order type.
If order type is a buy, then put an pending order below the open of the buy order by OppositeDistance, which in this case is as,
extern int OppositeDistance = 2;
Mlots is the last lot encountered by the third block of code make use of filters for symbol and magic number.
As understood so far an pending order in this case an OP_SELLSTOP (only one) should open, but it hasn't. Of course that something is wrong and that's why I appreciate help here.
I'm learning from the results that I get from testing and then discussing that behaviour with people.
Best regards
Luis
In that case make extensive use of the Print(), Alert() and Comment().
- Solve the problem with the error message you're getting first.
- Before your OrderSend(...) command for the hedge order. Print the OrderLots.
RefreshRates(); Print("MLots="+MLots); SellTicket = OrderSend(...);
In that case make extensive use of the Print(), Alert() and Comment().
- Solve the problem with the error message you're getting first.
- Before your OrderSend(...) command for the hedge order. Print the OrderLots.
Hi ubzen,
Thank you for time spent in support me.
So, as per your advise I've done the print and the result is as follow,
2013.04.09 12:53:35 2012.08.13 23:32 market_order_ecn_80_800_v7_v3 EURUSDi,M1: Opposite Sell Order Placed: Order Ticket: 2 Spread: 1.00000 Open Price: 1.23323 2013.04.09 12:53:35 2012.08.13 23:32 market_order_ecn_80_800_v7_v3 EURUSDi,M1: modify #2 sell stop 0.03 EURUSDi at 1.23343 sl: 1.23843 tp: 1.22843 ok 2013.04.09 12:53:35 2012.08.13 23:32 market_order_ecn_80_800_v7_v3 EURUSDi,M1: open #2 sell stop 0.03 EURUSDi at 1.23323 ok 2013.04.09 12:53:35 2012.08.13 23:32 market_order_ecn_80_800_v7_v3 EURUSDi,M1: MLots=0.03000000 2013.04.09 12:53:19 2012.08.13 23:32 market_order_ecn_80_800_v7_v3 EURUSDi,M1: Open Opposite Order - Bid: 1.23342 Open Price: 1.23342 Ticket: -1 Spread: 1.00000 Lots: 0 Stop Level: 0 Freeze Level: 0 2013.04.09 12:53:19 2012.08.13 23:32 market_order_ecn_80_800_v7_v3 EURUSDi,M1: Alert: Open Opposite Order - Opposite Sell Failed: 4051: invalid function parameter value 2013.04.09 12:53:19 2012.08.13 23:32 stdlib EURUSDi,M1: loaded successfully
In fact on tester I see the pending order (arrow), but seems that multiple orders are keeping getting open.
For sure that the reason could be seen from the log above, but I can't see where...
Luis
Hi ubzen,
Thank you for time spent in support me.
So, as per your advise I've done the print and the result is as follow,
In fact on tester I see the pending order (arrow), but seems that multiple orders are keeping getting open.
For sure that the reason could be seen from the log above, but I can't see where...
Luis
Lots: 0
Hi RaptorUK,
Thank you for your point of "view". Definitely I'm in need for a pair of glasses....
Nevertheless I can't see how Lots (MLots) could be 0 if MLots come from the initial lots which was present in the first buy order and now is LastLot times multiplier...
And if I make use of OP_SELL instead of OP_SELLSTOP MlLots is ok.
Any help, please.
Luis
@luisneves: I strongly recommend going through the book chapter by chapter. As always, I don't recommend coding by trial and error.
1st> Your codes are hard to read because allot of the code is hidden.
2nd> I'm not asking you to paste your entire system here, however, that means you'll have to detect most of your errors and solve them.
3rd> The reason you could be getting Lots=0 is because of this:
MLots = 0;
_________
_________
return(0);
- You set MLots to Zero. And then you return Zero. Is that thing returning from a function? I cannot tell.
4> I recommend re-writing your codes in smaller functions because de-bugging like this will cost you allot of time.
Hi RaptorUK,
Thank you for your point of "view". Definitely I'm in need for a pair of glasses....
Nevertheless I can't see how Lots (MLots) could be 0 if MLots come from the initial lots which was present in the first buy order and now is LastLot times multiplier...
And if I make use of OP_SELL instead of OP_SELLSTOP MlLots is ok.
Any help, please.
Luis

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi all,
I'm looking to put a pending order opposite to a buy already open. For that I though to make use if this code. Nevertheless is not working as expected.
Also I receive the error Invalid lots amount for OrderSend function.
Could you show me the right way to do it ?
This is the code to get the LotSize,
This is the code to get the first order open
Here is the code to get MLots,
Here is the code to get the pending order
Thank you in advance for help provided.
Luis