Stock Open Gap Strategy
- This topic has 5 replies, 2 voices, and was last updated 4 years ago by .
Viewing 6 posts - 1 through 6 (of 6 total)
Viewing 6 posts - 1 through 6 (of 6 total)
Similar topics:
Forums › ProRealTime English forum › ProOrder support › Stock Open Gap Strategy
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
I can convert the screener I wrote at https://www.prorealcode.com/topic/stock-gap-screener/#post-182120, if it’s what you wanted.
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.
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.
You can test this one (on 1-minute TF):
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
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 |
Find exclusive trading pro-tools on