Top Menu

Feedburner

Right-Side Top Menu

Forex Blog
My Forex experience and some Forex related information that might be useful to other traders

Calculate Forex Position Size in MetaTrader

March 27, 2012 (Last updated on July 10, 2012)

More than four years have passed since I’ve introduced my online position size calculator for EarnForex.com visitors. Since then it became very popular. A poll shows that about ¼ of this blog’s readers frequently use online Forex calculators, while Google Analytics shows that the current position size calculator form is the 4th most popular destination on EarnForex.com.

OK, enough with the introduction. Today, I’d like to present the position size calculator for MetaTrader — an automated tool that can be added to any MT4 or MT5 chart and be used on-the-fly with minimum intervention from trader’s side. This calculator indicator will do your usual position calculation work instantly in a semi-automatic mode. The MT5 version is slightly better than the one for MT4: more obvious input parameter settings, faster recalculation on position entry/stop-loss change and better input parameter preservation in case of code change.

Some features of this MetaTrader tool:

  • Use either account balance or account equity to calculate position size.
  • Change entry/stop-loss points simply by dragging the lines on chart.
  • Doesn’t consume much CPU resources.
  • Automatic reference pair detection rate fetching (may be buggy, especially for non-standard trading instruments).
  • Great potential for customization and enhancements.

You can download the code of the MT5 and MT4 versions or read more info about this handy calculator tool.

If you find any bugs in this MetaTrader indicator or if you have some feature suggestions, please post them using the commentary form below.

33 Responses to “Calculate Forex Position Size in MetaTrader”

  1. Steve

    Hello Andrei

    I have loaded this great little tool, thankyou for taking the time to build it.
    I have one question, the referenece pair never changes from AUDUSD when I load the indicator on to other currency pairs. I have tried changing the label name, but to no avail.
    Any help would very much appreciated

    Regards
    Steve

    Reply

    admin Reply:

    Are you sure it should be changing? Isn’t your account balance in Australian dollars?

    Reply

  2. GT

    I have installed the position size calculator, it works well, however is there any way of using it with a fixed capital risk amount rather than % of capital

    Reply

    admin Reply:

    Currently, there is no way for that but I might add this feature soon.

    Reply

    admin Reply:

    I’ve just added the support for a fixed capital risk to this indicator. Please re-download and make sure it’s version 1.1 (if you are using MT5).

    Reply

  3. Carl

    Hi, I get the following message when attempt to use the MT4 position size calculator:

    “Failed to detect a proper currency pair for pip valuation.”

    Any reason why? I’m using a spread betting account with GBP as the base currency.

    Thanks in advance.

    Reply

    admin Reply:

    And what pair are you trying to attach the indicator to?

    Reply

  4. Frank

    hello, i have loaded the indicator to my mt4,i have a dollar account but your Mt4 position size indicator doesnt show the currency pair’s ask price that i am trading & it simply leaves a gap in between the Stop Loss Price and the Risk Percentage. Its supposed to show the ask Price pulled from the market watch window but i cannot seem to do this.Can you help

    Reply

    admin Reply:

    What currency pair are you attaching it to with your dollar account?

    Reply

    Frank Reply:

    am attaching it to the USDJPY currency pair,actually i was setting up a trade on the USDJPY. but it seems to show the same problem on all pairs! The ask price of the pair just doesnt appear on the chart. Can you tell me how to set this up properly?

    Reply

    admin Reply:

    How is USDJPY pair called in the Market Watch window of your MetaTrader?

    Reply

  5. Frank

    it is called “USDJPYpro” in the Market Watch Window of my MT4 Trading Platform

    Reply

    admin Reply:

    Please re-download and re-install the indicator. Then try again. I’ve tried to correct this bug.

    Reply

  6. marketmaster

    hi, i had the same problem of frank, my pairs are named **.uni and the position size calculator didnt find them. now with the version (1) you have made it works perfectly. the only thing is that the pop up alert window is still popping up telling that an error occurred but the indicator works fine.

    thanks a lot

    Reply

  7. marketmaster

    sorry, its me again
    the indicator worked fine with the pair eurgbp.uni but i tried with the eurjpy.uni and it doesnt work. i didnt try more pairs but i think something must be related to the price. the price of eurgbp is 0.8051 for example but the price of eurjpy is completely different 103.46 for example.
    why is this happening? could you sort it out please?

    thank you very much

    Reply

    admin Reply:

    I’ve tried to fix it and uploaded the new version of the indicator. Please download again and test it. Let me know if it works for you. By the way, it would really help if you could tell which version you are using – MT4 or MT5.

    Reply

    marketmaster Reply:

    hello admin,
    i downloaded the indicator from the link you have above this page and it is still not working with the eurjpy.uni pair
    im using the mt4 platform

    thank you very much for your time.

    Reply

    admin Reply:

    What broker are you using?

    Reply

    marketmaster Reply:

    universal fx

    Reply

  8. marketmaster

    i can give you an email if you want to contact them

    Reply

    admin Reply:

    No need to :-).

    The indicator should be working now. Try downloading and compiling it again. Do not forget to add USDJPY.uni to your Market Watch window.

    Reply

    marketmaster Reply:

    sorry admin but the indicator still doesnt work with the eurjpy.uni
    could you open a demo account with universal fx and try to make work the position size calculator with those pairs like eurjpy usdjpy etc?

    thank you very much

    Reply

    admin Reply:

    I did try that before uploading the current version. It is working as seen on the screenshot:
    EURJPY.uni Position Size Calculation

    What happens when you try to do attach it to your EUR/JPY chart?

    Reply

    marketmaster Reply:

    im trying to add a screen shot too but i dont know how.

    basically the position size calculator is alway 0.00 for me meanwhile you have 0.08 on your screen shot and the pop up window comes up with two messages:

    …. failed to detect a proper currency pair for pip valuation
    …. Try adding all the available currency pairs to market watch

    i dont know if im dowloading the indicator from an older link or im doing something wrong when setting it up

    thanks you are being very kind

    Reply

    admin Reply:

    Please make sure of the following:
    1. You download it from here:
    http://www.earnforex.com/mt4-forex-indicators/PositionSizeCalculator.mq4
    2. Its size is exactly 10809 bytes.
    3. If you are adding it to EURJPY.uni, you also need USDJPY.uni in the Market Watch window.

    PS: Is your trading account in USD or some other currency?

    Reply

    marketmaster Reply:

    finally it is working,

    thanks a lot. my account is currently in euros but i tried with USD GBP and EUR.
    It probably was that i was downloading the indicator from a non updated link.

    thanks again, now i will tell my broker to convert my euros in GBP to try the indicator with a gbp account and i think i wont have any problems

    admin Reply:

    Good.

    When you’ll have a GBP account, you’ll be needing GBPJPY.uni in Market Watch to be able to use the calculator on EURJPY.uni.

  9. Raghb ir Gill

    Does your MT 4 position sizing work for Gold and Silver as i always get 0.0. Thanks

    Reply

    admin Reply:

    That depends on how your Gold and Silver symbols are called in your broker.

    Reply

  10. Ryan4all

    Sorry to hash up an old post as I can see this was last touched almost 4 months ago but I have been using your calculator for quite some time and have just installed the indicator. It seems I am unable to change the reference price the calculator is using.

    When I add the indicator to a chart (and pair) I only see the following fields:
    Entry level
    Stop loss
    Risk
    Account balance
    Risk money
    Position size
    (There is no open space as described in a previous comment so it looks like it should be working)

    However I have found that depending on what pair I am trading the position size it gives me can be wildly out from what I get if I use the online calculator which is telling me that it is not picking up the correct exchange rate for the pair I am on.

    I am using a USD account but am trading multiple majors.

    Any assistance you could give would be greatly appreciated as I am hoping to incorperate teh outputs from this indicator into my EA.

    Regards
    Ryan

    Reply

    admin Reply:

    It would really help if you could provide some examples of its calculations that you believe are incorrect. Please also let me know what platform you are using it in – MT4 or MT5?

    Reply

    ryan4all Reply:

    I have just run some more tests manually and it looks like the issue is not with your indicator but rather with my EA that is not updating the chart properly so your indicator is still showing old lot size data.

    I will confirm this when the market opens tomorrow but I think this is the issue.

    Sorry about that and by the way this is an amazing indicator.

    Reply

    admin Reply:

    No problem. Did you mean to say “MT4″ in place of “EA”? If so, then the cause is that the markets are currently closed and even if you drag the lines on chart there is no tick event to recalculate the values.

    Reply

Leave a Reply

required
required (will not be published)
optional

Subscribe to Monthly Forex Newsletter