I’m looking for a function that returns if the last trade was a win or lose trade. In other words, if the price hit the take profit or the stop loss of the last trade.
If someone decide help me, so, PLEASE, give-me a function that you have sure that work correctly, because I’m not programmer and I have too much difficult with programming… PLEASE…
Thanks a lot!
- Request Execution - Opening and Closing Positions - Trade - MetaTrader 5 for iPhone
- Request Execution - Opening and Closing Positions - Trade - MetaTrader 5 for Android
- Instant Execution - Opening and Closing Positions - Trade - MetaTrader 5 for iPhone
string LastOrderPL() { string LastOrderStatus; double ProfitandLoss=0.00; for(int i=OrdersHistoryTotal()-1;i>=0;i--) { if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY) &&OrderSymbol()==Symbol()){ if(OrderProfit()>ProfitandLoss){ LastOrderStatus="Last Order Was in Profit"; Alert(OrderProfit()); break;} else if(OrderProfit()<ProfitandLoss){ Alert(OrderProfit()); LastOrderStatus="Last Order Was in Loss"; break; } } } return(LastOrderStatus); }Code is tested and compiled check that
Muhammad Mudasir:
Code is tested and compiled check that
Code is tested and compiled check that
Thanks a lot man!!!!! :)
Superb. GPT4 and Claude Sonnet, fails.
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