If your code doesn't do what i should use the debugger to find out why and where:
Code debugging: https://www.metatrader5.com/en/metaeditor/help/development/debug
Error Handling and Logging in MQL5: https://www.mql5.com/en/articles/2041
Tracing, Debugging and Structural Analysis of Source Code, scroll down to: "Launching and Debuggin": https://www.mql5.com/en/articles/272
- www.metatrader5.com
If your code doesn't do what i should use the debugger to find out why and where:
Code debugging: https://www.metatrader5.com/en/metaeditor/help/development/debug
Error Handling and Logging in MQL5: https://www.mql5.com/en/articles/2041
Tracing, Debugging and Structural Analysis of Source Code, scroll down to: "Launching and Debuggin": https://www.mql5.com/en/articles/272
My Code is working normally and printing the values , but some of the values are not calculated as expected.
MT4:
-
Do not assume history has only closed orders.
OrderType() == 6, 7 in the history pool? - MQL4 programming forum #4 and #5 (2017) -
Do not assume history is ordered by date, it's not.
Could EA Really Live By Order_History Alone? (ubzen) - MQL4 programming forum (2012)
Taking the last profit and storing it in a variable | MQL4 - MQL4 programming forum #3 (2020) -
Total Profit is OrderProfit() + OrderSwap() + OrderCommission(). Some brokers don't use the Commission/Swap fields. Instead, they add balance entries. (Maybe related to Government required accounting/tax laws.)
"balance" orders in account history - Day Trading Techniques - MQL4 programming forum (2017)Broker History FXCM Commission - «TICKET»
Rollover - «TICKET»>R/O - 1,000 EUR/USD @0.52 #«ticket» N/A OANDA Balance update
Financing (Swap: One entry for all open orders.)
- 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 , i built this code trying to check the results of the EA's in my account based on their magic numbers. i loop through the trades from the oldest to the newest for each magic number and perform calculations in order to calculate values e0 , e1 ,e2 . i will share the code and then explain the problem.
in this code if the trades of EA with magic number = 1 , are as following from oldest to newest:
trade 1 : 1.5$
trade 2 : -1 $
trade 3 = 2.4
trade 4 = 1.5
e0 should return the total of the trades of each magic number and its working properly , so e0 = 1.5 + (-1) + 2.4 + 1.5
e1 should if the previous 2 trades ( shift 1 and 2 ) are negative then positive. if yes add the PL of current trade to e1. in this example: e1=1.5 , when loop reaches trade 4 it checks trade with shift 1 : 2.4(>0) and trade with shift 2:-1(<0) so its negative then positive trade.
in my EA its not returning the value of e1 correctly for unknown reasons. the same with e2 (e2 is positive then negative sequence)