extern int StopLoss_S = 10; // Stop Loss in points : if(Ask<=OpenPrice-((StopLoss_L)/100000)) { Print("Stoploss long"); OrderClose(Ticket,LotSize(),Bid,Slippage,Red); return(0); }Your code assumes a 5 digit broker, so you close the order at a 1 pip drop.
Thanks for the quick reply.
I work with a 5-digit broker though(Armada Markets), any other thoughts?
WHRoeder is right. 10 Points = 1 pip and hence if spread is more than 1 pip the trade will be immediately closed. There are few other issues in the code mostly due to confusing integer and floating point variables/calculations. Also, you close buy for Bid price and a sell for a Ask price. Attached corrected code.
Edit: Cool it works, very glad I can continue working on it, thanks again.
No prob. BTW: to convert points to correct decimal number instead of "StopLoss_L/100000.0" you can use "StopLoss_L*Point".
A general note on your EA idea: ticks in mt4 tester are randomly generated so your scalping EA's backtest performance should be ignored unless you base your EA on at least completed M1 bars or you feed the tester fxt file with correct ticks and achieve 99% tick modelling quality. Google "Birt 99%" to learn how to do it.
- 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 all,
I was trying to make a scalping EA, but I can't figure this thing out: It immediately closes all it's positions. Been looking over it for hours now, hope one of you can see it. I guess it has to do with the TP/SL. The reason I don't use the OrderSend function for that, is because my broker doesn't support it :/ So I thought to deal with it this way, but didn't worked out. Any questions? Shoot'em! Thanks in advance!
Obvious, my meaning is to open an order when desired Stochastic level is reached, and then work with a SL/TP goal.