scanning 1st hour Gapups

#1
Hi Everyone,

Wrote a code for scanning 1st hr gap ups on multiple days(e.g last 15 days) as follows:

//to explore daily gap up in hourly charts

for(x=1;abs(x*-7+1)<BarCount;x++)

Filter=Ref(GapUp(),x*-7+1);


No syntax error is showing in Amibroker,but exploration is not able to find any stocks.Can anybody help please.

thanks
PKJ
 

GTji

Active Member
#2
Hi Everyone,

Wrote a code for scanning 1st hr gap ups on multiple days(e.g last 15 days) as follows:

//to explore daily gap up in hourly charts

for(x=1;abs(x*-7+1)<BarCount;x++)

Filter=Ref(GapUp(),x*-7+1);


No syntax error is showing in Amibroker,but exploration is not able to find any stocks.Can anybody help please.

thanks
PKJ
Is this the whole code? It looks kind of incomplete. Where are the opening price and close price arrays?
 

sudris

Well-Known Member
#3
Hi Everyone,

Wrote a code for scanning 1st hr gap ups on multiple days(e.g last 15 days) as follows:

//to explore daily gap up in hourly charts

for(x=1;abs(x*-7+1)<BarCount;x++)

Filter=Ref(GapUp(),x*-7+1);


No syntax error is showing in Amibroker,but exploration is not able to find any stocks.Can anybody help please.

thanks
PKJ
when x=1 you get bar number 6 (actually 5 as the barcount is zero based....so 0 to 5 both inclusive makes 6)
when x=2 you get bar number 13 ...(12.....)

also, the GapUp function will work on daily time frame only

probably you have to use something like this

TimeFrameSet function to set hourly candles
for(x=0;x<BarCount;x=x+7)
...your code for defining gapup..(here the previous days's last bar will x-1 and not Ref(x,-1))
do abc here..........
TimeFrameRestore function to restore time interval
OR do abc here.......
 
#4
Hi GTji,
Thanks for ur reply.Yes, this is as much as I have written.In fact I am new to writing codes.I just wanted to scan/explore all the NIFTY stocks for last 15 days for 1st hr gap up and wrote the code.The Amibroker autoanalysis does not indicate error but exploration does not return any result.Interestingily when I substituted" -75" for" Barcount" the exploration picked up some scrips but I couldnt find the GapUps in them.Pl help.
thanks
PKJ
 
#6
Sudris,
Thanks a whole lot!
Your suggestion worked like a song!
Here is the corrected code for scanning for 1st hour GapUps:
//corrected code for scanning 1st hr gap ups
TimeFrameSet(3600);
for(x=0;x<BarCount;x=x+7)
Filter=GapUp();


Can you help to add arrows to each occurrence of the Gap Ups?

thanks a lot again!

PKJ
 

sudris

Well-Known Member
#7
I think you have misread my earlier post.

the inbuilt function of GapUP and GapDown will work only on daily timeframes and not on lesser time intervals. whereas you wish to find gaps on hourly candles.
I repeat, you have to define your gap-up formula for hourly bars.
and then restore the timeframe ....
 
#8
Thanks Sudris, for the guidance.I will try it out and will let you know.Meanwhile

can you suggest a way to display arrows to mark the gaps on chart ?

thanks

PKJ