pls specify what's wrong
')' - unbalanced right parenthesis
Hi!
I need to get profit in point of last closed position.
This is the cod, but something wrong. Please help.
Looks like there is a missing ( brace here . . .
if ( OrderSymbol() == sy || sy == "" ) && ( op < 0 || OrderType() == op ) ) {
this is also wrong
pr+=(OrderOpenPrice()--OrderClosePrice())/p; //twice minus
Oh thank you!
I made the changes - it looks like this now.
int GetProfitLastClosePosInPoint(string sy="", int op=-1, int mn=-1) { double p; int i, k=OrdersHistoryTotal(), pr=0; if (sy=="0") sy=Symbol(); for (i=k-1; i>=0; i--) { if (OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)) { if ((OrderSymbol()==sy || sy=="") && (op<0 || OrderType()==op)){ if (mn<0 || OrderMagicNumber()==mn) { p=MarketInfo(OrderSymbol(), MODE_POINT); if (p==0) if (StringFind(OrderSymbol(), "JPY")<0) p=0.0001; else p=0.01; if (OrderType()==OP_BUY) { pr+=(OrderClosePrice()-OrderOpenPrice())/p; } if (OrderType()==OP_SELL) { pr+=(OrderOpenPrice()-OrderClosePrice())/p; } } } } } return(pr); }
thank you it works now.
Yes it works for one position. I get profit only for one last close position (Symbol, Order Type, Magic).
Can you please help me to change it that I have the sum of profit for all close positions (Symbol, Order Type, Magic).
I am really stuck :( Please help.
Yes it works for one position. I get profit only for one last close position (Symbol, Order Type, Magic).
Can you please help me to change it that I have the sum of profit for all close positions (Symbol, Order Type, Magic).
I am really stuck :( Please help.
- 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 need to get profit in point of last closed position.
This is the code, but something wrong. Please help.
Thank you.