Download MetaTrader 5

How to display profit of Each pair by Comment function

To add comments, please log in or register
Vratislav Tukal
3257
Vratislav Tukal  

Hello, please, help me, how can I display profit of Each pair by Comment function. Thank you for your help...

Comment(

    "-------------------------\n"

    "  CHART INFO\n" 

    "-------------------------\n"

    "Symbol:       " + ChartSymbol()+ "\n"

    "Timeframe:   " + DoubleToStr(ChartPeriod(), 0)+ " minutes\n"

    "Actual Spread:    "+ DoubleToStr(MarketInfo(Symbol(),MODE_SPREAD)/10,1)+ " pips\n"

    "ASK Price:    " + DoubleToStr(MarketInfo(0,MODE_ASK), 5)+ "\n"

    "BID Price:     " + DoubleToStr(MarketInfo(0,MODE_BID), 5)+ "\n"

     "Profit:           "  XXXXXXXX          + "  " + AccountCurrency()+"\n"

 );

whroeder1
17063
whroeder1  
Vratislav Tukal: how can I display profit
  1. Don't paste code
    Play video
    Please edit your post.
    For large amounts of code, attach it

  2. DoubleToStr(MarketInfo(Symbol(),MODE_SPREAD)/10,1)
    Don't assume that you are using a 5 digit broker.
  3. DoubleToStr(MarketInfo(0,MODE_ASK), 5)
    Don't assume that you are not using JPY pairs.
    double   pip          = StringFind(_Symbol,"JPY") < 0 ? 0.01 : 0.0001;
    int      pipDigits    = (int)MathLog10(pip/_Point);
    int      pipsToPoints = int(pip / _Point);
    int      slippage     = 3 * pipsToPoints;
    

  4. Find "profit," substitute "XXXXXXX." What's the problem?
Vratislav Tukal
3257
Vratislav Tukal  
whroeder1:
  1. Please edit your post.
    For large amounts of code, attach it

  2. Don't assume that you are using a 5 digit broker.
  3. Don't assume that you are not using JPY pairs.
  4. Find "profit," substitute "XXXXXXX." What's the problem?

Thank you. But if I use OrderProfit() instead of XXXXXXX, it show me only last opened trade of All Pairs...
whroeder1
17063
whroeder1  
Vratislav Tukal: it show me only last opened trade of All Pairs...
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 forum
To add comments, please log in or register