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

[amibroker] Re: Help needed on a simple code:



PureBytes Links

Trading Reference Links

I'm also wondering if there is a way of avoiding the loop by using "deDateTime.dll" available here:

http://www.amibroker.org/3rdparty/

I couldn't figure out how to force the following function (from the plugin) to return the HHV of High between the startTime and endTime on the previous day:

deTimeRangeHHV (H, startTime, endTime);

Lester

--- In amibroker@xxxxxxxxxxxxxxx, "Lester Vanhoff" <ebsn247lsm@xxx> wrote:
>
> Dave's loop looks really good. I modified the code a little so that now you can easily change your yesterday's high-low hours and today's plot hours. I entered some weird hours here just to make it easier to test how all this works.
> 
> Lester
> 
> /*** START ***/
> 
> Title = "\\c11"+Interval(2)+" "+Date()+
> "\\c-1 C="+C;
> 
> Plot(C, "", colorTan, styleCandle);
> 
> // Enter your time ranges here
> yestStartTime = 110000;
> yestEndTime   = 140000;
> plotStartTime = 103000;
> plotEndTime   = 150000;
> 
> BarTime = TimeNum();
> 
> dKeepL = 9999999;
> dKeepH = 0;
> 
> YDayH = Null;
> YDayL = Null;
> 
> for(i=1; i<BarCount; i++)
> {
>  dKeepH[i] = dKeepH[i-1];
>  dKeepL[i] = dKeepL[i-1];
>  YDayH[i] = YDayH[i-1];
>  YDayL[i] = YDayL[i-1];
> 
> // New Day
>  if (BarTime[i] < BarTime[i-1]) 
>  {
>  YDayH[i] = dKeepH[i-1];
>  YDayL[i] = dKeepL[i-1];
>  dKeepH[i] = 0;
>  dKeepL[i] = 9999999;
>  }
>  if 
>  (BarTime[i] >= yestStartTime AND 
>  BarTime[i] <= yestEndTime)
>  {
>  if (dKeepH[i] < H[i])
>  dKeepH[i] = H[i];
>  if (dKeepL[i] > L[i])
>  dKeepL[i] = L[i];
>  }
> }
> 
> YDayH_plot = IIf(TimeNum()>=plotStartTime 
> AND TimeNum()<=plotEndTime, YDayH, Null);
> 
> YDayL_plot = IIf(TimeNum()>=plotStartTime 
> AND TimeNum()<=plotEndTime, YDayL, Null);
> 
> Plot(YDayH_plot, "",colorLightBlue,styleDots+styleNoLine+styleNoRescale);
> Plot(YDayL_plot, "",colorOrange,styleDots+styleNoLine+styleNoRescale);
> 
> SetChartOptions(0, chartShowDates);
> GraphXSpace = 3;
> 
> /*** END ***/



Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.441 / Virus Database: 268.18.2/692 - Release Date: 2/18/2007 4:35 PM