high low of night session  [SOLVED]

Questions about MultiCharts and user contributed studies.
chipeur_le_renard
Posts: 50
Joined: 13 Jul 2014
Has thanked: 15 times
Been thanked: 5 times

high low of night session

Postby chipeur_le_renard » 07 Feb 2024

hi all traders


I wrote an indicator to find the high of the night session...it works perfectly......like that

Code: Select all

Inputs: PlaceTextRight(true),StartTime2(0000),EndTime2(2330),OpenColor(white), decimales(0),TLSize(1),TLStyle(3); Variables: OpenTL(0),OpenTxt(0), HaveTLs (false),highday(0), TextStyleHoriz (1), //0: texte droite de la barre //1: texte gauche de la barre //2: texte centre de la barre TextStyleVert (0), //0: texte en dessous de la barre //1: texte au-dessus de la barre //2: texte sur la barre TextStyleVertb (0) , TextStyleVertc (1) ; If Date <> Date[1] then begin If PlaceTextRight then TextStyleVert = 0; HaveTLs = false; If H > HighDay Then HighDay = H; end else begin If Time > StartTime2 and Time <= EndTime2 then begin If H > HighDay Then HighDay = H; If HaveTLs = false then begin HaveTLs = true; OpenTL = TL_New(Date, StartTime2, highday, Date, time, highday); TL_SetColor(OpenTL, OpenColor); TL_SetSize(OpenTL, TLSize); TL_SetStyle(OpenTL, TLStyle); OpenTxt = Text_New(Date, StartTime2, highday, "PHN "+ NumToStr(highday,decimales)); Text_SetStyle(OpenTxt, TextStyleHoriz, TextStyleVertc); Text_SetColor(OpenTxt, OpenColor); end else begin OpenTL=TL_SetEnd(OpenTL, Date,EndTime2, highday); //Value1 = TL_SetEnd(Tl_ID, eDate, eTime, eVal) If PlaceTextRight then begin Text_SetLocation(OpenTxt, Date, EndTime2, highday); end; end; end; end;



to find the low on the same night session...i put lowday instead of highday in another indicator....

Code: Select all

Inputs: PlaceTextRight(true),StartTime2(0000),EndTime2(2330),OpenColor(white), decimales(0),TLSize(1),TLStyle(3); Variables: OpenTL2(0),OpenTxt(0), HaveTLs(false),lowday(0), TextStyleHoriz (1), //0: texte droite de la barre //1: texte gauche de la barre //2: texte centre de la barre TextStyleVert (0), //0: texte en dessous de la barre //1: texte au-dessus de la barre //2: texte sur la barre TextStyleVertb (0) , TextStyleVertc (1) ; If Date <> Date[1] then begin If PlaceTextRight then TextStyleVert = 0; HaveTLs = false; If L < LowDay Then LowDay = L; end else begin If Time > StartTime2 and Time <= EndTime2 then begin If L < LowDay Then LowDay = L; If HaveTLs = false then begin HaveTLs = true; OpenTL2 = TL_New(Date, StartTime2, LowDay, Date, time, LowDay); TL_SetColor(OpenTL2, OpenColor); TL_SetSize(OpenTL2, TLSize); TL_SetStyle(OpenTL2, TLStyle); OpenTxt = Text_New(Date, StartTime2, LowDay, "PHN "+ NumToStr(LowDay,decimales)); Text_SetStyle(OpenTxt, TextStyleHoriz, TextStyleVertc); Text_SetColor(OpenTxt, OpenColor); end else begin OpenTL2=TL_SetEnd(OpenTL2, Date,EndTime2, LowDay); //Value1 = TL_SetEnd(Tl_ID, eDate, eTime, eVal) If PlaceTextRight then begin Text_SetLocation(OpenTxt, Date, EndTime2,LowDay); end; end; end; end;
i change the setup of the line to have a second line of the low >>>>>> OpenTL2 = TL_New(Date, StartTime2, LowDay, Date, time, LowDay);

all everything looks good BUT NOTHING ON SCREEN........I spent time looking for the error but I can't find it

help needed thx


Image
html picture

User avatar
Polly MultiCharts
Posts: 203
Joined: 20 Jul 2022
Has thanked: 1 time
Been thanked: 56 times

Re: high low of night session

Postby Polly MultiCharts » 14 Feb 2024

Hello chipeur_le_renard,

As far as we can see in your code ‘lowday’ always equals 0. So the condition ‘If L < lowday Then’ is never met.
You might try adding 'once lowday = Low;' in your code and check how it works.

chipeur_le_renard
Posts: 50
Joined: 13 Jul 2014
Has thanked: 15 times
Been thanked: 5 times

Re: high low of night session  [SOLVED]

Postby chipeur_le_renard » 14 Feb 2024

thx


Return to “MultiCharts”