OrderBuy();
bool OrderBuy(){
res=OrderSend(Symbol(), 0, NormalizeDouble(Lot,1), Ask, Slippage,
NormalizeDouble(Ask-StopLoss,4), NormalizeDouble(Ask+TakeProfit,4), 0, 0, 0, 0);
return(res);
res=OrderClose(Ticket, Lots, priceClose, Slippage, 0);
SelectOnlyOrder(0);
bool SelectOnlyOrder(int pos){
return OrderSelect(pos,SELECT_BY_POS,MODE_TRADES);
}
- Check your return codes What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
- All of them including OrderSend or your OrderBuy, OrderClose, OrderSelect or your SelectOnlyOrder.
What do you think Ask-StopLoss is? 1.01234 - 50 is a bogus price. Zero is not a valid string (comment.) Don't hard code constants, use the proper symbols extern double TakeProfit = 50;
extern double TrailingStop = 25 ;
extern double StopLoss = 50;
extern double MinProfit = 25;
extern double ProfitPoints;
extern int Slippage=2;
res=OrderSend(Symbol(), 0, NormalizeDouble(Lot,1), Ask, Slippage,
NormalizeDouble(Ask-StopLoss,4), NormalizeDouble(Ask+TakeProfit,4), 0, 0, 0, 0);Adjust for 4/5 digit brokers and JPY pairs, SL/TP and slippage. extern double TakeProfit = 50;
extern double TrailingStop = 25 ;
extern double StopLoss = 50;
extern double MinProfit = 25;
extern double ProfitPoints;
extern int Slippage=2;
double pip = StringFind(_Symbol,"JPY") < 0 ? 0.01 : 0.0001;
int slippage = Slippage * int(pip / _Point);
res=OrderSend(Symbol(), OP_BUY, NormalizeLots(Lot), Ask, slippage, Ask - StopLoss * pip, Ask + TakeProfit * pips, "", 0, 0, 0);- Do NOT use NormalizeDouble, EVER. For ANY Reason. It's a kludge, don't use it. It's use is always wrong
- SL/TP (stops) need to be normalized to tick size (not Point.) (On 5Digit Broker Stops are only allowed to be placed on full pip values. How to find out in mql? - MQL4 forum) and abide by the limits Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial and that requires understanding floating point equality Can price != price ? - MQL4 forum
- Open price for pending orders need to be adjusted. On Currencies, Point == TickSize, so you will get the same answer, but it won't work on Metals. So do it right: Trailing Bar Entry EA - MQL4 forum or Bid/Ask: (No Need) to use NormalizeDouble in OrderSend - MQL4 forum
- Lot size must also be adjusted to a multiple of LotStep. If that is not a power of 1/10 then NormalizeDouble is wrong. Do it right.
Thank you very much for your help. I will try to Implement your advices asap.
Could i ask another question to an EA ? In the attached EA i want to combine the iStochastic with the supersignal indicator. Basically i want to combine the two indicator so that a buy signal is send when an ArrowUp from the supersignals and the signal line from the stochastics occur. I tried it in the attached EA but i dont really see why it doesnt work. Sorry for the questions...im a total beginner !
I have to ad that the EA works with either one of the indicators. But somehow the EA opens hundreds of trades at the same time although the code says (as far as i can see) to just open one trade at a time. Maybe someone sees the mistake in the code immediately.
best regards
akuh
Thank you very much for your help. I will try to Implement your advices asap.
Could i ask another question to an EA ? In the attached EA i want to combine the iStochastic with the supersignal indicator. Basically i want to combine the two indicator so that a buy signal is send when an ArrowUp from the supersignals and the signal line from the stochastics occur. I tried it in the attached EA but i dont really see why it doesnt work. Sorry for the questions...im a total beginner !
I have to ad that the EA works with either one of the indicators. But somehow the EA opens hundreds of trades at the same time although the code says (as far as i can see) to just open one trade at a time. Maybe someone sees the mistake in the code immediately.
best regards
akuh

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello Everyone
Wehen i compile my ea there is a warning that there is a problem with OrderModify() but i cannot solve what the problem is ?!
I would appreciate if someone could take a look at it.
sincerely
akuh