how to hard code initial capital

Forums ProRealTime English forum ProOrder support how to hard code initial capital

Viewing 7 posts - 1 through 7 (of 7 total)
  • #236561

    Good morning to the PRT community!

     

    Can anyone help me with hard coding the initial capital that is to be allocated to a trading system?

    I assume one has to do this if they plan to use a % based profit target or stop loss, other wise a specified % will be based on the total capital.  Is this correct?

    It would also be interesting to experiment with a trailing % based stop loss, but maybe that is for another topic.

     

    Best regards

     

    J

    #236562

    The percentages of stop loss, take profit and trailing refer to the underlying value, i.e. the index such as DAX, NASDAQ etc.

    1 user thanked author for this post.
    #236566
    JS

    Hi,

    Stop loss, take profit and trailing are all calculated from the (average) position price…

    Simple example:

    Initial capital = 10,000 euros

    Risk 1% (of the initial capital) =100 euros

    (Index point value=1, number of contracts=1)

    SL=100 (1% of initial capital)

    Set Stop pLoss SL

    Or in percentages:

    SL=Risk/PositionPrice*100

    Set Stop %Loss SL

    If you want to make use of your total equity:

    Equity=Capital + StrategyProfit

    Risk 1% (of the Equity) = (Capital + StrategyProfit) * 1/100

    Etc…

    2 users thanked author for this post.
    #236567

    You can’t allocate different slices of your Capital among strategies, as they are unaware of each other.

    You need to manage that allocation within your code.

    In this example I assume this strategy has an initial Capital allocated of 10K euros (or whatever currency unit it is), no matter if your account has more, and I have set a 10% treshold, so that when my loss reaches that treshold, my strategy is stopped with QUIT:

    it’s just the first 5 lines that you need to use at the beginning of your code.

     

     

    1 user thanked author for this post.
    #236568

    As I always say “two is better than none!” 🙂

     

    2 users thanked author for this post.
    #236591
    JS

    For the sake of clarity:

    Roberto, of course, meant 0.1 instead of 0.9

    ONCE myThreshold=myCapital*0.1

    Before someone is stuck with a DD of 9000 euros 😉

    #236592

    No JS, I actually meant 0.9, as it will be turned negative in line 3, so after a -9000 losses (thus 1000 left on the account), it will QUIT.

     

    1 user thanked author for this post.
    avatar JS
Viewing 7 posts - 1 through 7 (of 7 total)

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