Mickael Arditi: Could Someone help me understand please?
-
Why did you post your MT4 question in the
Root /
MT5 EA section
instead of the MQL4 section,
(bottom of the Root page?)
General rules and best pratices of the Forum. - General - MQL5 programming forum
Next time post in the correct place. The moderators will likely move this thread there soon. - Use the debugger or print out your variables, including _LastError and prices and find out why.
if(OrdersTotal()==0){ Lots= …
Using OrdersTotal directly and/or no Magic number filtering on your OrderSelect loop means your code is incompatible with every EA (including itself on other charts and manual trading.)
Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 and MetaTrader 4 - MQL4 programming forum
MagicNumber: "Magic" Identifier of the Order - MQL4 Articles
Mickael Arditi:
Hello, I'm trying to write an EA but I have a problem when I do a backtest.
It seems to work properly for a moment and then it does something that I really don't understand.
The problem:
It's in these parts:
if(NormalizeDouble(AmountB+AmountBS,2)<NormalizeDouble(AmountS+LotsRef,2)) { DeletePendB(); Lots=AmountS-AmountB+LotsRef; OpenPos=BS_Pos; Type=OP_BUYSTOP; OpenPend(); return(0); } if(NormalizeDouble(AmountS+AmountSS,2)<NormalizeDouble(AmountB+LotsRef,2)) { DeletePendS(); Lots=AmountB-AmountS+LotsRef; OpenPos=SS_Pos; Type=OP_SELLSTOP; OpenPend(); return(0); }
Because for comparison of doubles/floats, a difference of 0.000000000000000.................0000000000000000000001 makes a difference :)
Thank you for your quickly answers!
it work properly now and i've learned Something new =)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello, I'm trying to write an EA but I have a problem when I do a backtest.
It seems to work properly for a moment and then it does something that I really don't understand.
The problem:
2 15:22:04.133 2018.11.07 02:42:47 DoubleScalp(1.2) EURUSD,M5: open #352 sell stop 0.02 EURUSD at 1.14519 ok
2 15:22:04.180 2018.11.07 02:42:47 DoubleScalp(1.2) EURUSD,M5: delete #352 sell stop 0.02 EURUSD at 1.14519 sl: 0.00000 tp: 0.00000 ok
2 15:22:04.180 2018.11.07 02:42:47 DoubleScalp(1.2) EURUSD,M5: open #353 sell stop 0.02 EURUSD at 1.14519 ok
2 15:22:04.180 2018.11.07 02:42:47 DoubleScalp(1.2) EURUSD,M5: delete #353 sell stop 0.02 EURUSD at 1.14519 sl: 0.00000 tp: 0.00000 ok
2 15:22:04.180 2018.11.07 02:42:47 DoubleScalp(1.2) EURUSD,M5: open #354 sell stop 0.02 EURUSD at 1.14519 ok
2 15:22:04.180 2018.11.07 02:42:47 DoubleScalp(1.2) EURUSD,M5: delete #354 sell stop 0.02 EURUSD at 1.14519 sl: 0.00000 tp: 0.00000 ok
2 15:22:04.180 2018.11.07 02:42:47 DoubleScalp(1.2) EURUSD,M5: open #355 sell stop 0.02 EURUSD at 1.14519 ok
Could Someone help me understand please?
Best Regard, Mike.