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

Re: [amibroker] Re: How To Get HHV( High, between 09:30 and 10:30 )



PureBytes Links

Trading Reference Links

i didn't know about this plugin.

I coded it using the plugin. However again if you change the timeframe from 1-minute to 5-minute it seems to give problem,

Ed



startTime = 153000; 
EndTime = 163000; 

hgh = deTimeRangeHHV( H, startTime, endTime); 
lwl = deTimeRangeLLV( L, startTime, endTime); 

phgh = deValueWhenTime( hgh, endTime); phgh = IIf(TimeNum() >= startTime AND TimeNum() <= endTime,Null,phgh); 
plwl = deValueWhenTime( lwl, endTime); plwl = IIf(TimeNum() >= startTime AND TimeNum() <= endTime,Null,plwl); 
pcls = deValueWhenTime ( C, endTime); pcls = IIf(TimeNum() >= startTime AND TimeNum() <= endTime,Null,pcls); 

SetChartOptions(0, chartShowDates); 
Plot(C,"",1,64); 
Plot(phgh,"high",colorGold,styleLine); 
Plot(plwl,"high",colorBrightGreen,styleLine); 
Plot(pcls,"close",colorLightBlue,styleLine); 






  ----- Original Message ----- 
  From: Lester Vanhoff 
  To: amibroker@xxxxxxxxxxxxxxx 
  Sent: Monday, February 12, 2007 1:50 PM
  Subject: [amibroker] Re: How To Get HHV( High, between 09:30 and 10:30 )


  Thanks, Anthony. This looks like the easiest solution. I'll check that later:

  deTimeRangeHHV( array, starttime, endtime);
  deTimeRangeLLV( array, starttime, endtime);
  deValueWhenTime ( array, time);

  Lester

  --- In amibroker@xxxxxxxxxxxxxxx, "Anthony Faragasso" <ajf1111@xxx> wrote:
  >
  > Lester,
  > 
  > Using the deDateTime.dll plugin from the 3rd party area...I have never had any problems accessing the data at certain times...
  > 
  > Anthony
  > ----- Original Message ----- 
  > From: Lester Vanhoff 
  > To: amibroker@xxxxxxxxxxxxxxx 
  > Sent: Monday, February 12, 2007 7:11 AM
  > Subject: [amibroker] Re: How To Get HHV( High, between 09:30 and 10:30 )
  > 
  > 
  > Thanks for help. There are two issues here.
  > 
  > 1) Bill's formula is shorter but on some days it somehow excludes the first bar (09:30:00 one) from calculations. For example on NQ-H7 five minute chart:
  > 
  > - 2006-12-13: incorrect High
  > - 2007-01-19: incorrect Low
  > - 2007-01-26: incorrect High
  > 
  > I double checked my one-minute data and there is nothing missing there. It would be interesting to find out why this is happening.
  > 
  > http://img227.imageshack.us/img227/1142/02122007062358ca3.png
  > 
  > 2) Edward's formula is the hell of a code. I tried to add Lowest Low plot but adding the following line simply wouldn't work:
  > 
  > // assign lowest low within the interval assigned to rest of day
  > lwl = IIf(!tt,LLV(ltt,bs2),Null);
  > 
  > Plot(lwl,"",colorOrange,styleLine);
  > 
  > Here is what I get:
  > 
  > http://img225.imageshack.us/img225/530/02122007063634gx1.png
  > 
  > After marking out Plot(lwl, ... ) statement everything is back to normal.
  > 
  > Also, there are no problems with Highs or Lows on days when Bill's code generates incorrect values.
  > 
  > http://img243.imageshack.us/img243/8375/02122007064123bq7.png
  > 
  > Both formulas, with lines for Lowest Low added and a few minor cosmetic changes, are posted below.
  > 
  > /*** Bill's code ***/
  > 
  > // High and Low in a specified time frame
  > startTime = 093000;
  > endTime = 103000;
  > 
  > start = BarsSince(TimeNum()==startTime);
  > end = BarsSince(TimeNum()==endTime);
  > per = (start - end);
  > 
  > hgh = ValueWhen(TimeNum()==endTime, HHV(H, per));
  > lwl = ValueWhen(TimeNum()==endTime, LLV(L, per));
  > cls = ValueWhen(TimeNum()==endTime, C);
  > 
  > H_plot = IIf(TimeNum()>=endTime, hgh, Null);
  > L_plot = IIf(TimeNum()>=endTime, lwl, Null);
  > C_plot = IIf(TimeNum()>=endTime, cls, Null);
  > 
  > Plot(H_plot, "", colorLightBlue, styleLine);
  > Plot(L_plot, "", colorOrange, styleLine);
  > Plot(C_plot, "", colorDarkYellow, styleLine);
  > 
  > Plot(C,"",26,64);
  > SetChartOptions(0, chartShowDates);
  > 
  > Title = "\\c11"+Interval(2)+" "+
  > Date()+"\\c-1 H="+H+" L="+L;
  > 
  > /*** END ***/
  > 
  > // +++++++++++++++++++++++++++++++ //
  > 
  > /*** Edward's code ***/
  > 
  > // High and Low in a specified time frame
  > startTime = 093000;
  > endTime = 103000;
  > 
  > // assign an array tt having a value 1 inside the interval
  > tt = IIf(TimeNum() >= startTime AND TimeNum() <= endTime,1,0);
  > // high within interval
  > htt = IIf(TimeNum() >= startTime AND TimeNum() <= endTime,H,0);
  > // low within interval
  > ltt = IIf(TimeNum() >= startTime AND TimeNum() <= endTime,L,0);
  > // start bar of interval is 1, end bar is -1
  > dtt = tt - Ref(tt,-1);
  > 
  > // calculate the cumulative number of bars inside the interval
  > bs = BarsSince( dtt == 1 ) + 1;
  > // find number of bars at the end of interval
  > bs2 = IIf(dtt == -1,bs,Null);
  > // assign highest high within the interval assigned to rest of day
  > hgh = IIf(!tt,HHV(htt,bs2),Null);
  > // assign lowest low within the interval assigned to rest of day
  > lwl = IIf(!tt,LLV(ltt,bs2),Null);
  > // close price at end of interval assigned to rest of day
  > // old code: cls = IIf(!tt,ValueWhen(dtt == -1,C),Null);
  > cls = IIf(!tt,ValueWhen(Ref(dtt,1) == -1,C),Null);
  > 
  > Plot(hgh,"",colorLightBlue,styleLine);
  > // Plot(lwl,"",colorOrange,styleLine); // this must be fixed
  > Plot(cls,"",colorDarkYellow,styleLine);
  > 
  > Plot(C,"",26,64);
  > 
  > Title = "\\c11"+Interval(2)+" "+
  > Date()+"\\c-1 H="+H+" L="+L;
  > 
  > SetChartOptions(0, chartShowDates);
  > 
  > /*** END ***/
  > 
  > 
  > 
  > 
  > 
  > 
  > ----------------------------------------------------------
  > 
  > avast! Antivirus: Inbound message clean. 
  > 
  > Virus Database (VPS): 000712-6, 02/11/2007
  > Tested on: 2/12/2007 7:21:15 AM
  > avast! - copyright (c) 1988-2007 ALWIL Software.
  >



   
Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.441 / Virus Database: 268.17.35/680 - Release Date: 2/10/2007 9:15 PM