thank you for the article.
very nice article, thanks for it, helped me a lot, are you in the ATC 2011???
Yes, it's true that the article does not dicsuss how to close positions in details, however, if you open a Sell position, once you open a Buy, the sell position is automatically closed.
Therefore, to close a Buy position, open a Sell; and to close a Sell position, open a Buy.
could you please show me, where the code that make it like that ? "..., if you open a Sell position, once you open a Buy, the sell position is automatically closed."
'coz in your example, you only put single order(sorry, i'm a total beginner) ;
//--- Putting all together
//--- send order
because i'm currently trying to make my EA like that, and i use PSAR as my indicator. i want my EA to buy and sell following the trend all along the time.
just can't figure the coding, how to make it auto close sell and then Open Buy(and also auto Close Buy and then Open Sell), each time PSAR draws the opposite dot.
I need help actually.
Currently i can manage the EA to open position when PSAR draw Opposite using
trade.PositionOpen(_Symbol, // symbol
ORDER_TYPE_BUY, // buy order
Money_M(), // lots to trade
Ask, // last ask price
0,//Ask - StopLoss, // Stop Loss
buystop,//Ask + TakeProfit, // Take Profit
the Problem is when i want to close my position only when the PSAR has Draw the opposite Dot.
I downloaded "my_first_ea.mq5" and tried to test it.
It coudn't place any trades.
Here are the type of errors:
2011.11.13 23:39:58 2011.11.01 14:20:00 Alert: The Sell order request could not be completed -error:4756 2011.11.13 23:39:58 2011.11.01 14:20:00 failed instant sell 1.00 EURUSD at 1.36833 sl: 1.37133 tp: 1.35833 [Invalid request]
same with buy orders
2011.11.13 23:39:56 2011.11.01 13:25:00 Alert: The Buy order request could not be completed -error:47562011.11.13 23:39:56 2011.11.01 13:25:00 failed instant buy 1.00 EURUSD at 1.37186 sl: 1.36886 tp: 1.38186 [Invalid request]
Any ideas about why is that?
You help appreciated, Thanks...
code looks great but when i try it I get this error
No trades are executed.
Could someone help fixing?
I asked the same question and no one replied.
I have found it.
It is a bug. You have to add a line of code
that line should be before the mrequest.action=... mrequest.price=... etc. lines.