Trading opening gap

Viewing 4 posts - 16 through 19 (of 19 total)
  • Author
    Posts
  • #227489 quote
    GraHal
    Participant
    Master

    four instances where it is true.

    So were trades opened?

    #227519 quote
    justisan
    Participant
    Junior

    please pay attention with cfd data what exactly prt indicates as day’s close & open (and high and low…). you can “graph” them e.g. on 1 min time frame and you will see for dax that “close” of the “yesterday” is in this case the close of the 1 minute bar which starts at 00:59:00 “today”, and “opening” of “today” is the opening of the bar which starts as right the next one, so at 01:00:00 “today”, e.g. picture attached. so time period between “close yesterday” and “opening today” being just millisecond/seconds there are basically have no gaps or to let’s say they are just fractions of points, in some cases very very few points.

    The four instances on 200k / 1min units backtest you mention – if I did my work correctly – are linked to some special confusion with data after weekends (you will find same/similar cases after other non-trading days like Easter or Christmas): prt treats monday’s data (sometimes also already sunday evenings data) from 00:00:00 till 01:00:00 as a separate “day”. So yep, you have those 4 instances where gap is > 0.002, but condition is true only until 01:00:00 and so not at 09:00:00 anymore (e.g second picture attached), hence system never “trading”.

    long story short: you might yourself define in the code what price at which time of the day you consider as day’s close and open – and then you will have “your” gaps and system triggering trade after trade😃 e.g. as with the code below.

    good luck!

    justisan

    //1 min time frame
    
    if time = 220000 then
    YClose = close
    endif
    if time = 090000 then
    TOpen = close
    endif
    
    Ogap = (TOpen-YClose)/YClose
    
    if time = 090000 and Ogap > 0.002 then
    sellshort 1 lot at market
    endif
    
    if time = 173000 then
    exitshort at market
    endif
    GraHal and upupandaway thanked this post
    close-yesterday-opening-today.png close-yesterday-opening-today.png mondays-data.png mondays-data.png
    #229033 quote
    upupandaway
    Participant
    New

    Thank you for your reply. I agree with your reasoning about what exact times PRT counts as closing time for the previous day, and for the opening time of current day (see earlier in the thread).

    I think your idea about modifying the code is great, but I was wondering:

    if you tell PRT that ‘YClose = close’ and ‘TOpen = close’, doesn’t that mean that both YClose and TOpen get the same value?

    #229035 quote
    PeterSt
    Participant
    Master

    Allow me :

    Haha, No. This is because YClose will receive the “closing” price as how it was on 22:00 (minus one bar) and TOpen will receive the closing price of how it was on 09:00 (minus one bar).

    🙂

Viewing 4 posts - 16 through 19 (of 19 total)
  • You must be logged in to reply to this topic.

Trading opening gap


General Trading: Market Analysis & Manual Trading

New Reply
Author
Summary

This topic contains 18 replies,
has 4 voices, and was last updated by PeterSt
1 year, 11 months ago.

Topic Details
Forum: General Trading: Market Analysis & Manual Trading
Language: English
Started: 02/02/2024
Status: Active
Attachments: 3 files
Logo Logo
Loading...