Sounds like you have an integer rather than double somewhere or a calculation is casting to an integer.
https://docs.mql4.com/basis/types/casting
V
Sounds like you have an integer rather than double somewhere or a calculation is casting to an integer.
https://docs.mql4.com/basis/types/casting
V
thanks for quick respose, but as i wrote i have checked all variables for mistakenly ints.
i have gone through the code for 2 days. found an int today and was pretty happy until i tested it... FRUSTRATING.
and
when i use
Print(OrderProfit());
it prints a rounded number.
Strange isn't it?
any ideas?
heres the code:
for(int E=0; E < Ended;) { double Profits; OrderID = EndedOrders[E]; OrderSelect(OrderID, SELECT_BY_TICKET, MODE_HISTORY); Print(OrderProfit()); Profits += OrderProfit(); Print("Profit: ", Profits); E ++; }
double Profit = OrderProfit(); Print(DoubleToStr(Profit,4));
temporarily try this in place of your loop... it works fine for me so if you still have a problem, then it must be elsewhere in your code...
static double totprof; for(int i = 0 ; i < OrdersHistoryTotal();i++) { OrderSelect(i, SELECT_BY_POS, MODE_HISTORY); double profit=OrderProfit(); totprof +=profit; Alert ("Profit ",profit," totprof ",totprof); }V
it seems that the OrderProfit() isn't the problem.
i have calculated the profit manually and it seems to be ok. but the results monitor shows a bigger loss than OrderProfit
EUR/USD
any ideas why it shows a bigger loss?
//Enotrek
Don't
it seems that the OrderProfit() isn't the problem.
i have calculated the profit manually and it seems to be ok. but the results monitor shows a bigger loss than OrderProfit
Does your broker charge commission or swap? If so, u should also add OrderSwap() and OrderCommission() to your profit calculation...
SWAP!!!!!
ARGH!!!
sometimes the answer is right before your eyes!
Thanks alot.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi
i have a function that adds ordersprofits from orders that have been closed, its in a extern file. (#include)
the problem is following:
OrderProfit comes in a rounded number ie. without decimals. i have checked all variebles that is assigned to orderprofit, to be double.
when i:
Print(OrderProfit());
it is always a rounded number.
for example in the "results monitor", it shows a profit of -50.24, but the Print shows -50.
i have used this function in another EA and there it shows correctly.
Can it be that i place out SellLimit and BuyLimit?
Thankful for answers or tips
// Enotrek