Compounding interest – increase position size automatically

Forums ProRealTime English forum ProOrder support Compounding interest – increase position size automatically

  • This topic has 8 replies, 4 voices, and was last updated 5 years ago by avatarLeo.
Viewing 9 posts - 1 through 9 (of 9 total)
  • #69891

    Everyone sooner or later everyone get in touch with the “holy grail” of trading, the compound interest.

    Far from a philosophical discussion, I would like to share and discuss available codes in PRT to develope it in automatic trading.

    At the moment I only know this:

    Is it possible to make a percentage version? When equity reaches 3% profit it adds n contracts? Do you know other alternatives?

    #69892

    First you have to set up your initial equity and number of lots, later, when NOT OnMarket check if strategyprofit is > 3% of your equity and act accordingly:

    You must be aware that after increasing 3%, your equity could fall by 5% and you might want to decrease  the number of lots you are trading.

    1 user thanked author for this post.
    #69901

    Thanks a lot Roberto.

    You must be aware that after increasing 3%, your equity could fall by 5% and you might want to decrease  the number of lots you are trading.

    Is it possible to code?

     

    #69905

    There you go

     

    1 user thanked author for this post.
    #69913

    Above added to

    Snippet Link Library

    Thank You Roberto

    1 user thanked author for this post.
    #69954
    Leo

    I use this

    When the code wins 17*4=68 pips then it duplicate the size of lot.

    1 user thanked author for this post.
    #69963

    Above added to 

    Snippet Link Library.

    I can’t see where the *4 comes from, but maybe I need to think about it more do I? 🙂

    #69968

    I tried to figure out what 4 stands for, as well, since I’m not a fan of maths.

    I guess it has to do with the square root. If you are trading 4 contracts and want to double that number, if you take the square root if, which is two, then you’ll have to multiply it by 4 to get the correct number. Maybe GRAPH (or Leo) could help!

    1 user thanked author for this post.
    #69981
    Leo

    Hi all,

    welll actually is not a 4, haha sorry.

    Look, the code is based in the strategy profit. Therefore I do not want something linear because when it wins the next trade is quite high. Which I choose and works well is the root fuction. Normally a trade quite small amount and very short period of times.

    Lets say, in this example (with strategyprift/17), when the code wins 17 pips then the next trade is 1+17/7=2 then root of 2 is 1.41… the next trade opens 1.41 lots

    next trade win another 17 pips, then 1+34/17=3, root of 3 equal 1.73. Next trade will open with 1.73 lots

    next trade win another 17 pips, it means that the strategy profit is 3 times 17 so, 1+51/17=4, root of 4 is 2 then

    when the strategy is 3 times the 17 then it opens 2 lots.

    in summary if the initial n=1 and you want to duplicate the number of lot after certain number of pips winning, then take the number of pips you desire divided by 3 and remplace the 17 in the code. For example. My initial lot is 1, after 100 winning pips I want to duplicate the number of lot by 2 then, the fist line of the code will be

    N=1+(strategyprofit/(33*pipvalue))

    hope I clarify the code.

    2 users thanked author for this post.
Viewing 9 posts - 1 through 9 (of 9 total)

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