Position Size Management – Performance based increases
Forums › ProRealTime English forum › ProOrder support › Position Size Management – Performance based increases
- This topic has 31 replies, 5 voices, and was last updated 3 months ago by JS.
Tagged: money management, position size
-
-
09/09/2019 at 1:50 PM #106961
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!
09/09/2019 at 2:33 PM #10697309/09/2019 at 7:08 PM #10699609/10/2019 at 7:43 AM #10702502/15/2020 at 5:03 PM #119696I’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:
1234567891011121314151617181920212223MM = 1 //select MM = 0 for optimizationif MM = 1 thenonce multiplier=1once fraction=1400 //set to 10x margin requiredonce newlevel=1400once oldlevel=1400once startpositionsize=1once positionsize=startpositionsizeif strategyprofit>newlevel thenmultiplier=multiplier+1oldlevel=newlevelnewlevel=strategyprofit+multiplier*fractionpositionsize=multiplier*startpositionsizeelsif strategyprofit<oldlevel and multiplier>=2 thennewlevel=strategyprofitoldlevel=strategyprofit-multiplier*fractionmultiplier=multiplier-1positionsize=multiplier*startpositionsizeendifendifif MM=0 thenpositionsize=1endifThe 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!
02/15/2020 at 5:42 PM #119700This is another possibility that comes close, based on a percentage system posted by @robertogozzi
123456789101112131415ONCE MyEquity = 10000ONCE positionsize = 1IF Not OnMarket THENIF Strategyprofit >= (MyEquity + 1400) THENMyEquity = Strategyprofitpositionsize = positionsize + 1if positionsize + 1 > 55 thenpositionsize =55endifELSIF Strategyprofit <= (MyEquity -1400) THENMyEquity = Strategyprofitpositionsize = positionsize - 1positionsize = max(1, positionsize) //do not allow nLots to fall below 1ENDIFENDIFBut in back testing has the same problem, only reduces by 1 no matter what the drop in profit.
02/16/2020 at 12:09 AM #119720This 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.
123456789101112131415161718192021//Money ManagementMM = 0 //MM = 0 for strategy optimizationif MM = 1 thenONCE startpositionsize = 1ONCE factor = f*margin // insert margin value and optimize for value of f after strategy optimization, typically between 15 and 30ONCE maxpositionsize = 55 //IG first tier margin limitIF Not OnMarket THENpositionsize = startpositionsize + Strategyprofit/factorENDIFIF Not OnMarket THENif startpositionsize + Strategyprofit/factor < startpositionsize THENpositionsize = startpositionsizeENDIFIF startpositionsize + Strategyprofit/factor > maxpositionsize thenpositionsize = maxpositionsizeENDIFENDIFENDIFif MM=0 thenpositionsize=1ENDIF02/20/2020 at 11:26 AM #120023Final version
1234567891011121314151617181920212223//Money ManagementMM = 1 // = 0 for optimizationif MM = 0 thenpositionsize=1ENDIFif MM = 1 thenONCE startpositionsize = 1ONCE 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 drawdownONCE margin = 137 // enter margin value of 1 contractONCE maxpositionsize = 27 // DOW $2 IG first tier margin limitONCE minpositionsize = .5 // enter minimum position allowedIF Not OnMarket THENpositionsize = startpositionsize + Strategyprofit/(factor*margin)ENDIFIF Not OnMarket THENif startpositionsize + Strategyprofit/(factor*margin) < minpositionsize THENpositionsize = minpositionsize //keeps positionsize from going below allowed minimumENDIFIF startpositionsize + Strategyprofit/(factor*margin) > maxpositionsize thenpositionsize = maxpositionsize// keeps positionsize from going above IG first tier margin limitENDIFENDIFENDIF1 user thanked author for this post.
01/08/2021 at 2:45 PM #156917“” 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
1 user thanked author for this post.
01/08/2021 at 3:35 PM #156928what 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?
01/08/2021 at 4:06 PM #156933what 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
01/08/2021 at 4:10 PM #156935I 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’.
01/08/2021 at 4:30 PM #156937This 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/
01/08/2021 at 4:32 PM #156938Thanks 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
01/08/2021 at 4:38 PM #156942will 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.
-
AuthorPosts