Hold over the weekend or not test

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

    I have been working on weekly strategies recently and with the new MTF feature it is now possible to open a trade on a weekly chart but close it at a time that might be more beneficial using MTF. So I decided to try to quantify it by writing a ‘fake’ strategy that checks the difference between a closing time on Friday and a selling time on Monday. For example you may decide at the close of Friday that you want to close your position but hold on to it until the markets open on Monday morning and the spread drops to a more sensible level before closing it. Obviously price can move for or against you in this time so I thought it would be nice to see what it does on average. I also then added in a calculation for over night fees for the weekend days. This can be turned on or off in the code.

    It is for long positions on indices only. Apply it to hourly charts or 30 minute charts if your market closes or opens on the half hour.

    lasttime = 230000     //Last candle time of the week minus 010000
    openingtime = 080000  //Opening time of the market on Monday
    fees = 1              //Weekend fees included in calculation. 1 = on and 0 = off
    
    PositionSize = 1
    BrokerFee = 2.5       //Broker Fee for overnight calculation
    Libor = 0.4728        //Current overnight Libor rate
    //
    LongFee = Round(((PositionSize * close) * (((BrokerFee/100) + (Libor/100))/365))*100)/100
    
    if lasttime > 210000 then
    TotalLongFee = (LongFee * 2)
    else
    TotalLongFee = (LongFee * 3)
    endif
    
    if opentime = lasttime and opendayofweek = 5 then
    closingprice = close
    flag = 1
    endif
    
    if opentime = openingtime and opendayofweek >= 1 and flag = 1 then
    openprice = open
    difference = (openprice - closingprice)
    total = total + difference
    if fees then
    total = total - (TotalLongFee)
    endif
    number = number + 1
    endif
    
    if average[2] = -200 then
    buy 1 contract at market
    endif
    
    ave = total/number
    
    graph total as "Total Difference"
    graph ave as "Average"
    

    [attachment file=76633]

    The above is for the FTSE100 selling at 0800 on Monday with weekend fees included compared to selling at midnight on Friday. It can be seen that you would be on average 4.2139 pips worse off by waiting till the Monday open to sell but the spread would be 1 instead of the 4 that it is on Friday night so you would gain 3 of those pips back. Still you would be better on average to just close the trade on Friday at midnight with the larger spread.

    My brief check of popular markets seems to indicate that we worry about the spread and overnight fees too much and the difference is minimal and it is usually beneficial just to close the trade earlier and take the hit on the larger spread and save any extra fees too.

    Roberto S. thanked this post
    Screenshot_4-8.png Screenshot_4-8.png
    #76638 quote
    Vonasi
    Moderator
    Master

    Here is the same FTSE100 but with the Friday night get out time moved to before the 2200 fees charge cut off time. At this time the spread should be the same as at the Monday open at 0800 so that can be discounted from our calculations. On average there has been a tiny advantage to selling early but it has not always been the case over the last few years and for a while it was a big disadvantage to sell early. I think this clearly shows that exit times and overnight fees are not very relevant to our decision to exit a trade before or after a weekend. I guess if you are in a profit on a Friday then you might as well get out and lock in the profit just before the 2200 cut off – on average you will come out the same but it is risk off the table over the weekend – that is for the FTSE100 at least based on the last few years data.

    [attachment file=76639]

    Screenshot_5-3.png Screenshot_5-3.png
    #76642 quote
    Vonasi
    Moderator
    Master

    The DAX is an interesting market for this test. Here is the results of closing a trade before the Friday 2200 cut off compared to selling at 0800 on Monday morning.

    [attachment file=76643]

    Clearly over the last couple of years and on average it has been better to hold over the weekend and pay the 3 days fees and sell on Monday morning. The Dax has a spread of 5.0 between 2100 and 0700 and on Monday at 0800 just 1.0 so you also gain an extra 4 pips there too.

    Screenshot_6-3.png Screenshot_6-3.png
    #76829 quote
    Vonasi
    Moderator
    Master

    Today I found a strategy that I wrote ages ago and left to one side for some reason. I don’t remember what market or what time frame I wrote it for but today I accidentally started it on a weekly time frame chart of the DJI and it worked really well! So I’ve spent the day testing it and simplifying it and convinced myself that I should forward test it. I then decided to see what would happen if instead of selling at the close of the weekly candle I made the decision to sell at the close of the weekly candle but actually held off and sold during the following week during trading hours when the spread was lower (as long as it was still in profit).

    Here are the images:

    No MTF in the code – just sell at close of weekly candle:

    [attachment file=”Weekly 2.4 Spread.png”]

    ..and MTF sell during trading hours:

    [attachment file=”Intraday exit 1.6 Spread.png”]

    It actually proved better to hold and sell at the open.

    I then decided to move the first entry time to 30 minutes after the market open so that I could use the hourly charts and have a bit more data to test on. This then changed the results so that it was better to sell at the end of the week and not wait for the lower spread.

    Sell at end of week image:

    [attachment file=”End of week exit 2.4 spread.png”]

    …and sell at lower spread intraday image:

    [attachment file=”MTF exit Spread 1.6.png”]

    This seems to confirm my earlier theory that there really isn’t much difference between holding or selling immediately. I shall run the MTF version alongside the end of week version on forward test for comparison.

    End-of-week-exit-2.4-spread.png End-of-week-exit-2.4-spread.png MTF-exit-Spread-1.6.png MTF-exit-Spread-1.6.png Weekly-2.4-Spread.png Weekly-2.4-Spread.png Intraday-exit-1.6-Spread.png Intraday-exit-1.6-Spread.png
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

Hold over the weekend or not test


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Vonasi @vonasi Moderator
Summary

This topic contains 3 replies,
has 1 voice, and was last updated by Vonasi
7 years, 7 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 07/24/2018
Status: Active
Attachments: 7 files
Logo Logo
Loading...