Dynamic Position size

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #53880 quote
    Nobody
    Participant
    Veteran

    Having built many systems that use a flat contract size ive now started to look at building systems that remain fully invested and have hit a stumbling block  . So far i have come up with what i think is the correct code to acheive this but i need some help identifying the right terms that PRT will identify
    My code thus far would look like this

    //automated contract number
    n = INITIALCAPITAL/close
    w = STRATEGYPROFIT
    c = Close x = n + w/c

    ‘x’ will be the number of shares/contracts traded  . Strategyprofit is recognized fine but i am yet to find the correct term for initial capital thats identified correctly by PRT

    Appreciate any help  Regards and thanks Pete

    #53881 quote
    Nobody
    Participant
    Veteran
    x = TOTALEQUITY/close

     

      The other alternative is to make  x = TOTALEQUITY/close   but once again im struggling to find the term that PRT uses  . I’d prefer to use the first code sample if possible but either way id love to know the terms for both initialcapital and totalequity

    AleksLi thanked this post
    #53882 quote
    Nobody
    Participant
    Veteran
    Sorry how messy this all looks , please forgive me as im new to posting code in here .. Thanks 
     
     
     
    Having built many systems that use a flat contract size ive now started to look at building systems that remain fully invested and have hit a stumbling block . So far i have come up with what i think is the correct code to acheive this but i need some help identifying the right terms that PRT will identify My code thus far would look like this //automated contract number n = INITIALCAPITAL/close w = STRATEGYPROFIT c = Close x = n + w/c ‘x’ will be the number of shares/contracts traded . Strategyprofit is recognized fine but i am yet to find the correct term for initial capital thats identified correctly by PRT Appreciate any help Regards and thanks Pete

     

    //automated contract number
    
    n = INITIALCAPITAL/close
    
    w = STRATEGYPROFIT
    
    c = Close
     
    x = n + w/c 

     

    #53918 quote
    AutoStrategist
    Participant
    Veteran

    I must be missing something.  If your variable INITIALCAPITAL is what it seems to be i.e. your initial starting capital then you know that number so you can just assign it to the variable e.g. INITIALCAPITAL = 5000?

    #53919 quote
    Nobody
    Participant
    Veteran
    I must be missing something. If your variable INITIALCAPITAL is what it seems to be i.e. your initial starting capital then you know that number so you can just assign it to the variable e.g. INITIALCAPITAL = 5000?


    I realise that and thats what i have been doing but due to the fact i do a lot of testing and use a lot of different testing on varying %ages of capital Id like something that does the job ‘ automatically ‘ if possible .  Thanks for pointing out what i already knew  …   

    #53949 quote
    Yannick
    Participant
    Veteran

    Hi

     

    Please find a code for position sizing for 1% risk of initial and 3% of risk of market money (=strategyprofit)

     

    equity=10000+3*STRATEGYPROFIT
    risk=0.01
    TF=4
    DailyRange=max(abs(Dhigh(1)-Dlow(1)),max(abs(Dhigh(1)-Dclose(2)),abs(Dlow(1)-Dclose(2))))
    DailyATR=wilderaverage[20*TF](DailyRange)
    PositionSize = round((equity*risk)/(DailyATR*pointvalue))

    There is an interesting book on position sizing

    Van Tharp’s : Defenitive guide to position sizing

    Nobody, AutoStrategist, Nicolas and Bel thanked this post
    #53960 quote
    Yannick
    Participant
    Veteran

    If you want to manage % stop loss of position with 1% of your equity risk

    equity=10000+3*STRATEGYPROFIT
    risk=0.01
    strategyrisk= 2 //percent
    PositionSize = round((equity*risk)/(close*pointvalue*strategyrisk/100))
    
    set stop %loss strategyrisk

     

    Nobody, Nicolas, Bel and AleksLi thanked this post
    #53975 quote
    Nobody
    Participant
    Veteran

    Thanks Yannick appreciate that  , will definitely use that  

    #53991 quote
    AutoStrategist
    Participant
    Veteran

    Hi Yannick,  the first example from Van Tharp looks great, the second one doesn’t look right to me for setting the stop loss.  If the intention is to place the stop loss to allow no more than 2% of your equity to be at risk then it should be based on 2% of the equity in a similar way to the way the position size is calculated.  The attachments show 2 very different outcomes for 2 ways of setting the stop loss  and you can see that %ploss is related to the size of the total position size, the HS is at about 29000 currently so 29000/50 = 580 is about the level of stop loss being set.

    HS1.jpg HS1.jpg HS2.jpg HS2.jpg
Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.

Dynamic Position size


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Nobody @brisvegas Participant
Summary

This topic contains 8 replies,
has 3 voices, and was last updated by AutoStrategist
8 years, 3 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 11/25/2017
Status: Active
Attachments: 2 files
Logo Logo
Loading...