Position Size Management – Performance based increases

Viewing 15 posts - 16 through 30 (of 32 total)
  • Author
    Posts
  • #106961 quote
    deleted271219
    Member
    New

    How can these indicators be converted into a code for execute automatically to proorder???

    The consecutive winning streak based risk increment, and the fixed fraction money management.

    Thanks!

    #106973 quote
    Nicolas
    Keymaster
    Master

    Add the code snippet at the top of your trading strategy’s code and use the variable POSITIONSIZE for your orders:

    if buycondition then 
     buy POSITIONSIZE contracts at market 
    endif
    #106996 quote
    Fran55
    Participant
    Veteran

    And which is the buyconditión in the two cases?

    #107025 quote
    Nicolas
    Keymaster
    Master

    It was just an example, “buycondition” is the condition to initiate a buy order in your own strategy.

    #119696 quote
    nonetheless
    Participant
    Master

    I’ve been playing with the money management code posted above by @Despair based on fixed ratio theory by Ryan Jones http://www.straightforex.com/advanced-forex-course/money-management/fixed-ratio/

    My very minor modifications:

    MM = 1 //select MM = 0 for optimization
    if MM = 1 then
    once multiplier=1
    once fraction=1400 //set to 10x margin required
    once newlevel=1400 
    once oldlevel=1400 
    once startpositionsize=1
    once positionsize=startpositionsize
    if strategyprofit>newlevel then
    multiplier=multiplier+1
    oldlevel=newlevel
    newlevel=strategyprofit+multiplier*fraction
    positionsize=multiplier*startpositionsize
    elsif strategyprofit<oldlevel and multiplier>=2 then
    newlevel=strategyprofit
    oldlevel=strategyprofit-multiplier*fraction
    multiplier=multiplier-1
    positionsize=multiplier*startpositionsize
    endif
    endif
    if MM=0 then
    positionsize=1
    endif

    The idea is to keep the required margin for any position size to within 10% of running profit. This code works well at increasing position size for every £1400 of profit (margin in this case = £136), but fails to reduce accordingly. For example, after a £2800 loss in backtest I would expect to see position size reduce by 2; in fact it is only ever reducing by 1 no matter what size the loss and decrease in profits. Position size then becomes unsustainably large and the whole thing runs into trouble, eating into working capital in order to keep going.

    I’ve looked at all the other MM snippets I could find but this is the one that comes closest to what I want; v grateful for any help in improving it!

    #119700 quote
    nonetheless
    Participant
    Master

    This is another possibility that comes close, based on a percentage system posted by @robertogozzi

    ONCE MyEquity = 10000
    ONCE positionsize    = 1
    IF Not OnMarket THEN
    IF Strategyprofit >= (MyEquity + 1400) THEN
    MyEquity = Strategyprofit
    positionsize = positionsize + 1
    if positionsize + 1 > 55 then
    positionsize =55
    endif
    ELSIF Strategyprofit <= (MyEquity -1400) THEN
    MyEquity = Strategyprofit
    positionsize = positionsize - 1
    positionsize = max(1, positionsize)    //do not allow nLots to fall below 1
    ENDIF
    ENDIF

    But in back testing has the same problem, only reduces by 1 no matter what the drop in profit.

    #119720 quote
    nonetheless
    Participant
    Master

    This seems to work, if some very clever person wouldn’t mind checking the code for me, thanks.

    Turns out that margin at 10% of strategy profit is unworkable; 3 – 5% is more realistic.

    //Money Management
    MM = 0 //MM = 0 for strategy optimization
    if MM = 1 then
    ONCE startpositionsize = 1
    ONCE factor = f*margin // insert margin value and optimize for value of f after strategy optimization, typically between 15 and 30
    ONCE maxpositionsize = 55 //IG first tier margin limit
    IF Not OnMarket THEN
    positionsize = startpositionsize + Strategyprofit/factor
    ENDIF
    IF Not OnMarket THEN
    if startpositionsize + Strategyprofit/factor < startpositionsize THEN
    positionsize = startpositionsize
    ENDIF
    IF startpositionsize + Strategyprofit/factor > maxpositionsize then
    positionsize = maxpositionsize
    ENDIF
    ENDIF
    ENDIF
    if MM=0 then
    positionsize=1
    ENDIF
    #120023 quote
    nonetheless
    Participant
    Master

    Final version

    //Money Management
    MM = 1 // = 0 for optimization
    if MM = 0 then
    positionsize=1
    ENDIF
    if MM = 1 then
    ONCE startpositionsize = 1
    ONCE factor = 15 // factor of 15 means margin will increase/decrease @ 6.6% of strategy profit; factor 10 = 10% 20 = 5% etc — optimize for best result, profit vs drawdown
    ONCE margin = 137 // enter margin value of 1 contract
    ONCE maxpositionsize = 27 // DOW $2 IG first tier margin limit
    ONCE minpositionsize = .5 // enter minimum position allowed
    IF Not OnMarket THEN
    positionsize = startpositionsize + Strategyprofit/(factor*margin)
    ENDIF
    IF Not OnMarket THEN
    if startpositionsize + Strategyprofit/(factor*margin) < minpositionsize THEN
    positionsize = minpositionsize //keeps positionsize from going below allowed minimum
    ENDIF
    IF startpositionsize + Strategyprofit/(factor*margin) > maxpositionsize then
    positionsize = maxpositionsize// keeps positionsize from going above IG first tier margin limit
    ENDIF
    ENDIF
    ENDIF
    
    Nicolas thanked this post
    #156917 quote
    Nobody
    Participant
    Veteran

    “”  Position Size Management – Performance based increases “”

    Personally i just use a dynamic position size based on equity . Equity rises = size rises at least as a dollar value and naturally Equity drops position size as a dollar value decreases  .  As far as consecutive losses/ wins i fail to see a benefit in changing relative risk    If you have an excessive run of losses relative to the expectancy i dont think you need to be thinking of reducing size , more like turn it of .  You need a probability matrix based from the tested winrate to define whats is an abnormally large run of losses  to determine when something is drastically wrong ( broken) where rectification of parameters etc needs attention .  My dynamic sizing is as simple as  initial capital / close + strategyprofit/close  (adjusted by whatever coefficient to provide whatever leverage you require)   . it works for me and at least  reduce risk of ruin  after equity runup  .  Naturally if the consec loses happens from the getgo it wont help risk of ruin but then you got other issues , a sh*t system .  Anyway i think this is something to consider  . cheers

     

    PS sometimes a large run of losses is just a shit happens where nothing is really wrong with system  , but you need to know at what level of consec losses you need to worry  . Reducing size relative to consec losses might keep you in the game longer but it also means you need a lot more consec winners to get back to status quo

    Bel thanked this post
    #156928 quote
    Monobrow
    Participant
    Senior

    what level of consec losses you need to worry

    Interesting thoughts…

     

    in very general terms, or rather in your experience / with your systems, in how many consecutive losses would you be turning off your systems?

    #156933 quote
    Nobody
    Participant
    Veteran

    what level of consec losses you need to worry

    Interesting thoughts…

    in very general terms, or rather in your experience / with your systems, in how many consecutive losses would you be turning off your systems?

    Its not a simple ‘ x’ losses number as a number of factors are needed to ascertain the amount . Expectancy is a factor and that is derived from 2 metrics being win rate (WR) & risk reward ratio   .  Your risk tolerance which forms the risk of ruin (RoR) side of it is another factor   .  The higher your expectancy  the more you can risk per trade as a % of equity without increasing RoR .  The better the win rate the less the probability of  higher consec losses over ‘x’ trades is  . This is whay i always prefer a higher WR system over lower WR given same expectancy  .  Statistically you will have smaller consec lose runs which gives you to risk slighty more per trade without increasing RoR  . Now this is where a probabilty matrix comes in  , you can feed in WR as % and it will give you the probabilty of ‘x’ consec losing trades over ‘y’ amount of trades . using this info you can dial in an optimal position size that allows max equity curve growth while keeping RoR within risk parameters you are comfortable with  .  IE how much you are willing to risk per trade  .  You really need to find a consec loss probability matrix excel spreadsheet to do this  . You might be able to find one if you google it . I dont think i can share an excel file in PRC .        You need to explore the expectancy formula as well and thats easily found in google .   I dont have time to write everything you need to know here and now .  I suggest you get some literature on building quantitative trading systems .

    https://vantagepointtrading.com/what-is-trading-expectancy-and-how-it-works/ this the first thing i found in google search , get busy and see if you can work it out , will try and find a probability matrix online if i can . I am actually trading atm so time poor for such a complex thing right now

    Monobrow and Bel thanked this post
    #156935 quote
    Vonasi
    Moderator
    Master

    I dont think i can share an excel file in PRC

    Excel files can be attached to your posts.

    Please consider this when answering posts Brisvegas:

    • Be careful when quoting others in your posts. Only use the quote option when you need to highlight a particular bit of text that you are referring to or to highlight that you are replying to a particular member if there are several involved in a conversation. Do not include large amounts of code in your quotes. Just highlight the text you want to quote and then click on ‘Quote’.
    #156937 quote
    Nobody
    Participant
    Veteran

     

    This may help , currently  havent got time to check whether this is exactly whats required , will check over weekend and get back to you once i have time

    https://www.daytradinglife.com/trading-spreadsheets/losing-streak-probability-calculator/

    Monobrow and Bel thanked this post
    #156938 quote
    Monobrow
    Participant
    Senior

    Thanks again, your response gave me the answer i needed.

    I found a website with exactly what you described (https://www.newtraderu.com/2020/07/22/risk-of-ruin-calculator/) and found – through more luck than judgement that the 6 consecutive loss limit I set on my 70% WR aystem was more or less what I needed, in fact. i could probably go up to 7 if needed.

     

    cheers

    #156942 quote
    Monobrow
    Participant
    Senior

    will check over weekend and get back to you once i have time

    Thanks Bris. Yeah, I found one before I saw your post. My system is a 24/5 reversal system so I wanted to have something in there to protect against significant and continuous movements in one direction. Im not sure of there is a better way to do it, but a quit on consecutive losses seemed like a place to start.

Viewing 15 posts - 16 through 30 (of 32 total)
  • You must be logged in to reply to this topic.

Position Size Management – Performance based increases


ProOrder support

New Reply
Author
author-avatar
Maz @eqmaz Participant
Summary

This topic contains 31 replies,
has 5 voices, and was last updated by JS
1 year, 5 months ago.

Topic Details
Forum: ProOrder support
Language: English
Started: 05/12/2017
Status: Active
Attachments: 2 files
Logo Logo
Loading...