PureBytes Links
Trading Reference Links
|
It seems to work fine for me, if "BarType <= 1" is replaced by
"DataCompression <= 1"
Andrey
----- Original Message -----
From: <rghstocks@xxxxxxx>
To: <omega-list@xxxxxxxxxx>
Sent: Tuesday, August 20, 2002 9:48 AM
Subject: RE: Code for day open and hi and low.
> Here is the code for plotting the day open. It also plots the high and
the low but if you don't want them, change their color to black.
>
> Randy
>
> { This indicator is for use with intraday charts and inserts 3 horizontal
trendlines
> for each day, starting at the open, high and low of the day,
respectively, and
> terminating at the last bar of the day. For the current day, the
trendlines are
> extended to the right, and update in real time as and when there is a
new high or
> low for the day. }
>
> inputs:
> OpenColor( Red ),
> HighColor( Yellow ),
> LowColor( Cyan ) ;
>
> variables:
> HavePrevLines( false ),
> TLOpen( 0 ),
> TLHigh( 0 ),
> TLLow( 0 ),
> DayOpen( 0 ),
> DayHigh( 0 ),
> DayLow( 0 ) ;
>
> if BarType <= 1 then { ie, if minute or tick bars }
> begin
> if Date <> Date[1] then { ie, if new day }
> begin
>
> { truncate the previous lines if they exist }
> if HavePrevLines then
> begin
> TL_SetEnd( TLOpen, Date[1], Time[1], DayOpen ) ;
> TL_SetEnd( TLHigh, Date[1], Time[1], DayHigh ) ;
> TL_SetEnd( TLLow, Date[1], Time[1], DayLow ) ;
> TL_SetExtRight( TLOpen, false ) ;
> TL_SetExtRight( TLHigh, false ) ;
> TL_SetExtRight( TLLow, false ) ;
> end ;
>
> { re-initialize O,H,L for the new day }
> DayOpen = Open ;
> DayHigh = High ;
> DayLow = Low ;
>
> { insert the new O,H,L lines and set their colors/extents }
> TLOpen = TL_New( Date[1], Time[1], DayOpen, Date, Time, DayOpen )
;
> TLHigh = TL_New( Date[1], Time[1], DayHigh, Date, Time, DayHigh )
;
> TLLow = TL_New( Date[1], Time[1], DayLow, Date, Time, DayLow ) ;
> TL_SetColor( TLOpen, OpenColor ) ;
> TL_SetColor( TLHigh, HighColor ) ;
> TL_SetColor( TLLow, LowColor ) ;
> TL_SetExtLeft( TLOpen, false ) ;
> TL_SetExtLeft( TLHigh, false ) ;
> TL_SetExtLeft( TLLow,false ) ;
> TL_SetExtRight( TLOpen, true ) ;
> TL_SetExtRight( TLHigh, true ) ;
> TL_SetExtRight( TLLow, true ) ;
>
> { set flag }
> if HavePrevLines = false then
> HavePrevLines = true ;
> end
> else if HavePrevLines = true then
> { if new hi/lo for day, save values and update the H,L lines }
> begin
> if High > DayHigh then
> begin
> DayHigh = High ;
> { MUST reset TL end before resetting TL beginning in this
case }
> TL_SetEnd( TLHigh, Date, Time, DayHigh ) ;
> TL_SetBegin( TLHigh, Date[1], Time[1], DayHigh ) ;
> end ;
> if Low < DayLow then
> begin
> DayLow = Low ;
> { MUST reset TL end before resetting TL beginning in this
case }
> TL_SetEnd( TLLow, Date, Time, DayLow ) ;
> TL_SetBegin( TLLow, Date[1], Time[1], DayLow ) ;
> end ;
> end ;
> end ;
>
>
>
|