I am trying to install it in my mac os, but im getting compilation errors. even though i have followed each step perfectly.
Below is the ss
View attachment 39567
Could you please scroll the list of errors up to the first error it prints? It's usually the most important one.
 
Could you please scroll the list of errors up to the first error it prints? It's usually the most important one.
below is the list of all errors and the screenshot of the top error:-


undeclared identifier 'MqlCommission' Position Sizer.mqh 9699 5
undeclared identifier 'commissions' Position Sizer.mqh 9699 19
'commissions' - some operator expected Position Sizer.mqh 9699 19
']' - unexpected token Position Sizer.mqh 9699 31
undeclared identifier 'SymbolInfoCommissions' Position Sizer.mqh 9700 17
',' - unexpected token Position Sizer.mqh 9700 55
'SymbolForTrading' - some operator expected Position Sizer.mqh 9700 39
semicolon expected Position Sizer.mqh 9700 57
undeclared identifier 'commissions' Position Sizer.mqh 9700 57
')' - unexpected token Position Sizer.mqh 9700 68
undeclared identifier 'commissions' Position Sizer.mqh 9735 37
'[' - array required Position Sizer.mqh 9735 48
';' - unexpected token Position Sizer.mqh 9735 58
';' - unexpected token Position Sizer.mqh 9735 58
'continue' - semicolon expected Position Sizer.mqh 9736 31
undeclared identifier 'commissions' Position Sizer.mqh 9740 13
'[' - array required Position Sizer.mqh 9740 24
undeclared identifier 'SYMBOL_COMMISSION_RANGE_VOLUME' Position Sizer.mqh 9740 42
undeclared identifier 'commissions' Position Sizer.mqh 9741 18
'[' - array required Position Sizer.mqh 9741 29
undeclared identifier 'SYMBOL_COMMISSION_RANGE_VALUE' Position Sizer.mqh 9741 47
undeclared identifier 'commissions' Position Sizer.mqh 9745 37
'[' - array required Position Sizer.mqh 9745 48
undeclared identifier 'commissions' Position Sizer.mqh 9745 96
'[' - array required Position Sizer.mqh 9745 107
undeclared identifier 'commissions' Position Sizer.mqh 9745 134
'[' - array required Position Sizer.mqh 9745 145
';' - unexpected token Position Sizer.mqh 9747 22
'{' - some operator expected Position Sizer.mqh 9746 13
';' - unexpected token Position Sizer.mqh 9748 22
'(' - unbalanced left parenthesis Position Sizer.mqh 9745 16
empty controlled statement found Position Sizer.mqh 9748 22
undeclared identifier 'commissions' Position Sizer.mqh 9752 13
'[' - array required Position Sizer.mqh 9752 24
undeclared identifier 'SYMBOL_COMMISSION_DISABLED' Position Sizer.mqh 9752 45
'continue' must be used within some loop only Position Sizer.mqh 9752 73
undeclared identifier 'commissions' Position Sizer.mqh 9756 13
'[' - array required Position Sizer.mqh 9756 24
undeclared identifier 'SYMBOL_COMMISSION_MONEY_SYMBOL_BASE' Position Sizer.mqh 9756 45
undeclared identifier 'commissions' Position Sizer.mqh 9757 18
'[' - array required Position Sizer.mqh 9757 29
undeclared identifier 'SYMBOL_COMMISSION_MONEY_SYMBOL_PROFIT' Position Sizer.mqh 9757 50
undeclared identifier 'commissions' Position Sizer.mqh 9758 18
'[' - array required Position Sizer.mqh 9758 29
undeclared identifier 'SYMBOL_COMMISSION_MONEY_SYMBOL_MARGIN' Position Sizer.mqh 9758 50
undeclared identifier 'commissions' Position Sizer.mqh 9759 18
'[' - array required Position Sizer.mqh 9759 29
undeclared identifier 'SYMBOL_COMMISSION_MONEY_SPECIFIED' Position Sizer.mqh 9759 50
undeclared identifier 'commissions' Position Sizer.mqh 9761 17
'[' - array required Position Sizer.mqh 9761 28
implicit conversion from 'unknown' to 'string' Position Sizer.mqh 9761 17
undeclared identifier 'commissions' Position Sizer.mqh 9761 63
'[' - array required Position Sizer.mqh 9761 74
implicit conversion from 'unknown' to 'string' Position Sizer.mqh 9761 63
undeclared identifier 'commissions' Position Sizer.mqh 9762 22
'[' - array required Position Sizer.mqh 9762 33
implicit conversion from 'unknown' to 'string' Position Sizer.mqh 9762 22
undeclared identifier 'commissions' Position Sizer.mqh 9762 59
'[' - array required Position Sizer.mqh 9762 70
implicit conversion from 'unknown' to 'string' Position Sizer.mqh 9762 59
undeclared identifier 'commissions' Position Sizer.mqh 9770 17
'[' - array required Position Sizer.mqh 9770 28
':' - unexpected token Position Sizer.mqh 9772 45
'commissions' - illegal switch expression type Position Sizer.mqh 9770 17
'case' - '{' beginning bracket expected Position Sizer.mqh 9773 9
illegal 'else' without matching 'if' Position Sizer.mqh 9778 13
'break' must be used within some loop or switch statement Position Sizer.mqh 9779 13
illegal 'case' or 'default' without matching 'switch' Position Sizer.mqh 9780 9
'break' must be used within some loop or switch statement Position Sizer.mqh 9782 13
illegal 'case' or 'default' without matching 'switch' Position Sizer.mqh 9783 9
'break' must be used within some loop or switch statement Position Sizer.mqh 9785 13
illegal 'case' or 'default' without matching 'switch' Position Sizer.mqh 9786 9
undeclared identifier 'commissions' Position Sizer.mqh 9788 61
'[' - array required Position Sizer.mqh 9788 72
'break' must be used within some loop or switch statement Position Sizer.mqh 9789 13
illegal 'case' or 'default' without matching 'switch' Position Sizer.mqh 9790 9
'}' - not all control paths return a value Position Sizer.mqh 9835 1
72 errors, 5 warnings 72 5


Screenshot 2026-08-26 at 9.01.01 PM.png
 
below is the list of all errors and the screenshot of the top error:-


undeclared identifier 'MqlCommission' Position Sizer.mqh 9699 5
undeclared identifier 'commissions' Position Sizer.mqh 9699 19
'commissions' - some operator expected Position Sizer.mqh 9699 19
']' - unexpected token Position Sizer.mqh 9699 31
undeclared identifier 'SymbolInfoCommissions' Position Sizer.mqh 9700 17
',' - unexpected token Position Sizer.mqh 9700 55
'SymbolForTrading' - some operator expected Position Sizer.mqh 9700 39
semicolon expected Position Sizer.mqh 9700 57
undeclared identifier 'commissions' Position Sizer.mqh 9700 57
')' - unexpected token Position Sizer.mqh 9700 68
undeclared identifier 'commissions' Position Sizer.mqh 9735 37
'[' - array required Position Sizer.mqh 9735 48
';' - unexpected token Position Sizer.mqh 9735 58
';' - unexpected token Position Sizer.mqh 9735 58
'continue' - semicolon expected Position Sizer.mqh 9736 31
undeclared identifier 'commissions' Position Sizer.mqh 9740 13
'[' - array required Position Sizer.mqh 9740 24
undeclared identifier 'SYMBOL_COMMISSION_RANGE_VOLUME' Position Sizer.mqh 9740 42
undeclared identifier 'commissions' Position Sizer.mqh 9741 18
'[' - array required Position Sizer.mqh 9741 29
undeclared identifier 'SYMBOL_COMMISSION_RANGE_VALUE' Position Sizer.mqh 9741 47
undeclared identifier 'commissions' Position Sizer.mqh 9745 37
'[' - array required Position Sizer.mqh 9745 48
undeclared identifier 'commissions' Position Sizer.mqh 9745 96
'[' - array required Position Sizer.mqh 9745 107
undeclared identifier 'commissions' Position Sizer.mqh 9745 134
'[' - array required Position Sizer.mqh 9745 145
';' - unexpected token Position Sizer.mqh 9747 22
'{' - some operator expected Position Sizer.mqh 9746 13
';' - unexpected token Position Sizer.mqh 9748 22
'(' - unbalanced left parenthesis Position Sizer.mqh 9745 16
empty controlled statement found Position Sizer.mqh 9748 22
undeclared identifier 'commissions' Position Sizer.mqh 9752 13
'[' - array required Position Sizer.mqh 9752 24
undeclared identifier 'SYMBOL_COMMISSION_DISABLED' Position Sizer.mqh 9752 45
'continue' must be used within some loop only Position Sizer.mqh 9752 73
undeclared identifier 'commissions' Position Sizer.mqh 9756 13
'[' - array required Position Sizer.mqh 9756 24
undeclared identifier 'SYMBOL_COMMISSION_MONEY_SYMBOL_BASE' Position Sizer.mqh 9756 45
undeclared identifier 'commissions' Position Sizer.mqh 9757 18
'[' - array required Position Sizer.mqh 9757 29
undeclared identifier 'SYMBOL_COMMISSION_MONEY_SYMBOL_PROFIT' Position Sizer.mqh 9757 50
undeclared identifier 'commissions' Position Sizer.mqh 9758 18
'[' - array required Position Sizer.mqh 9758 29
undeclared identifier 'SYMBOL_COMMISSION_MONEY_SYMBOL_MARGIN' Position Sizer.mqh 9758 50
undeclared identifier 'commissions' Position Sizer.mqh 9759 18
'[' - array required Position Sizer.mqh 9759 29
undeclared identifier 'SYMBOL_COMMISSION_MONEY_SPECIFIED' Position Sizer.mqh 9759 50
undeclared identifier 'commissions' Position Sizer.mqh 9761 17
'[' - array required Position Sizer.mqh 9761 28
implicit conversion from 'unknown' to 'string' Position Sizer.mqh 9761 17
undeclared identifier 'commissions' Position Sizer.mqh 9761 63
'[' - array required Position Sizer.mqh 9761 74
implicit conversion from 'unknown' to 'string' Position Sizer.mqh 9761 63
undeclared identifier 'commissions' Position Sizer.mqh 9762 22
'[' - array required Position Sizer.mqh 9762 33
implicit conversion from 'unknown' to 'string' Position Sizer.mqh 9762 22
undeclared identifier 'commissions' Position Sizer.mqh 9762 59
'[' - array required Position Sizer.mqh 9762 70
implicit conversion from 'unknown' to 'string' Position Sizer.mqh 9762 59
undeclared identifier 'commissions' Position Sizer.mqh 9770 17
'[' - array required Position Sizer.mqh 9770 28
':' - unexpected token Position Sizer.mqh 9772 45
'commissions' - illegal switch expression type Position Sizer.mqh 9770 17
'case' - '{' beginning bracket expected Position Sizer.mqh 9773 9
illegal 'else' without matching 'if' Position Sizer.mqh 9778 13
'break' must be used within some loop or switch statement Position Sizer.mqh 9779 13
illegal 'case' or 'default' without matching 'switch' Position Sizer.mqh 9780 9
'break' must be used within some loop or switch statement Position Sizer.mqh 9782 13
illegal 'case' or 'default' without matching 'switch' Position Sizer.mqh 9783 9
'break' must be used within some loop or switch statement Position Sizer.mqh 9785 13
illegal 'case' or 'default' without matching 'switch' Position Sizer.mqh 9786 9
undeclared identifier 'commissions' Position Sizer.mqh 9788 61
'[' - array required Position Sizer.mqh 9788 72
'break' must be used within some loop or switch statement Position Sizer.mqh 9789 13
illegal 'case' or 'default' without matching 'switch' Position Sizer.mqh 9790 9
'}' - not all control paths return a value Position Sizer.mqh 9835 1
72 errors, 5 warnings 72 5


View attachment 39568
Version 3.16 of the Position Sizer requires MT5 build 6140. Please update your MT5 via menu Help->Check For Updates->Latest Release Version.
 
Hey! I have a feature request for Position Sizer.

Could you add a “Commission Adjustment for Stop Loss / Maximum Risk” option?

For example:

  • Maximum risk = $1,000
  • Commission = $100
  • Maximum actual loss from the SL = $900
  • Total loss including commission = $1,000
The idea would be that when the option is enabled, Position Sizer automatically subtracts the estimated commission from the maximum allowed risk before calculating the position size.

Something like:

Max Risk − Commission = Maximum SL Loss

Example:
$1,000 − $100 = $900 available SL risk

This would make the risk calculation much more accurate for traders who want their total loss, including commission, to stay within a strict risk limit.

A simple toggle such as:

Include Commission in Maximum Risk: ON/OFF

would be extremely useful.

Thanks for considering it!
 
Added automatic commission retrieval from the broker's server in MetaTrader 5 version. It is now a default method. Set AutoCommission to false to disable.
Now.. There is no need to enter the commission manually?.. It will calculate commission from the broker?.

Changed margin utilization to ignore pending orders' margin.
Kindly do not ignore margin utilization for the pending orders.. Because If suppose trader having pending orders and it triggered the margin utilization will jump and he may loose the account.... Kindly have option for it to set true/false..
 
Last edited:
Hey! I have a feature request for Position Sizer.

Could you add a “Commission Adjustment for Stop Loss / Maximum Risk” option?

For example:

  • Maximum risk = $1,000
  • Commission = $100
  • Maximum actual loss from the SL = $900
  • Total loss including commission = $1,000
The idea would be that when the option is enabled, Position Sizer automatically subtracts the estimated commission from the maximum allowed risk before calculating the position size.

Something like:

Max Risk − Commission = Maximum SL Loss

Example:
$1,000 − $100 = $900 available SL risk

This would make the risk calculation much more accurate for traders who want their total loss, including commission, to stay within a strict risk limit.

A simple toggle such as:

Include Commission in Maximum Risk: ON/OFF

would be extremely useful.

Thanks for considering it!
That's how it already works. If you set the risk to $1,000 and there is some commission, it will calculate the position size such as that the total loss is $1,000 (both from SL and from commission).
Now.. There is no need to enter the commission manually?.. It will calculate commission from the broker?.
Yes. Provided your broker has it configured correctly.
Kindly do not ignore margin utilization for the pending orders.. Because If suppose trader having pending orders and it triggered the margin utilization will jump and he may loose the account.... Kindly have option for it to set true/false..
There is a huge problem with this. There needs to be a way model which pending orders can trigger simultaneously and which cannot. A similar task is performed by our Risk Calculator indicator, but it is very resource-consuming and will slow the Position Sizer down significantly. The other solution is to print max utilization possible, but this would be largely misleading.
 
Yes. Provided your broker has it configured correctly.
That is great feature. Thank you so much

There is a huge problem with this. There needs to be a way model which pending orders can trigger simultaneously and which cannot. A similar task is performed by our Risk Calculator indicator, but it is very resource-consuming and will slow the Position Sizer down significantly. The other solution is to print max utilization possible, but this would be largely misleading.
Kindly write the issues in the MQL community so they may take step on this.

The risk concept on Margin in the trading tab will work for the pending orders?..
if there is margin % in the margin tab that will be helpful

PS: I checked the margin related thing.. It seems the margin % doesn't work correctly... There is always a better way Enivid. You can definitely find it and provide a better solution.
 
Last edited:
Version 3.16a released for MT5 specifically to address two margin utilization bugs:
  • Fixed a bug that would allow position opening even when margin utilization restrictions are breached in some cases. (@EnrichWave)
  • Fixed incorrect total margin utilization calculation.
It looks like neither of the two bugs was present in the MT4 version of the Position Sizer.
 
  • 🚀
Reactions: EnrichWave
Discuss the Position Sizer expert advisor here. This EA lets you calculate optimal position size and execute trades based on these calculations. Based on Position Size Calculator, it allows some additional control over the trades it opens. You can ask any questions about this free MetaTrader tool here.

Please refer to this tutorial for the installation process:
To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.

Installation tutorial for macOS:
To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.

Simplified installation for macOS (in case the above one doesn't work for you):
To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.

You can download Position Sizer here.

The latest version is 3.11.
Hi. I have recently purchased a new Asus laptop, installed MT5 and Position size calculator ea exactly as it is on my desktop. As soon as I load the Position sizer EA it just appears blank on the MT5 trading page and I can't even move it or do anything with it. Ihave to close the whole trading page and reopen it to get rid of the Position sizer. How do i fix this?
 
Hi. I have recently purchased a new Asus laptop, installed MT5 and Position size calculator ea exactly as it is on my desktop. As soon as I load the Position sizer EA it just appears blank on the MT5 trading page and I can't even move it or do anything with it. Ihave to close the whole trading page and reopen it to get rid of the Position sizer. How do i fix this?
What is the output in the Experts tab log when you attach the Position Sizer to a chart?
Which build of MT5 are you using there?
 
Hi, i got an issue with the position sizer when i have done compiled it, but when i used it it just go all blank with the issue said invalid pointer access in "position sizer.mqh" (2616,33), anyone knows how to fix this? i just reinstalled the mt5 today and compiled again but it still goes blank
 
Last edited:
Hi, i got an issue with the position sizer when i have done compiled it, but when i used it it just go all blank with the issue said invalid pointer access in "position sizer.mqh" (2616,33), anyone knows how to fix this? i just reinstalled the mt5 today and compiled again but it still goes blank
I am already looking into this, but for now, the best solution would be to revert to the latest release build of MT5 - 6182, because the issue is present only in the latest beta build (6193).
Hi. I have recently purchased a new Asus laptop, installed MT5 and Position size calculator ea exactly as it is on my desktop. As soon as I load the Position sizer EA it just appears blank on the MT5 trading page and I can't even move it or do anything with it. Ihave to close the whole trading page and reopen it to get rid of the Position sizer. How do i fix this?
I believe you are experiencing the same issue. Please re-install the MT5 to a release build without updating to a beta build.
 
Dear EarnForex Team,

I am a long-time user of your "Position Sizer" tool for MT5 and appreciate the value it brings to my trading. I am writing to request a few feature enhancements that would significantly improve my workflow by allowing more automated trade management directly within the EA.

Could you please consider adding the following as toggleable Input Parameters?

  1. Persistent Default Values: Ability to set and save permanent defaults for "Risk %" (e.g., 23%) and "Risk-to-Reward Ratio" (e.g., 1.5) so they remain fixed and do not need to be adjusted manually every time the tool is loaded.
  2. Automatic Partial Close: An option to set a partial close (e.g., 50% of the volume) when a certain distance to TP is reached (e.g., 50% of the initial TP distance).
  3. Automatic Break Even: An option to automatically move the Stop Loss to the exact Entry Price once a specific profit target is reached, ensuring a zero-risk trade.
  4. Auto SL/TP Calculation: Options to automatically calculate and fill SL/TP based on the predefined Risk/Reward settings if the user leaves them at zero.
  5. Magic Number Management: For the automated functions (Partial Close and Break Even), it is essential that the EA identifies trades via the specific Magic Number to prevent conflicts when trading multiple pairs simultaneously.
My goal is to have these parameters controllable via the MT5 input window, allowing me to define my strategy once and keep it consistent. This would eliminate the need for secondary trade management tools and keep my entire setup streamlined within your excellent EA.

Thank you for considering these improvements. I look forward to your thoughts.

Best regards
Post automatically merged:

Dear EarnForex Team,

I am a long-time user of your "Position Sizer" tool for MT5 and appreciate the value it brings to my trading. I am writing to request a few feature enhancements that would significantly improve my workflow by allowing more automated trade management directly within the EA.

Could you please consider adding the following as toggleable Input Parameters?

  1. Persistent Default Values: Ability to set and save permanent defaults for "Risk %" (e.g., 23%) and "Risk-to-Reward Ratio" (e.g., 1.5) so they remain fixed and do not need to be adjusted manually every time the tool is loaded.
  2. Automatic Partial Close: An option to set a partial close (e.g., 50% of the volume) when a certain distance to TP is reached (e.g., 50% of the initial TP distance).
  3. Automatic Break Even: An option to automatically move the Stop Loss to the exact Entry Price once a specific profit target is reached, ensuring a zero-risk trade.
  4. Auto SL/TP Calculation: Options to automatically calculate and fill SL/TP based on the predefined Risk/Reward settings if the user leaves them at zero.
  5. Magic Number Management: For the automated functions (Partial Close and Break Even), it is essential that the EA identifies trades via the specific Magic Number to prevent conflicts when trading multiple pairs simultaneously.
My goal is to have these parameters controllable via the MT5 input window, allowing me to define my strategy once and keep it consistent. This would eliminate the need for secondary trade management tools and keep my entire setup streamlined within your excellent EA.

Thank you for considering these improvements. I look forward to your thoughts.

Best regards
 
Persistent Default Values: Ability to set and save permanent defaults for "Risk %" (e.g., 23%) and "Risk-to-Reward Ratio" (e.g., 1.5) so they remain fixed and do not need to be adjusted manually every time the tool is loaded.
This already exists.
Automatic Partial Close: An option to set a partial close (e.g., 50% of the volume) when a certain distance to TP is reached (e.g., 50% of the initial TP distance).
This only exists in the form of divided multi-TP trades. One position with partial closes won't be implemented.
Automatic Break Even: An option to automatically move the Stop Loss to the exact Entry Price once a specific profit target is reached, ensuring a zero-risk trade.
This already exists.
Auto SL/TP Calculation: Options to automatically calculate and fill SL/TP based on the predefined Risk/Reward settings if the user leaves them at zero.
Not sure what you mean here. Do you propose calculating SL based on the given position size and risk? That doesn't sound like a good idea.
Magic Number Management: For the automated functions (Partial Close and Break Even), it is essential that the EA identifies trades via the specific Magic Number to prevent conflicts when trading multiple pairs simultaneously.
This already exists.
 
olá. Preciso de ajuda. Fui instalar o position e estar aparecendo esse erro. Ele fica em branco na tela do mt5. Instalei da forma correta e mesmo assim está dando esse erro. Estou instalando o pacote completo. Instalei da mesma forma em outro computador e funcionou. Mas no meu computador não está funcionando

Google Translate:
Hello. I need help. I was installing Position and this error is appearing. It stays blank on the MT5 screen. I installed it correctly and it's still giving this error. I'm installing the complete package. I installed it the same way on another computer and it worked. But it's not working on my computer.
 

Attached File(s)

  • Captura de Tela (116).png
    Captura de Tela (116).png
    39.6 KB · Views: 0
  • Captura de Tela (116).png
    Captura de Tela (116).png
    39.6 KB · Views: 0
Last edited by a moderator:
Version 3.16b released for MT5 to deal with the crashing bug in newer builds (6193+). Please download and re-install the Position Sizer if you experience the issue.
Google Translate: I was having the same problem. I downloaded the new version you mentioned, and it worked perfectly. Thank you.
 
Last edited by a moderator:
Dear EarnForex Team,

To make TradePad perfect for my strategy, I need these custom logic updates based on ratios (not fixed points):

  1. Persistent Lock: Add a 'Lock' feature for both Risk % (23%) and RR Ratio so they remain fixed and do not need to be adjusted manually.
  2. Dynamic Management:
    • BE Profit Trigger: Move SL to Entry (Breakeven) when trade hits +50% of the distance to TP.(not units)
    • BE Loss/Exit Trigger: If the trade goes against me by -50% of the initial SL distance, move the TP to the Entry Price (to exit the trade at zero/breakeven).
These features would allow me to manage trades based on price ratios rather than fixed points, which is essential for my workflow.

Are these modifications possible? If so, please let me know the cost or the process to get a custom version."
 
Dear EarnForex Team,

To make TradePad perfect for my strategy, I need these custom logic updates based on ratios (not fixed points):

  1. Persistent Lock: Add a 'Lock' feature for both Risk % (23%) and RR Ratio so they remain fixed and do not need to be adjusted manually.
  2. Dynamic Management:
    • BE Profit Trigger: Move SL to Entry (Breakeven) when trade hits +50% of the distance to TP.(not units)
    • BE Loss/Exit Trigger: If the trade goes against me by -50% of the initial SL distance, move the TP to the Entry Price (to exit the trade at zero/breakeven).
These features would allow me to manage trades based on price ratios rather than fixed points, which is essential for my workflow.

Are these modifications possible? If so, please let me know the cost or the process to get a custom version."
What's TradePad?