Inputs:
StartCalcTime (0900),
EndCalcTime (0905),
TLStartTime (0900),
TLEndTime (1430),
yHigh (101.00),
yLow (100.00),
yClose (100.50),
A_Val (.08),
C_Val (.13),
PlaceTextRight (true),
Plot_All_Days (False),
HistoryCutoff (1),
IgnoreWeekends (true),
OR_Color (white),
OR_Style (2),
OR_LineSize (0),
A_Color (Red),
A_Style (2),
A_LineSize (0),
C_Color (Cyan),
C_Style (3),
C_LineSize (1),
PP_Color (yellow),
PP_Style (2),
PP_LineSize (1),
yHighLow_Color (darkgray),
yHighLow_Style (3),
yHighLow_LineSize (2),
yClose_Color (darkred),
yCLose_Style (3),
yClose_LineSize (2),
Font_Name ("Arial"),
Font_Size (9);
Variables:
Monday2Friday (false),
A_Up (0),
C_Up (0),
A_Down (0),
C_Down (0),
PP (0),
PV (0),
PVR (0),
ORHighTL (0),
ORLowTL (0),
A_UPTL (0),
C_UPTL (0),
A_DownTL (0),
C_DownTL (0),
PPTL (0),
PVRHighTL (0),
PVRLowTL (0),
yHighTL (0),
yLowTL (0),
yCloseTL (0),
DayHi (-999999),
DayLo (+999999),
HaveTLs (false),
HaveLevels (false),
StartTime (0),
EndTime (0),
ORHighTxt (0),
ORLowTxt (0),
A_UPTxt (0),
C_UpTxt (0),
A_DownTxt (0),
C_DownTxt (0),
PPTxt (0),
PVRHighTxt (0),
PVRLowTxt (0),
YHighTxt (0),
YLowTxt (0),
YCloseTxt (0),
SessClose (0);
If (Plot_All_Days OR D >= Currentdate - HistoryCutoff) then
begin
If IgnoreWeekends then begin
If DayOfWeek(Date) >= Monday and DayOfWeek(Date) <= Friday then
Monday2Friday = true
else
Monday2Friday = false;
end
else begin
Monday2Friday = true;
end;
If Monday2Friday then begin
If Date <> Date[1] then
HaveLevels = false;
HaveTLs = false;
end; //If Date <> Date[1] then begin...
If Time > StartCalcTime and Time <= EndCalcTime then begin
If High >= DayHi then DayHi = High;
If Low <= DayLo then DayLo = Low;
end;//If Time > StartCalcTime and Time <= EndCalcTime then begin...
if Time > EndCalcTime and HaveLevels = false then
begin
HaveLevels = true;
If HaveTLs = false then begin
HaveTLs = true;
A_UP = DayHi + A_Val;
C_UP = DayHi + C_Val;
A_Down = DayLo - A_Val;
C_Down = DayLo - C_Val;
PP = (yHigh + yLow + yClose ) /3;
PV = (yHigh + yLow) /2;
PVR = (PP - PV); //Pivot Range Value
ORHighTL = TL_New(Date, TLStartTime, DayHi, Date, TLEndTime, DayHi);
TL_SetColor(ORHighTL, OR_Color);
TL_SetSize(ORHighTL, OR_LineSize);
TL_SetStyle(ORHighTL, OR_Style);
ORLowTL = TL_New(Date, TLStartTime, DayLo, Date, TLEndTime, DayLo);
TL_SetColor(ORLowTL, OR_Color);
TL_SetSize(ORLowTL, OR_LineSize);
TL_SetStyle(ORLowTL, OR_Style);
A_UpTL = TL_New(Date, TLStartTime, A_UP, Date, TLEndTime, A_UP);
TL_SetColor(A_UPTL, A_Color);
TL_SetSize(A_UPTL, A_LineSize);
TL_SetStyle(A_UPTL, A_Style);
C_UPTL = TL_New(Date, TLStartTime, C_UP, Date, TLEndTime, C_UP);
TL_SetColor(C_UPTL, C_Color);
TL_SetSize(C_UPTL, C_LineSize);
TL_SetStyle(C_UPTL, C_Style);
A_DownTL = TL_New(Date, TlStartTime, A_Down, Date, TLEndTime, A_Down);
TL_SetColor(A_DownTL, A_Color);
TL_SetSize(A_DownTL, A_LineSize);
TL_SetStyle(A_DownTL, A_Style);
C_DownTL = TL_New(Date, TLStartTime, C_Down, Date, TLEndTime, C_Down);
TL_SetColor(C_DownTL, C_Color);
TL_SetSize(C_DownTL, C_LineSize);
TL_SetStyle(C_DownTL, C_Style);
PPTL = TL_New(Date, TLStartTime, PP, Date, TLEndTime, PP);
TL_SetColor(PPTL, PP_Color);
TL_SetSize(PPTL, PP_LineSize);
TL_SetStyle(PPTL, PP_Style);
PVRHighTL = TL_New(Date, TLStartTime, PP + PVR, Date, TLEndTime, PP + PVR);
TL_SetColor(PVRHighTL, PP_Color);
TL_SetSize(PVRHighTL, PP_LineSize);
TL_SetStyle(PVRHighTL, PP_Style);
PVRLowTL = TL_New(Date, TLStartTime, PP - PVR, Date, TLEndTime, PP - PVR);
TL_SetColor(PVRLowTL, PP_Color);
TL_SetSize(PVRLowTL, PP_LineSize);
TL_SetStyle(PVRLowTL, PP_Style);
yHighTL = TL_New(Date, TLStartTime, yHigh, Date, TLEndTime, yHigh);
TL_SetColor(yHighTL, yHighLow_Color);
TL_SetSize(yHighTL, yHighLow_LineSize);
TL_SetStyle(yHighTL, yHighLow_Style);
yLowTL = TL_New(Date, TLStartTime, yLow, Date, TLEndTime, yLow);
TL_SetColor(yLowTL, yHighLow_Color);
TL_SetSize(yLowTL, yHighLow_LineSize);
TL_SetStyle(yLowTL, yHighLow_Style);
yCloseTL = TL_New(Date, TLStartTime, yClose, Date, TLEndTime, yClose);
TL_SetColor(yCloseTL, yClose_Color);
TL_SetSize(yCloseTL, yClose_LineSize);
TL_SetStyle(yCloseTL, yClose_Style);
ORHighTxt = Text_New(Date, TLStartTime, DayHi, "OR High");
Text_SetStyle(ORHighTxt, 1, 1);
Text_SetColor(ORHighTxt, OR_Color);
Text_SetFontName(ORHighTxt, Font_Name);
Text_SetSize(ORHighTxt, Font_Size);
ORLowTxt = Text_New(Date, TLStartTime, DayLo, "OR Low");
Text_SetStyle(ORLowTxt, 1, 1);
Text_SetColor(ORLowTxt, OR_Color);
Text_SetFontName(ORLowTxt, Font_Name);
Text_SetSize(ORLowTxt, Font_Size);
A_UPTxt = Text_New(Date, TLStartTime, A_UP, "A Up");
Text_SetStyle(A_UPTxt, 1, 1);
Text_SetColor(A_UPTxt, A_Color);
Text_SetFontName(A_UPTxt, Font_Name);
Text_SetSize(A_UPTxt, Font_Size);
C_UpTxt = Text_New(Date, TLStartTime, C_Up, "C Up");
Text_SetStyle(C_UpTxt, 1, 1);
Text_SetColor(C_UpTxt, C_Color);
Text_SetFontName(C_UPTxt, Font_Name);
Text_SetSize(C_UPTxt, Font_Size);
A_DownTxt = Text_New(Date, TLStartTime, A_Down, "A Down");
Text_SetStyle(A_DownTxt, 1, 1);
Text_SetColor(A_DownTxt, A_Color);
Text_SetFontName(A_DownTxt, Font_Name);
Text_SetSize(A_DownTxt, Font_Size);
C_DownTxt = Text_New(Date, TLStartTime, C_Down, "C Down");
Text_SetStyle(C_DownTxt, 1, 1);
Text_SetColor(C_DownTxt, C_Color);
Text_SetFontName(C_DownTxt, Font_Name);
Text_SetSize(C_DownTxt, Font_Size);
PPTxt = Text_New(Date, TLStartTime, PP, "PP");
Text_SetStyle(PPTxt, 1, 1);
Text_SetColor(PPTxt, PP_Color);
Text_SetFontName(PPTxt, Font_Name);
Text_SetSize(PPTxt, Font_Size);
PVRHighTxt = Text_New(Date, TLStartTime, PP + PVR, "PR High");
Text_SetStyle(PVRHighTxt, 1, 1);
Text_SetColor(PVRHighTxt, PP_Color);
Text_SetFontName(PVRHighTxt, Font_Name);
Text_SetSize(PVRHighTxt, Font_Size);
PVRLowTxt = Text_New(Date, TLStartTime, PP - PVR, "PR Low");
Text_SetStyle(PVRLowTxt, 1, 1);
Text_SetColor(PVRLowTxt, PP_Color);
Text_SetFontName(PVRLowTxt, Font_Name);
Text_SetSize(PVRLowTxt, Font_Size);
yHighTxt = Text_New(Date, TLStartTime, yHigh, "Y High");
Text_SetStyle(YHighTxt, 1, 1);
Text_SetColor(YHighTxt, yHighLow_Color);
Text_SetFontName(YHighTxt, Font_Name);
Text_SetSize(YHighTxt, Font_Size);
yLowTxt = Text_New(Date, TLStartTime, yLow, "Y Low");
Text_SetStyle(YLowTxt, 1, 1);
Text_SetColor(YLowTxt, yHighLow_Color);
Text_SetFontName(YLowTxt, Font_Name);
Text_SetSize(YLowTxt, Font_Size);
yCloseTxt = Text_New(Date, TLStartTime, yClose, "Y Close");
Text_SetStyle(YCloseTxt, 1, 1);
Text_SetColor(YCloseTxt, yClose_Color);
Text_SetFontName(YCloseTxt, Font_Name);
Text_SetSize(YCloseTxt, Font_Size);
If PlaceTextRight then begin
Text_SetLocation(ORHighTxt, Date, TLEndTime, DayHi);
Text_SetLocation(ORLowTxt, Date, TLEndTime, DayLo);
Text_SetLocation(A_UPTxt, Date, TLEndTime, A_Up);
Text_SetLocation(C_UPTxt, Date, TLEndTime, C_Up);
Text_SetLocation(A_DownTxt, Date, TLEndTime, A_Down);
Text_SetLocation(C_DownTxt , Date, TLEndTime, C_Down);
Text_SetLocation(PPTxt, Date, TLEndTime, PP);
Text_SetLocation(PVRHighTxt, Date, TLEndTime, PP + PVR);
Text_SetLocation(PVRLowTxt, Date, TLEndTime, PP - PVR);
Text_SetLocation(yHighTxt, Date, TLEndTime, yHigh);
Text_SetLocation(yLowTxt, Date, TLEndTime, yLow);
Text_SetLocation(yCloseTxt, Date, TLEndTime, yClose);
end; //If PlaceTextRight then begin...
end; //If HaveTLs = false then begin...
end; //If Monday2Friday then begin...
If (Time > TLEndTime and Time[1] <= TLEndTime) then begin
DayHi = -999999;
DayLo = 999999;
end; //If (Time > TLEndTime and Time[1] <= TLEndTime) then begin
end; //If (Today_Only OR D >= Currentdate - HistoryCutoff) then begin
|