Compounding position size with profits

Forums ProRealTime English forum ProOrder support Compounding position size with profits

Viewing 6 posts - 1 through 6 (of 6 total)
  • #115914

    Hi There,

    Thank you in advance for any help you provide.

    What I am trying to achieve is scaling the position size based upon the increase or decrease of capital as the automated trading system runs.
    I trade CFD’s with IG Markets and because they are leveraged I have to use Margin.

    The number of contracts to purchase on any trade is calculated based upon how much margin said contracts will consume as a percentage of my capital, defined as risk.
    As the system trades and profits (or losses), I would like to readjust the number of contracts based upon the increase in capital, as the price will be changing.

    For example, $500 with 50% risk may allow me to purchase 250 contracts, and by making a trade that generates a profit where my total capital increases to $600, I would like it to calculate how many contracts I can purchase with this increase in capital.

    Your overall margin requirement is calculated as follows:
    Without a stop
    Margin = Size x price x margin factor
    With a non-guaranteed stop1
    We calculate your margin with a non-guaranteed stop, compare it to the margin required without a stop, and charge the lower of the two figures as margin.

    Margin = (size x price x slippage factor x margin factor) + (size x stop distance)

    Just some FYI’s:
    Margin Factor, Slippage Factor, Min Size are all set manually based upon the instrument at the broker.
    SetLoss, Risk are what I set.

     

    #116088

    Check this out, could be what you want:

    https://www.prorealcode.com/blog/learning/money-management-prorealtime-code/

    Or run a search for Money Management, you’ll find some examples that you should be able to adapt.

    #116092

    D Paul Al

    >> Please update your country flag in your profile. Thank you 🙂 <<

     

    #191795

    Am working on similar, and have added the position size script.

    How is yours working?

    #191797

    bonjour,

     

    J’ai survolé votre code , et vous indiquez dans votre condition d’achat ligne 31 la condition c8.

    C8 est défini ligne 29 comme TRADEPRICE(1) c’est à dire le prix de la dernière transaction est non comme une condition. N’auriez vous pas oublié une instruction…

    hello, I hovered over your code, and you indicate in your condition of purchase line 31 the condition c8. C8 is defined line 29 as TRADEPRICE ( 1 ) ie the price of the last transaction is not as a condition. Didn’t you forget an instruction…

    #191801

    @jacques34

    Only post in the language of the forumthat you are posting in. For example English only in the English speaking forums and French only in the French speaking forums.

    Thanks 🙂

     

Viewing 6 posts - 1 through 6 (of 6 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login