Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Hello,
I open the order based on Richard Donchian 4 weeks high/low on weekly chart
Can I place buy/sell stop entry order?
or how to place order at exact the breakout point, which can be used for back test.
Any sample code?
I used Bid/Ask price comparing to 4 weeks high/low to determine the break out point.
However, I got lots of order close error 131 during EA test.
Here pasted my code:
if((Bid <= prev_low))
{
res=OrderSend(Symbol(),OP_SELL,LotsOptimized(),Bid,3,0,0,"",MAGICMA,0,Red);
return;
}
//--- buy conditions, prev_high is the previous 4 weeks high
if((Ask>=prev_high))
{
res=OrderSend(Symbol(),OP_BUY,LotsOptimized(),Ask,3,0,0,"",MAGICMA,0,Blue);
return;
}
Thanks,
Albert