Adjusted time in market based on performance

Forums ProRealTime English forum ProOrder support Adjusted time in market based on performance

This topic contains 4 replies, has 3 voices, and was last updated by avatar Vonasi 6 months, 2 weeks ago.

Currently, there are 1 user and 1 guest visiting this topic.
View all attachments
Viewing 5 posts - 1 through 5 (of 5 total)
  • #103621

    Time in the market is an important factor – often it is good to give a trade time to achieve what you expect but increased time on the market can also be increased risk exposure. I got thinking about this and decided to write some code to vary the exposure to risk as a strategy trades and came up with the following that I post here just in case it is of interest to anyone. It is not a complete strategy – you have to enter your own long and short entry conditions to make it work! I created it around an end of day strategy idea but it should work on other time frames. In the following description I refer to ‘days’ but you might want to think in candles for other time frames.

    The idea is that you can set a maximum number of days that you want a trade to stay open (minD) and then get out as soon as a candle closes in profit or time runs out as you reach the maximum number of days. If it is a profitable trade then the exposure time for the next trade is increased by one day. This continues up to a maximum number of days which is maxD. If a trade is a losing trade then the number of days is reset back to minD.

    There is also an averaging down part of the code which can be turned on or off by setting ‘AverageDown’ to 1 or 0. With this turned on if we are in a trade already and it is losing and entry conditions are true again then an extra position is opened. Normally this would be a dangerous game but our maximum days allowed in the market allows us to reduce our potential risk as we can only lose as much as a market would normally move from our average price in our maximum allowed number of days (we hope!).

    There is also ‘PositionSizing’ that can be turned on or off too. With it on the first position is opened at whatever we set ‘StartPositionSize’ at and then if we average down the size of the next trade is increased based on however many days is our current maximum allowed. Be warned that turning PositionSizing on can be very scary for your bank account!

    With a very simple set of price action entry conditions and position sizing turned off I was able to get the attached equity curve in the first image on EURUSD Daily with minD of 2 and maxD of 6.

    Please be aware that this was just an interesting experiment in the effects of adjusted market exposure based on trading performance and not a suggested way of going about trading – especially the averaging down with adjusted position sizing turned on – please see the very scary draw down in the second image as a warning!

    Enter your own long and short conditions in lines 7 and 8.

     

     

    Attachments:
    2 users thanked author for this post.
    #103632

    Link to above added to below with the Comment ,,,

    Concept more than a working strategy

    Snippet Link Library

    1 user thanked author for this post.
    #103668

    Hi Vonasi, interesting code and perhaps it could be used on the vectorial dax strategy.

    That strategy has a few issues, like

    • long costly exposure in the market
    • signals in the same direction are are ignored as long there is no exit criteria matched

    Trying to understand the code I’am focussing on the second paragraph.

    It’s also modified because the days had to be counted and not the bars on a 5min TF.

    To the entry conditions I ‘ve add startday=0

    Also changed positionprice to a positionperformance, otherwise it would get out too often. Hope its correctly coded, got to check it some more and try to expand it.

    #103672

    I’ve not really been following the Vectorial DAX in close detail so it is difficult for me to comment on this addition to it without going back over an awfully large number of posts to understand it all!

    My first thought was why over complicate things. 1 day is 288 * 5 minute candles so when a trade is opened and you want to give it a minimum number of days on the market then just set minD to a multiple of 288 and maxD to a multiple of 288.

    You would also need to change the line that increases the time in the market to add 288 candles on instead of just 1 candle:

     

    #103673

    Here is a stripped down version with the averaging down and position sizing removed and a step variable added for increasing the time in the market. Settings are for a 5 minute chart with minD of 2 days and MaxD of 6 days.

    Not tested.

     

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

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