[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Gaps (Fixed)



PureBytes Links

Trading Reference Links

Juan,

Here is a better version...
Tested it somewhat but I don't have the data to do a full check...
Try it and let me know...
            
            Walt

 /*********************************************/
// for intraday charts
//this assumes that the the last quote is yesterday & the first quote 
is today
//lb_gapClo = 1 when gap has been closed... 
// Walt Schwarz 6/12/2003
// Lb_gapInPlay = 1 when gap is not resolved
// Lb_gapInPlay = 0 when No gap or gap has been resolved 


ln_YestClose=0;
ln_TodayOpen=0;
Lb_test=0;
Ldt_dates=DateNum();
lb_dayChg=(DateNum() != Ref(DateNum(),-1)) & (0 != Ref(Close,-1) );
lb_hasGap = IIf(lb_dayChg & GapUp(),1,IIf(lb_dayChg & GapDown(),-
1,0));
ln_YestClose=ValueWhen(lb_hasGap!=0,Ref(Close,-1));
ln_TodayOpen=ValueWhen(lb_hasGap!=0,Close);
ln_gapDate=ValueWhen(lb_hasGap!=0,DateNum());

ln_diff=ln_TodayOpen-ln_yestClose;
Lb_test=((ln_diff > 0 & Close<=ln_yestClose)|(ln_diff < 0 & 
Close>=ln_yestClose));
Lb_test2=Cross(Lb_test,0) ;
Lb_gapInPlay=IIf(IsEmpty(ValueWhen(Lb_test2!=Lb_test,Lb_test2)),1,0)& 
Ldt_dates==ln_gapDate;
 
//Lb_gapInPlay = 1 when gap is not resolved

Plot(0,"Gap Closed",colorRed,styleLine);
Plot(Lb_gapInPlay,"YC="+WriteVal(ln_YestClose,8.2)+" TO="+WriteVal
(ln_TodayOpen)+" Gap Date="+WriteVal
(ln_gapDate,8.0,False),colorBlue,styleHistogram);


--- In amibroker@xxxxxxxxxxxxxxx, "hairy_mug" <WSCHWARZ@xxxx> wrote:
> Yes Juan,
>  The blue will display all day to indicate there
> was a gap since it shows weather the gap price was set; 
ln_todayOpen>0
> 
> The Lb_gapClo is the real indicator; gap open (=0) or gap resolved 
> (=1)
> 
> I was just showing colors so you could see conditions...
> 
> I'm working on an esoteric "curve-fit" system whereby I match
> the rsi produced by a combination of sines to the RSI of the stock 
> and then trade on the sine, not the stock price. Some interesting 
> progress so far... Lots of loops though and not for the "faint of 
> computer power"  :-)
> 
> I am finding 5 minutes is good BUT grouping five 1 minute bars 
gives 
> me more information than 1 bar every five minutes.
> 
>            Walt
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "emarco" <emarco@xxxx> wrote:
> > Walt,
> > 
> > thank you very much!!
> > I probably found some bugs in the indicator.Look at the pic I 
sent 
> you ...the gap is closed and the blue lines show up.
> > 
> > I think 5 to 10 minutes is a balanced timeframe in regards to 
> slippage, commisions, noise in indicators. Anyway, perhaps you can 
> fine tune your entry with lower timeframe (ie, 1 minute). My idea 
is 
> to look for very high prob trades ( return expectancy >0) in a 
bunch 
> of "range" and "trend" systems. They trade rarely. But if you 
combine 
> the best ones...looks good. I finished a new system today, but i 
have 
> to code it..... perhaps i would ask for more help.
> > What kind of systems do u develop.....trend , range or?? Any 
> insights to share?
> > I used MS as my first soft, NOT good as I thought. There is no 
> flexibility and the language is very tough. Amibroker is one of the 
> best or the best. I never tried TS nor Ensign...have you? Wealthlab 
> very difficult...and I think that's all there are no other well 
known 
> soft.
> > 
> > 
> > Here;s what I was coding for gaps.....does not work....but 
perhaps 
> it can be "fixed" easily.
> > 
> > x1 = IIf(GapUp(),1,IIf(GapDown(),-1,0));
> > 
> > x2 = IIf(x1!=0,Date(),0);
> > 
> > x3 = IIf(TimeNum()=93000 AND x1!=0,Ref(High,-1),IIf(x2=Date(),Ref
> (x3,-1),0);
> > 
> > x4= IIf(TimeNum()=93000 AND x1!=0,Ref(Low,-1),IIf(x2=Date(),Ref
(x4,-
> 1),0);
> > 
> > 
> > Thanks
> > 
> > Juan
> > 
> > 
> >   ----- Original Message ----- 
> >   From: walt 
> >   To: amibroker@xxxxxxxxxxxxxxx 
> >   Sent: Friday, June 13, 2003 1:13 AM
> >   Subject: RE: [amibroker] Gaps
> > 
> > 
> >   Here you are Juan;
> > 
> >   This will show blue when there is a gap and green when gap is 
> resolved...
> >   It will only work for intraday charts and you have to catch the 
> last quote of the previous day.
> > 
> >   BTW; Why did you pick 10 minute intervals?
> > 
> >                   Walt
> > 
> > 
> >   //*********************************************
> >   // for intraday charts
> >   //this assumes that the the last quote is yesterday & the first 
> quote is today
> >   //lb_gapClo = 1 when gap has been closed... 
> >   // Walt Schwarz 6/12/2003
> >   // blue shows when there is a gap, green when gap is resolved
> >   ln_YestClose=0;
> >   ln_TodayOpen=0;
> >   Lb_test=0;
> >   lb_dayChg=(DateNum() != Ref(DateNum(),-1)) & (0 != Ref(Close,-
> 1) );
> >   lb_hasGap = IIf(lb_dayChg & GapUp(),1,IIf(lb_dayChg & GapDown
(),-
> 1,0));
> >   ln_YestClose=ValueWhen(lb_hasGap!=0,Ref(Close,-1));
> >   ln_TodayOpen=ValueWhen(lb_hasGap!=0,Close);
> >   ln_diff=ln_TodayOpen-ln_yestClose;
> >   Lb_test=((ln_diff > 0 & Close<=ln_yestClose)|(ln_diff < 0 & 
> Close+.05>=ln_yestClose));
> >   Lb_test2=ValueWhen(ExRem(Lb_test,0),Lb_test);
> >   Lb_gapClo=IIf(IsEmpty(ValueWhen(ExRem
(Lb_test2,0),Lb_test2)),0,1);
> > 
> >   Plot(Lb_gapClo,"Gap Closed",colorGreen,styleHistogram);
> >   Plot(ln_todayOpen>0,"YC="+WriteVal(ln_YestClose,8.2)+" 
> TO="+WriteVal(ln_TodayOpen),IIf
> (lb_gapClo,colorGreen,colorBlue),styleHistogram);
> > 
> > 
> >     -----Original Message-----
> >     From: emarco [mailto:emarco@x...]
> >     Sent: Thursday, June 12, 2003 8:20 PM
> >     To: amibroker@xxxxxxxxxxxxxxx
> >     Subject: Re: [amibroker] Gaps
> > 
> > 
> >     thanks buddy!
> >     Since have you been developing systems?
> >     What do u trade?
> >     Regards
> > 
> >     Juan
> >       ----- Original Message ----- 
> >       From: walt 
> >       To: amibroker@xxxxxxxxxxxxxxx 
> >       Sent: Thursday, June 12, 2003 9:14 PM
> >       Subject: RE: [amibroker] Gaps
> > 
> > 
> >       I'm working on something...
> >       The gap should only be checked when the day changes from 
one 
> day to the next.
> >       I also want to keep track of an open gap so I'll keep 
you "in 
> the loop"...
> > 
> >                                       Walt
> >         -----Original Message-----
> >         From: emarco [mailto:emarco@x...]
> >         Sent: Thursday, June 12, 2003 7:58 PM
> >         To: amibroker@xxxxxxxxxxxxxxx
> >         Subject: Re: [amibroker] Gaps
> > 
> > 
> >         10 minute
> >         can u help me?
> >         thxs 
> > 
> >         jb
> >           ----- Original Message ----- 
> >           From: walt 
> >           To: amibroker@xxxxxxxxxxxxxxx 
> >           Sent: Thursday, June 12, 2003 8:19 PM
> >           Subject: RE: [amibroker] Gaps
> > 
> > 
> >           What time frame is your chart? 1 minute?
> >             -----Original Message-----
> >             From: emarco [mailto:emarco@x...]
> >             Sent: Thursday, June 12, 2003 6:26 PM
> >             To: amibroker@xxxxxxxxxxxxxxx
> >             Subject: Re: [amibroker] Gaps
> > 
> > 
> >             thnks!!
> > 
> >              is there any way to keep the gap true value until it 
> closes the gap. If during the day is not close, change to false gap 
> value?
> > 
> >             thnks again
> > 
> >               ----- Original Message ----- 
> >               From: Bob Jagow 
> >               To: amibroker@xxxxxxxxxxxxxxx 
> >               Sent: Thursday, June 12, 2003 7:09 PM
> >               Subject: RE: [amibroker] Gaps
> > 
> > 
> >               You have to assign IIF, Juan.
> >               x = IIf(GapUp(),1,IIf(GapDown(),-1,0));
> > 
> >               Plot(x,"Gaps",1,5);
> > 
> >                 -----Original Message-----
> >                 From: emarco [mailto:emarco@x...]
> >                 Sent: Thursday, June 12, 2003 2:19 PM
> >                 To: amibroker@xxxxxxxxxxxxxxx
> >                 Subject: [amibroker] Gaps
> > 
> > 
> >                 hello,
> > 
> >                            1) I am trying to identify gaps in my 
> system. Why i can't   plot "x"? 
> > 
> >                 IIf(GapUp(),x=1,IIf(GapDown(),x=-1,x=0));
> > 
> >                 Plot(x,"Gaps",1,3);
> > 
> > 
> > 
> >                 2) is there any way to:
> > 
> >                     a) identify only 4:10PM to 9:30 AM gaps.
> > 
> >                     b) keep the gap true value until it closes 
the 
> gap. If during the day is not close, change to false gap value.
> > 
> >                     Thanks
> > 
> > 
> > 
> >                 Juan
> > 
> > 
> > 
> >                 Send BUG REPORTS to bugs@xxxx
> >                 Send SUGGESTIONS to suggest@xxxx
> >                 -----------------------------------------
> >                 Post AmiQuote-related messages ONLY to: 
> amiquote@xxxxxxxxxxxxxxx 
> >                 (Web page: 
> http://groups.yahoo.com/group/amiquote/messages/)
> >                 --------------------------------------------
> >                 Check group FAQ at: 
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> > 
> >                 Your use of Yahoo! Groups is subject to the 
Yahoo! 
> Terms of Service. 
> > 
> > 
> > 
> >               Send BUG REPORTS to bugs@xxxx
> >               Send SUGGESTIONS to suggest@xxxx
> >               -----------------------------------------
> >               Post AmiQuote-related messages ONLY to: 
> amiquote@xxxxxxxxxxxxxxx 
> >               (Web page: 
> http://groups.yahoo.com/group/amiquote/messages/)
> >               --------------------------------------------
> >               Check group FAQ at: 
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> > 
> >               Your use of Yahoo! Groups is subject to the Yahoo! 
> Terms of Service. 
> > 
> > 
> > 
> >             Send BUG REPORTS to bugs@xxxx
> >             Send SUGGESTIONS to suggest@xxxx
> >             -----------------------------------------
> >             Post AmiQuote-related messages ONLY to: 
> amiquote@xxxxxxxxxxxxxxx 
> >             (Web page: 
> http://groups.yahoo.com/group/amiquote/messages/)
> >             --------------------------------------------
> >             Check group FAQ at: 
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> > 
> >             Your use of Yahoo! Groups is subject to the Yahoo! 
> Terms of Service. 
> > 
> > 
> > 
> >           Send BUG REPORTS to bugs@xxxx
> >           Send SUGGESTIONS to suggest@xxxx
> >           -----------------------------------------
> >           Post AmiQuote-related messages ONLY to: 
> amiquote@xxxxxxxxxxxxxxx 
> >           (Web page: 
> http://groups.yahoo.com/group/amiquote/messages/)
> >           --------------------------------------------
> >           Check group FAQ at: 
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> > 
> >           Your use of Yahoo! Groups is subject to the Yahoo! 
Terms 
> of Service. 
> > 
> > 
> > 
> >         Send BUG REPORTS to bugs@xxxx
> >         Send SUGGESTIONS to suggest@xxxx
> >         -----------------------------------------
> >         Post AmiQuote-related messages ONLY to: 
> amiquote@xxxxxxxxxxxxxxx 
> >         (Web page: 
http://groups.yahoo.com/group/amiquote/messages/)
> >         --------------------------------------------
> >         Check group FAQ at: 
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> > 
> >         Your use of Yahoo! Groups is subject to the Yahoo! Terms 
of 
> Service. 
> > 
> > 
> > 
> >       Send BUG REPORTS to bugs@xxxx
> >       Send SUGGESTIONS to suggest@xxxx
> >       -----------------------------------------
> >       Post AmiQuote-related messages ONLY to: 
> amiquote@xxxxxxxxxxxxxxx 
> >       (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> >       --------------------------------------------
> >       Check group FAQ at: 
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> > 
> >       Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
> Service. 
> > 
> > 
> > 
> >     Send BUG REPORTS to bugs@xxxx
> >     Send SUGGESTIONS to suggest@xxxx
> >     -----------------------------------------
> >     Post AmiQuote-related messages ONLY to: 
> amiquote@xxxxxxxxxxxxxxx 
> >     (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> >     --------------------------------------------
> >     Check group FAQ at: 
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> > 
> >     Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
> Service. 
> > 
> > 
> >         Yahoo! Groups Sponsor 
> >        
> >        
> > 
> >   Send BUG REPORTS to bugs@xxxx
> >   Send SUGGESTIONS to suggest@xxxx
> >   -----------------------------------------
> >   Post AmiQuote-related messages ONLY to: 
amiquote@xxxxxxxxxxxxxxx 
> >   (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> >   --------------------------------------------
> >   Check group FAQ at: 
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> > 
> >   Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
> Service.


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/Lj3uPC/Me7FAA/ySSFAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/