Enivid

Administrator
Staff member
Nov 30, 2008
18,530
1,355
144
Odesa
www.earnforex.com
Hello, I have received errors on both the position size calculator and the risk calculator inside the metaeditor. Each have about 100 errors.. how can this be fixed? Thank you
Please make sure you that you are following the installation instructions exactly - i.e., you are copying all the files to correct locations. Please also make sure that you are compiling an .mq4 file and not .mqh ones.
 

Csaba911

Newbie
Sep 22, 2021
5
0
2
55
I'm not sure how you even managed to get it work in 1345. That build is a beta with known bugs and the Risk Calculator shows completely blank for me there.
Thanks for your reply. All major brokerage firms are asking us to upgrade to the 1345, so I though that was kind of mandatory. Now I'm realising that this could have been a bit risky as you stated it was in beta and full of bugs. When I run an existing profile I was able to partially see Risk Calculator. However if I start a Chart from scratch and add the Indicator it sure is blank. Now I'm asking myself how to roll back to the previous version since those are no longer downloadable. Hopefully there will be a release anytime soon as as 1345 is a bit messy. Or do you guys have any other suggestions?
 

Csaba911

Newbie
Sep 22, 2021
5
0
2
55
I'm not sure how you even managed to get it work in 1345. That build is a beta with known bugs and the Risk Calculator shows completely blank for me there.
Thanks a lot for your reply. Many brokerage firms have sent me a mail to upgrade specifically stating to upgrade to this particular Version. So I did which resulted in this error. Now that I know that it is a beta version with lots of bugs it makes sense. I was able to see Risk Calculator when I used my existing profile. When I start a new chart and try to add the indicator it sure gives me a blank screen. So now my question is should I roll back or wait for another update since older versions no longer are listed with the CFD Brokers. What do you guys suggest?
 

Enivid

Administrator
Staff member
Nov 30, 2008
18,530
1,355
144
Odesa
www.earnforex.com
Thanks a lot for your reply. Many brokerage firms have sent me a mail to upgrade specifically stating to upgrade to this particular Version. So I did which resulted in this error. Now that I know that it is a beta version with lots of bugs it makes sense. I was able to see Risk Calculator when I used my existing profile. When I start a new chart and try to add the indicator it sure gives me a blank screen. So now my question is should I roll back or wait for another update since older versions no longer are listed with the CFD Brokers. What do you guys suggest?
Actually, only one (IG) of about 15 of my MT4 instances got updated to 1345. I see reports on the MQL5 official forum saying that some terminals are getting updated to the next beta - 1347 - where this issue is presumably fixed. You could try waiting for your terminals to update to 1347.
 

Csaba911

Newbie
Sep 22, 2021
5
0
2
55
Actually, only one (IG) of about 15 of my MT4 instances got updated to 1345. I see reports on the MQL5 official forum saying that some terminals are getting updated to the next beta - 1347 - where this issue is presumably fixed. You could try waiting for your terminals to update to 1347.
Thanks for your reply. In the meantime I rolled back to the build 1340 and everything is working as expected. The CFD Brokers that have build 1345 in their installation and specifically asked us to install to this latest version via Email Message are Axiory, FxPro, SwissQuote and XM-Global.
 

Enivid

Administrator
Staff member
Nov 30, 2008
18,530
1,355
144
Odesa
www.earnforex.com
Thanks for your reply. In the meantime I rolled back to the build 1340 and everything is working as expected. The CFD Brokers that have build 1345 in their installation and specifically asked us to install to this latest version via Email Message are Axiory, FxPro, SwissQuote and XM-Global.
Good to hear that. Let's hope those brokers update to 1347 or later build sooner or later.
 

KD_R

Trader
Sep 17, 2022
10
1
9
36
Such a Great too to visualize Risk & Reward, is there any possibility that we can add R:R Ratio in this indicator , ik its showing risk and reward amount separately but can we can add Current RR Ratio on Active trade like "1:2" or wherever the actual position is standing in terms of RR Ratio.. Hope you understand what i want to clarify.. Thanks Again for lovely Tool

here is the attached image for more clarification

1663569338128.png
 
Last edited:
  • 👍
Reactions: Enivid

Enivid

Administrator
Staff member
Nov 30, 2008
18,530
1,355
144
Odesa
www.earnforex.com
Such a Great too to visualize Risk & Reward, is there any possibility that we can add R:R Ratio in this indicator , ik its showing risk and reward amount separately but can we can add Current RR Ratio on Active trade like "1:2" or wherever the actual position is standing in terms of RR Ratio.. Hope you understand what i want to clarify.. Thanks Again for lovely Tool

here is the attached image for more clarification

View attachment 22631
I'll consider adding this in the next version. Thanks for the suggestion!
 
  • 👍
Reactions: KD_R

Enivid

Administrator
Staff member
Nov 30, 2008
18,530
1,355
144
Odesa
www.earnforex.com
Risk Calculator has been updated to version 1.14 to add risk-to-reward and fix some minor issues:
  • Added an option to calculate risk-to-reward ratios. (@KD_R)
  • Changed the default color for headers for better visibility on a black background.
  • Fixed a calculation error that resulted in counting spreads in risk and reward calculations for pending orders.
  • Removed indicator's objects from the chart's list of objects.
 
  • 🎉
Reactions: EnrichWave

fba82

Trader
Sep 28, 2023
2
0
6
41
Risk Calculator has been updated to version 1.14 to add risk-to-reward and fix some minor issues:
  • Added an option to calculate risk-to-reward ratios. (@KD_R)
  • Changed the default color for headers for better visibility on a black background.
  • Fixed a calculation error that resulted in counting spreads in risk and reward calculations for pending orders.
  • Removed indicator's objects from the chart's list of objects.
Thank you for the indicator which is quite helpful in analyzing open and pending positions. I've had good success using MT4, but I'm stuck in MT5. The compile process cannot be carried out with the message 105 errors, 3 warnings.

Compile RC.PNGCompile RC2.PNG
 

fba82

Trader
Sep 28, 2023
2
0
6
41
Thank you for the indicator which is quite helpful in analyzing open and pending positions. I've had good success using MT4, but I'm stuck in MT5. The compile process cannot be carried out with the message 105 errors, 3 warnings.

View attachment 25312View attachment 25313
I'm sorry, It is working now. Must be copy to data folder and open with metaeditor for each program files.

Thank you earnforex for this indicator.
 

siteid

Newbie
Nov 19, 2023
4
3
4
41
This indicator is great, but I suggest adding a feature to make it even more perfect:

List the cost prices of empty orders and multiple orders separately, and allow the display of price lines (setting switches) in the chart.

I have a source code for this function here, which can be referenced:
MQL4:
#property strict
string buylinename = "AvgBuyLine";
string selllinename = "AvgSellLine";
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//---
 
 
ObjectCreate(0,buylinename,OBJ_HLINE,0,0,0);
ObjectSetInteger(0,buylinename,OBJPROP_COLOR,clrSkyBlue);
ObjectSetInteger(0,buylinename,OBJPROP_STYLE,STYLE_DASH);
 
ObjectCreate(0,selllinename,OBJ_HLINE,0,0,0);
ObjectSetInteger(0,selllinename,OBJPROP_COLOR,clrOrangeRed);
ObjectSetInteger(0,selllinename,OBJPROP_STYLE,STYLE_DASH);
//---
ObjectSetDouble(0,buylinename,OBJPROP_PRICE1,AvgOrdersPrice(OP_BUY));
ObjectSetDouble(0,selllinename,OBJPROP_PRICE1,AvgOrdersPrice(OP_SELL));
 
 
 
 
//Comment("BufferDown0 : ",, "BufferUp0 : ",bu_list[0]
 //        );
 
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
 
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double AvgOrdersPrice(int type)
  {
   double totalPriceLot = 0 ;
   double totalLots = 0 ;
   double avgPrice = 0 ;
   for(int i=0; i<OrdersTotal(); i++)
     {
      if(OrderSelect(i,SELECT_BY_POS))
        {
         if(OrderSymbol() == Symbol() && OrderType() == type)
           {
            totalPriceLot += OrderOpenPrice()*OrderLots() ;
            totalLots += OrderLots() ;
           }
        }
     }
     if(totalLots >0)
     {
   avgPrice = totalPriceLot/totalLots;
}
return(avgPrice);
  }
//+------------------------------------------------------------------+
 
Last edited by a moderator:
  • 👍
Reactions: EnrichWave

siteid

Newbie
Nov 19, 2023
4
3
4
41
What does it mean?
What I mean is, if a trading variety has multiple orders, there may be multiple sell orders or multiple buy orders, or there may be both sell orders and buy orders. In this situation, it is necessary to know the average price of all buy orders and the average price of all sell orders, so as to accurately evaluate the overall risk of all orders and calculate in advance the stop loss amount (stop profit amount) of all open orders when the price reaches the preset stop loss price (stop profit price) in the future.

Thank you for your reply! Your trading code is excellent, and I will continue to follow with interest and support you!
 

Enivid

Administrator
Staff member
Nov 30, 2008
18,530
1,355
144
Odesa
www.earnforex.com
What I mean is, if a trading variety has multiple orders, there may be multiple sell orders or multiple buy orders, or there may be both sell orders and buy orders. In this situation, it is necessary to know the average price of all buy orders and the average price of all sell orders, so as to accurately evaluate the overall risk of all orders and calculate in advance the stop loss amount (stop profit amount) of all open orders when the price reaches the preset stop loss price (stop profit price) in the future.

Thank you for your reply! Your trading code is excellent, and I will continue to follow with interest and support you!
The thing is the Risk Calculator already calculates the overall risk based on all the trades.
 

siteid

Newbie
Nov 19, 2023
4
3
4
41
The thing is the Risk Calculator already calculates the overall risk based on all the trades.
What I mean is, The indicator can display Stop Out, Free Margin and Margin Call lines on the chart. You can also set your own line at the custom level.
Displaying these lines on the chart is especially useful for people who trade with high leverage or go all-in, where the risk is very high.
You can adjust the line color, style, thickness and visibility (for each one separately). The last parameter that can be changed is the refresh interval.
If you have open orders on several stocks, the line levels will change dynamically.
 
  • ℹ️
Reactions: EnrichWave