Risk increased when you hit a target money management

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #104104 quote
    Vonasi
    Moderator
    Master

    First of all a warning – this code includes some averaging down which can be unhealthy for your bank balance!

    That warning aside I actually coded this as an attempt to remove some of the risk of averaging down until you are actually playing with money that you have won. Ages ago I read something on a trading forum where some traders were trying to see if it was possible to make a lot of money from a very small starting capital. Some traders wanted to start with high risk and reduce it if you got lucky with the first few bets and others thought it better to start with low risk and increase it if you gain something. The general idea for either method was that the low starting capital is not much money so you are not very worried about losing it all but if you could turn that little bit of money into something a bit bigger in a few bets then you start to get some real money to work with so you can start to increase your exposure and risk. You might suddenly lose it all but hey it wasn’t much anyway and if you went broke after being up a few quid well that was all part of the risk you were willing to take. My code is from the slowly increasing risk side of the argument.

    This code is not a complete strategy but just enter your own buy and sell conditions to make it work. I was testing on the weekly chart as I just thought it would be fun to place one trade a week and let it play out – either we get rich or we lose our tiny little starting capital. Obviously leverage means that we could lose more but I am ignoring that little fact!

    The idea is that we set a target and when/if we achieve that target we start increasing our risk by increasing the maximum number of positions we allow to be open and also how long we allow them to be open before giving up and closing them. Anytime we are in profit we just take it at the open of the week. When we hit our target we set a new higher target. There is averaging down but we can start with only a few positions (or even just one so no averaging down) to limit our early risk and then increase it once we are trading with money that is not just our original starting capital.

    The time exposed on the market theory is that when we don’t have much money then we do not want to be holding on for weeks waiting for a profit if the market is going into free fall. Best to just get out early whilst our capital is small. Later when we have more capital we can increase our exposure and ride out some bigger downturns. The start time for a trade is calculated as an average of the time the first trade was opened and the time the last trade was opened. The exit time is then added onto this. If a new trade is opened then a new exit time is calculated based on the new average time.

    There is also a filter that stops new trades being opened if we drop below the closing price x candles back. A simple filter but one that is very easy to curve fit so be careful with it!

    This sort of money management is probably more suited to non spread betting style methods but it is still interesting to test it here. The second image shows the increasing targets and increasing number of positions and time allowed on market.

    I did some tests on the DJI starting with a tiny starting capital of just £200 and if you got lucky then since 1995 when I started my test you could have turned it into a very nice amount of money…. or lost it all.

    It is fun to play around with the variables (which are explained in the code) and see how lucky you can get! Please remember that I wrote it for trading weekly on the DJI or SP500 or similar indexes and really for longer term investing so it is unlikely to work very well elsewhere or on faster time frames.

    x = 25 //candles used in the stop trading if below close[x] filter
    percstep = 1000 //% of equity increase required to increase risk
    once maxpositions = 1 //starting number of maximum positions allowed to be opened
    capital = 200 //starting capital
    once weekson = 20 //starting number of weeks allowed on the market
    weekstep = 1 //number of weeks added to increase trade length when target reached
    sizestep = 1 // number of extra allowed positions added when target reached
    
    once myperc = percstep
    equity = capital + strategyprofit
    mytarget = capital * (1+(myperc/100))
    
    if equity > mytarget then
    maxpositions = maxpositions + sizestep
    myperc = myperc + percstep
    weekson = weekson + weekstep
    endif
    
    if not onmarket and (your entry conditions) and low > close[x] then
    buy 1 contract at market
    endif
    
    if onmarket and (your entry conditions) and low > close[x] and high < positionprice and countofposition < maxpositions then
    buy 1 contract at market
    startindex = barindex + 1
    endif
    
    if onmarket and close > positionprice then
    sell at market
    endif
    
    if onmarket and barindex - ((tradeindex + startindex)/2) >= weekson then
    sell at market
    endif
    
    graph maxpositions
    graph equity
    graph mytarget
    graph weekson
    
    Screenshot_6-1.png Screenshot_6-1.png Screenshot_7-1.png Screenshot_7-1.png
    #104166 quote
    Vonasi
    Moderator
    Master

    I decided to convert the code into the complete opposite. in this version you can start off with a lot of risk and exposure and then if you don’t immediately lose it all then as your capital increases the number of positions you allow to be opened at the same time to average down and the number of days you allow a position to be on the market reduces.

    In the image a simple set of price action conditions on the weekly DJI turned a £750 starting capital into £26056 from a starting date at the beginning of 1995.

    Once again this is all just experimentation and not a recommended way to trade!

    //Decreasing risk as targets reached.
    
    percstep = 100 //% of equity increase required to increase risk
    once maxpositions = 10 //starting number of maximum positions allowed to be opened
    minpositions = 2 //minimum number of positions allowed to be opened
    capital = 750 //starting capital
    once weekson = 52 //starting number of weeks allowed on the market
    minweeks = 26
    weekstep = 0.25 //number of weeks added to increase trade length when target reached
    sizestep = 0.25 // number of extra allowed positions added when target reached
    
    once myperc = percstep
    equity = capital + strategyprofit
    mytarget = capital * (1+(myperc/100))
    
    if equity > mytarget then
    maxpositions = max(minpositions,maxpositions - sizestep)
    myperc = myperc + percstep
    weekson = max(minweeks,weekson - weekstep)
    endif
    
    if not onmarket and (your long entry conditions) and low > close[x] then
    buy 1 contract at market
    endif
    
    if onmarket and (your long entry conditions) and low > close[x] and high < positionprice and countofposition < maxpositions then
    buy 1 contract at market
    startindex = barindex + 1
    endif
    
    if onmarket and close > positionprice then
    sell at market
    endif
    
    if onmarket and barindex - ((tradeindex + startindex)/2) >= weekson then
    sell at market
    endif
    
    graph maxpositions
    graph equity
    graph mytarget
    graph weekson
    
    Screenshot_8.png Screenshot_8.png
    #104182 quote
    GraHal
    Participant
    Master

    Thank you Vonasi for your time and sharing your work.

    I am using – to good effect – your Trailing Stop / Profit snippet in a few of my strategies.

    I will try out above when I get chance.

    #104188 quote
    Vonasi
    Moderator
    Master

    These ideas are really just for the pure gambler who is wanting to start small and see if he can win the lottery. they are fun to try out but I do not recommend trading with them unless you are that type of gambler. 🙂

    #105182 quote
    Nicolas
    Keymaster
    Master

    Another fun thing to try is to double up the lot size if you won the last order but with the same stoploss size each time.

    1st order : lot = 10 ; risk = 100$ ; profit = 200$

    2nd order : lot = 20 ; risk = 200$ ; profit = 400$

    3r order : lot = 40 ; risk = 400$ ; profit = 800$

    etc.

    Of course you have to won multiple times in the same row. But with only risking 100$, you could have won 800$. In this example I used a 1:2 risk/reward ratio, but it could also be less than that.

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

Risk increased when you hit a target money management


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Vonasi @vonasi Moderator
Summary

This topic contains 4 replies,
has 3 voices, and was last updated by Nicolas
6 years, 6 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 08/03/2019
Status: Active
Attachments: 3 files
Logo Logo
Loading...