Let's see if someone can help me here with the following formula since rarely we see formulas being discussed here
My problem with it is drawing the trendlines from the beginning to the end of the selected input days.
How can I tranform the SessHi and SessLo variables into recognizable Date format, assuming that this is the only problem
Code: Select all
Inputs:
StDay (21),
StMnth (11),
StYear (108),
EnDay (28),
EnMnth (11),
EnYear (108),
PlotLines (True);
Variables:
SessST (true),
SessEN (true),
Hi (-999999),
Lo (+999999),
SessHi (0),
SessLo (0),
HiTL (-1),
LoTL (-1);
// Start time period
SessST = Year(Date) > StYear
or (Year(Date) = StYear and (Month(Date) > StMnth
or Month(Date) = StMnth and DayOfMonth(Date) >= StDay));
// End time period
SessEN = Year(Date) < EnYear
or (Year(Date) = EnYear and (Month(Date) < EnMnth
or Month(Date) = EnMnth and DayOfMonth(Date) <= EnDay));
// Highest High and Lowest Low inside time period
if SessST and SessEN then begin
If High > Hi then
Hi = High;
If Low < Lo then
Lo = Low;
SessHi = Hi;
SessLo = Lo;
// Plot TrendLines
if PlotLines = false then begin
HiTL = TL_New(date, Time, SessHi, Date, Time, SessHi);
LoTL = TL_New(date, Time, SessLo, Date, Time, SessLo);
end;
if PlotLines = false then begin
TL_SetBegin(HiTL, date, Time, SessHi);
TL_SetEnd(HiTL, Date, Time, SessHi);
TL_SetBegin(LoTL, date, Time, SessLo);
TL_SetEnd(LoTL, Date, Time, SessLo);
end;
end;
if PlotLines = true then begin
if SessHi <> 0 then
Plot1(SessHi);
if SessLo <> 0 then
Plot2(SessLo);
end;