Daily Hi Low Lines

Questions about MultiCharts and user contributed studies.
kdmezzo
Posts: 19
Joined: 19 Aug 2011

Daily Hi Low Lines

Postby kdmezzo » 26 Sep 2022

Could some one assist me in adapting this indicator so that it reflects the NY close of forex at 1700. I have tried to adapt it myself but it still shows the
24/7 lines that begin at 2400. I added a start time and end time but I must need something else. Here is the code. Ant assistance is appreciated.
Doug

inputs:
StartTime ( 1700) ,
EndTime ( 1659),
OpenColor( Red ),
HighColor( Yellow ),
LowColor( Cyan ),
DataNum( 1 ) ;

variables:
var0( false ),
var1( 0 ),
var2( 0 ),
var3( 0 ),
var4( 0 ),
var5( 0 ),
var6( 0 ),
intrabarpersist var7( 0 ),
intrabarpersist var8( 0 ) ;

if BarType <= 1 or BarType >= 5 then
begin
condition1 = Date <> Date[1] and BarStatus( DataNum ) = 2 ;
if condition1 then
begin


if var0 then
begin
TL_SetEnd( var1, Date[1], Time[1], var4 ) ;
TL_SetEnd( var2, Date[1], Time[1], var5 ) ;
TL_SetEnd( var3, Date[1], Time[1], var6 ) ;
TL_SetExtRight( var1, false ) ;
TL_SetExtRight( var2, false ) ;
TL_SetExtRight( var3, false ) ;
end ;


var4 = Open ;
var5 = High ;
var6 = Low ;
var7 = Time ;
var8 = Time[1] ;


var1 = TL_New( Date[1], Time[1], var4, Date, Time, var4 ) ;
var2 = TL_New( Date[1], Time[1], var5, Date, Time, var5 ) ;
var3 = TL_New( Date[1], Time[1], var6, Date, Time, var6 ) ;
TL_SetColor( var1, OpenColor ) ;
TL_SetColor( var2, HighColor ) ;
TL_SetColor( var3, LowColor ) ;
TL_SetExtLeft( var1, false ) ;
TL_SetExtLeft( var2, false ) ;
TL_SetExtLeft( var3,false ) ;
TL_SetExtRight( var1, true ) ;
TL_SetExtRight( var2, true ) ;
TL_SetExtRight( var3, true ) ;


if var0 = false then
var0 = true ;
end
else if var0 = true then

begin

if Time <> var7 then
begin
var8 = var7 ;
var7 = Time ;
end ;

if High > var5 then
begin
var5 = High ;




TL_SetEnd( var2, Date, Time, var5 ) ;
TL_SetBegin( var2, Date[1], var8, var5 ) ;
end ;
if Low < var6 then
begin
var6 = Low ;


TL_SetEnd( var3, Date, Time, var6 ) ;
TL_SetBegin( var3, Date[1], var8, var6 ) ;
end ;
end ;
end
else
RaiseRunTimeError( "Day Open-Hi-Lo Lines requires intraday bars." ) ;

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Daily Hi Low Lines

Postby TJ » 26 Sep 2022

See posts #1 & #2
viewtopic.php?t=11713

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Daily Hi Low Lines

Postby TJ » 26 Sep 2022

See post #5

5. The First Step in Debugging Your Code
5. Stop Banging Your Head Against the Wall and Open Your Eyes.

viewtopic.php?t=11713

User avatar
rrams
Posts: 128
Joined: 10 Feb 2011
Location: USA
Has thanked: 7 times
Been thanked: 70 times
Contact:

Re: Daily Hi Low Lines

Postby rrams » 27 Sep 2022

kdmezzo,
A significant amount of work must have gone into TJ's FAQ; I find it very helpful. At least post code tags using the web page editor and thank the author if you appreciate the help by clicking the thumbs up icon. (it is free)

Code: Select all

inputs: StartTime(1700), OpenColor(Red), HighColor(Yellow), LowColor(Cyan); vars: var0(false), var1(0), var2(0), var3(0), var4(0), var5(0), var6(0), intrabarpersist var7(0), intrabarpersist var8(0); if BarType<=1 or BarType>=5 then begin if T>=StartTime and T[1]<=StartTime and BarStatus=2 then begin if var0 then begin TL_SetEnd(var1, Date[1], Time[1], var4); TL_SetEnd(var2, Date[1], Time[1], var5); TL_SetEnd(var3, Date[1], Time[1], var6); TL_SetExtRight(var1, false); TL_SetExtRight(var2, false); TL_SetExtRight(var3, false); end; var4=Open; var5=High; var6=Low; var7=Time; var8=Time[1]; var1=TL_New(Date[1], Time[1], var4, Date, Time, var4); var2=TL_New(Date[1], Time[1], var5, Date, Time, var5); var3=TL_New(Date[1], Time[1], var6, Date, Time, var6); TL_SetColor(var1, OpenColor); TL_SetColor(var2, HighColor); TL_SetColor(var3, LowColor); TL_SetExtLeft(var1, false); TL_SetExtLeft(var2, false); TL_SetExtLeft(var3, false); TL_SetExtRight(var1, true); TL_SetExtRight(var2, true); TL_SetExtRight(var3, true); if var0=false then var0=true; end else if var0=true then begin if Time<>var7 then begin var8=var7; var7=Time; end; if High>var5 then begin var5=High; TL_SetEnd(var2, Date, Time, var5); TL_SetBegin(var2, Date[1], var8, var5); end; if Low<var6 then begin var6=Low; TL_SetEnd(var3, Date, Time, var6); TL_SetBegin(var3, Date[1], var8, var6); end; end; end else RaiseRunTimeError("Day Open-Hi-Lo Lines requires intraday bars.");

User avatar
LRP
Posts: 153
Joined: 07 Apr 2008
Location: Switzerland
Has thanked: 96 times
Been thanked: 15 times

Re: Daily Hi Low Lines

Postby LRP » 30 Sep 2022

Great, thanks a lot rrams. Since i use MC and TS, any idea why TS compiles it with an error?

User avatar
ABC
Posts: 718
Joined: 16 Dec 2006
Location: www.abctradinggroup.com
Has thanked: 125 times
Been thanked: 408 times
Contact:

Re: Daily Hi Low Lines

Postby ABC » 05 Oct 2022

LRP,

the TS compiler is usually quite helpful with an error message that points you to the location to the error and a possible fix.
In the case of this code it appears, it is missing a data stream reference within brackets following the BarStatus reserved word.

Regards,

ABC
Great, thanks a lot rrams. Since i use MC and TS, any idea why TS compiles it with an error?


Return to “MultiCharts”