Stripping out times

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #134074 quote
    jonp1602
    Participant
    New

    Hi all,

    I’ve just relatively recently started running a few intraday trend following systems on US equites, generally they are performing ok, however more often than not they are getting whipped in the volatility at the US open, was just wondering if there is an easy way to strip out a period of the day, so the systems square up between say 14:00  – 15:00(BST) . Given I am using flat before/after code already for the close of day/reopen, I thought trying to use that code again is going to get messy. Any help appreciated.

    Cheers,

    #134075 quote
    Francesco
    Participant
    Veteran

    Just add time condition to your entry conditions, for example:

    defparam flatbefore= 090000
    defparam flatafter= 220000
    
    // Time Directions
    t1= time>090000 and time<140000
    t2= time>150000 and time<220000
    te= time=140000
    
    // Entry
    if your conditions then
    if t1 or t2 then
    buy/sellshort n contract at market
    endif
    endif
    
    // 14.00 Exit
    if longonmarket and te then
    sell at market
    endif
    
    if shortonmarket and te then
    exitshort at market
    endif

    I added a casual flatbefore and flatafter, you have to change it with your favorite time.

    #134163 quote
    jonp1602
    Participant
    New

    Thanks Francesco, perfect!

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

Stripping out times


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
jonp1602 @jonp1602 Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by jonp1602
5 years, 9 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 06/01/2020
Status: Active
Attachments: No files
Logo Logo
Loading...