Stock Open Gap Strategy

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #182083 quote
    Amin1233
    Participant
    Junior

    Hi anyone knows how to code a strategy to

    If the open volume (volume of the first 1 min bar) is higher than the average open volumes (volume of the first 1 min bars ) of the past 10 days then

     

    if it opens 2% higher than past 10 days highest , buy at the market . If stock opens 2% lower than the lowest of the past 10 days sell short at market.

    Thanks

    #182135 quote
    robertogozzi
    Moderator
    Master

    I can convert the screener I wrote at https://www.prorealcode.com/topic/stock-gap-screener/#post-182120, if it’s what you wanted.

    #182170 quote
    Amin1233
    Participant
    Junior

    Thanks for reply. The problem is the volume, if we say volume > average (10) volume. If it is comparing the whole day volume. It will not show the gap stock in the screener probably until the end of the trading day where the volume reach to the above average of past 10 days.

    #182171 quote
    robertogozzi
    Moderator
    Master

    For strategies it is possible to average only the first minute for each of the last 10 days, as they support 200K units, which provides roughly 6 months of data history.

    I will code it asap.

    Amin1233 thanked this post
    #182172 quote
    Amin1233
    Participant
    Junior

    For Screener , if it is 246 bar only , is it possible to compare the volume of the first 20 minutes bar of the last 10 days?

    #182580 quote
    robertogozzi
    Moderator
    Master

    You can test this one (on 1-minute TF):

    DEFPARAM CumulateOrders = False
    DEFPARAM PreLoadBars    = 10000
    //
    Timeframe(1 minute,default)
    CheckTime = 090000     //First minute
    N         = 10         //10  days
    LotSize   = 100        //100 shares
    Timeframe(Daily,UpdateOnClose)
    LL = lowest[N](low)
    HH = highest[N](high)
    //
    Timeframe(Daily,Default)
    c1 = 0
    c2 = 0
    c1 = open >= (HH[1] * 1.02)   //previous high + 2%
    c2 = open <= (LL[1] * 0.98)   //previous Low  - 2%
    //
    Timeframe(1 minute,UpdateOnClose)
    t         = 0
    VL        = 0
    IF BarIndex <=1 THEN
       FOR j = 1 TO N
          $VL1[j] = 0
       NEXT
    ENDIF
    IF OpenTime = CheckTime THEN
       Tally = 0
       FOR j = N DOWNTO 2
          Tally   = Tally + $VL1[j]
          $VL1[j] = $VL1[j - 1]
       NEXT
       $VL1[1] = volume
       Tally   = Tally + volume
       FirstMINUTE = Tally / N
    ENDIF
    //
    Timeframe(1 minute,default)
    c3 = 0
    IF (BarIndex >= (N * 1440)) AND (OpenTime = CheckTime) THEN
       c3 = volume > FirstMINUTE
       IF c3 THEN
          IF c1 AND Not OnMarket THEN
             BUY LotSize CONTRACT AT Market
          ENDIF
          IF c2 AND Not OnMarket THEN
             SELLSHORT LotSize CONTRACT AT Market
          ENDIF
          SET TARGET pPROFIT 300
          SET STOP   pLOSS   100
       ENDIF
    ENDIF
    MySystem.itf
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

Stock Open Gap Strategy


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Amin1233 @amin1233 Participant
Summary

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

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 11/22/2021
Status: Active
Attachments: 1 files
Logo Logo
Loading...