Inputs: StartTime(0830),
EndTime(0915),
yHigh(93.09),
yLow(90.96),
yClose(92.96),
A_Val(.08),
C_Val(.13),
yHighLow_Color(darkgray),
yHighLow_Style(3),
yHighLow_LineSize(2),
yClose_Color(darkred),
yCLose_Style(3),
yClose_LineSize(2),
IB_Color(Red),
IB_Style(2),
IB_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),
Font_Name("Arial"),
Font_Size(9),
Text_Offset(60),
TodayOnly(True);
vars: DPP(0), PV(0), PVR(0),
HighDay(0),
LowDay(0),
RangeToday(0),
LineId1(-1),
LineId2(-1),
LineId3(-1),
LineId4(-1),
LineId5(-1),
LineId6(-1),
LineId7(-1),
LineId8(-1),
LineId9(-1),
LineId10(-1),
LineId11(-1),
LineId12(-1),
ID1(-1),
ID2(-1),
ID3(-1),
ID4(-1),
ID5(-1),
ID6(-1),
ID7(-1),
ID8(-1),
ID9(-1),
ID10(-1),
ID11(-1),
ID12(-1),
ID1Text(-1),
ID2Text(-1),
ID3Text(-1),
ID4Text(-1),
ID5Text(-1),
ID6Text(-1),
ID7Text(-1),
ID8Text(-1),
ID9Text(-1),
ID10Text(-1),
ID11Text(-1),
ID12Text(-1);
If Date <> Date[1] Then Begin // Initialize vars at max of ranges
HighDay = 0;
LowDay = 99999;
End;
If Time >= StartTime and Time <= EndTime Then Begin
// Get the high and low from the start time to end time
If H > HighDay Then HighDay = H;
If L < LowDay Then LowDay = L;
End;
If Time >= EndTime Then Begin
RangeToday = HighDay - LowDay;
// Draw the OR High line
If TodayOnly and LineId1 <> -1 and LineId1 <> ID1 Then TL_Delete(LineId1);
If TodayOnly and LineId1 <> -1 and LineId1 <> ID1 Then Text_Delete(LineId1);
If TodayOnly then LineId1 = ID1;
ID1 = TL_New(Date, StartTime, HighDay, Date, Time, HighDay);
//If TodayOnly then Value1 = TL_SetExtRight(ID1, True);
TL_SetEnd(ID1, Date, Time + Text_Offset, HighDay);
TL_SetColor(ID1, IB_Color);
TL_SetStyle(ID1, IB_Style);
TL_SetSize(ID1, IB_LineSize);
ID1Text = Text_New(Date, Time + Text_Offset, HighDay, "OR High");
Text_SetStyle(ID1Text, 0, 1);
Text_SetColor(ID1Text, IB_Color);
Text_SetFontName(ID1Text, Font_Name);
Text_SetSize(ID1Text, Font_Size);
Text_SetLocation(ID1Text, Date, Time + Text_Offset, HighDay);
// Draw the OR Low Line
If TodayOnly and LineId2 <> -1 and LineId2 <> ID2 Then TL_Delete(LineId2);
If TodayOnly and LineId2 <> -1 and LineId2 <> ID2 Then Text_Delete(LineId2);
If TodayOnly Then LineId2 = Id2;
ID2 = TL_New(Date, StartTime, LowDay, Date, Time, LowDay);
//If TodayOnly then Value1 = TL_SetExtRight(ID2, True);
TL_SetEnd(ID2, Date, Time + Text_Offset, LowDay);
TL_SetColor(ID2, IB_Color);
TL_SetStyle(ID2, IB_Style);
TL_SetSize(ID2, IB_LineSize);
ID2Text = Text_New(Date, Time + Text_Offset, LowDay, "OR Low");
Text_SetStyle(ID2Text, 0, 1);
Text_SetColor(ID2Text, IB_Color);
Text_SetFontName(ID2Text, Font_Name);
Text_SetSize(ID2Text, Font_Size);
Text_SetLocation(ID2Text, Date, Time + Text_Offset, LowDay);
//Draw A Up Line
If TodayOnly and LineId3 <> -1 and LineId3 <> ID3 Then TL_Delete(LineId3);
If TodayOnly and LineId3 <> -1 and LineId3 <> ID3 Then Text_Delete(LineId3);
If TodayOnly then LineId3 = ID3;
ID3 = TL_New(Date, StartTime, HighDay + A_Val, Date, Time, HighDay + A_Val);
//If TodayOnly then Value1 = TL_SetExtRight(ID3, True);
TL_SetEnd(ID3, Date, Time + Text_Offset, HighDay + A_Val);
TL_SetColor(ID3, A_Color);
TL_SetStyle(ID3, A_Style);
TL_SetSize(ID3, A_LineSize);
ID3Text = Text_New(Date, Time + Text_Offset, HighDay + A_Val, "A Up");
Text_SetStyle(ID3Text, 0, 1);
Text_SetColor(ID3Text, IB_Color);
Text_SetFontName(ID3Text, Font_Name);
Text_SetSize(ID3Text, Font_Size);
Text_SetLocation(ID3Text, Date, Time + Text_Offset, HighDay + A_Val);
// Draw A Down Line
If TodayOnly and LineId4 <> -1 and LineId4 <> ID4 Then TL_Delete(LineId4);
If TodayOnly and LineId4 <> -1 and LineId4 <> ID4 Then Text_Delete(LineId4);
If TodayOnly Then LineId4 = Id4;
ID4 = TL_New(Date, StartTime, LowDay - A_Val, Date, Time, LowDay - A_Val);
//If TodayOnly then Value1 = TL_SetExtRight(ID4, True);
TL_SetEnd(ID4, Date, Time + Text_Offset, LowDay - A_Val);
TL_SetColor(ID4, A_Color);
TL_SetStyle(ID4, A_Style);
TL_SetSize(ID4, A_LineSize);
ID4Text = Text_New(Date, Time + Text_Offset, LowDay - A_Val, "A Down");
Text_SetStyle(ID4Text, 0, 1);
Text_SetColor(ID4Text, IB_Color);
Text_SetFontName(ID4Text, Font_Name);
Text_SetSize(ID4Text, Font_Size);
Text_SetLocation(ID4Text, Date, Time + Text_Offset, LowDay - A_Val);
//Draw C Up Line
If TodayOnly and LineId5 <> -1 and LineId5 <> ID5 Then TL_Delete(LineId5);
If TodayOnly and LineId5 <> -1 and LineId5 <> ID5 Then Text_Delete(LineId5);
If TodayOnly then LineId5 = ID5;
ID5 = TL_New(Date, StartTime, HighDay + C_Val, Date, Time, HighDay + C_Val);
//If TodayOnly then Value1 = TL_SetExtRight(ID5, True);
TL_SetEnd(ID5, Date, Time + Text_Offset, HighDay + C_Val);
TL_SetColor(ID5, C_Color);
TL_SetStyle(ID5, C_Style);
TL_SetSize(ID5, C_LineSize);
ID5Text = Text_New(Date, Time + Text_Offset, HighDay + C_Val, "C Up");
Text_SetStyle(ID5Text, 0, 1);
Text_SetColor(ID5Text, C_Color);
Text_SetFontName(ID5Text, Font_Name);
Text_SetSize(ID5Text, Font_Size);
Text_SetLocation(ID5Text, Date, Time + Text_Offset, HighDay + C_Val);
// Draw C Down Line
If TodayOnly and LineId6 <> -1 and LineId6 <> ID6 Then TL_Delete(LineId6);
If TodayOnly and LineId6 <> -1 and LineId6 <> ID6 Then Text_Delete(LineId6);
If TodayOnly Then LineId6 = Id6;
ID6 = TL_New(Date, StartTime, LowDay - C_Val, Date, Time, LowDay - C_Val);
//If TodayOnly then Value1 = TL_SetExtRight(ID6, True);
TL_SetEnd(ID6, Date, Time + Text_Offset, LowDay - C_Val);
TL_SetColor(ID6, C_Color);
TL_SetStyle(ID6, C_Style);
TL_SetSize(ID6, C_LineSize);
ID6Text = Text_New(Date, Time + Text_Offset, LowDay - C_Val, "C Down");
Text_SetStyle(ID6Text, 0, 1);
Text_SetColor(ID6Text, C_Color);
Text_SetFontName(ID6Text, Font_Name);
Text_SetSize(ID6Text, Font_Size);
Text_SetLocation(ID6Text, Date, Time + Text_Offset, LowDay - C_Val);
DPP = (yHigh + yLow + yClose ) /3; //Daily Pivot Point
//Draw Daily Pivot Point Line
If TodayOnly and LineId7 <> -1 and LineId7 <> ID7 Then TL_Delete(LineId7);
If TodayOnly and LineId7 <> -1 and LineId7 <> ID7 Then Text_Delete(LineId7);
If TodayOnly then LineId7 = ID7;
ID7 = TL_New(Date, StartTime, DPP, Date, Time, DPP);
//If TodayOnly then Value1 = TL_SetExtRight(ID7, True);
TL_SetEnd(ID7, Date, Time + Text_Offset, DPP);
TL_SetColor(ID7, PP_Color);
TL_SetStyle(ID7, PP_Style);
TL_SetSize(ID7, PP_LineSize);
ID7Text = Text_New(Date, Time + Text_Offset, DPP, "DPP");
Text_SetStyle(ID7Text, 0, 1);
Text_SetColor(ID7Text, PP_Color);
Text_SetFontName(ID7Text, Font_Name);
Text_SetSize(ID7Text, Font_Size);
Text_SetLocation(ID7Text, Date, Time + Text_Offset, DPP);
PV = (yHigh + yLow) /2;
PVR = (DPP - PV); //Pivot Range Value
//Draw Pivot Range High Line
If TodayOnly and LineId8 <> -1 and LineId8 <> ID8 Then TL_Delete(LineId8);
If TodayOnly and LineId8 <> -1 and LineId8 <> ID8 Then Text_Delete(LineId8);
If TodayOnly then LineId8 = ID8;
ID8 = TL_New(Date, StartTime, DPP + PVR, Date, Time, DPP + PVR);
//If TodayOnly then Value1 = TL_SetExtRight(ID8, True);
TL_SetEnd(ID8, Date, Time + Text_Offset, DPP + PVR);
TL_SetColor(ID8, PP_Color);
TL_SetStyle(ID8, PP_Style);
TL_SetSize(ID8, PP_LineSize);
ID8Text= Text_New(Date, Time + Text_Offset, DPP + PVR, "PVR High");
Text_SetStyle(ID8Text, 0, 1);
Text_SetColor(ID8Text, PP_Color);
Text_SetFontName(ID8Text, Font_Name);
Text_SetSize(ID8Text, Font_Size);
Text_SetLocation(ID8Text, Date, Time + Text_Offset, DPP + PVR);
//Draw Pivot Range Low Line
If TodayOnly and LineId9 <> -1 and LineId9 <> ID9 Then TL_Delete(LineId9);
If TodayOnly and LineId9 <> -1 and LineId9 <> ID9 Then Text_Delete(LineId9);
If TodayOnly then LineId9 = ID9;
ID9 = TL_New(Date, StartTime, DPP - PVR, Date, Time, DPP - PVR);
//If TodayOnly then Value1 = TL_SetExtRight(ID9, True);
TL_SetEnd(ID9, Date, Time + Text_Offset, DPP - PVR);
TL_SetColor(ID9, PP_Color);
TL_SetStyle(ID9, PP_Style);
TL_SetSize(ID9, PP_LineSize);
ID9Text= Text_New(Date, Time + Text_Offset, DPP - PVR, "PVR Low");
Text_SetStyle(ID9Text, 0, 1);
Text_SetColor(ID9Text, PP_Color);
Text_SetFontName(ID9Text, Font_Name);
Text_SetSize(ID9Text, Font_Size);
Text_SetLocation(ID9Text, Date, Time + Text_Offset, DPP - PVR);
//Draw yHigh Line
If TodayOnly and LineId10 <> -1 and LineId10 <> ID10 Then TL_Delete(LineId10);
If TodayOnly and LineId10 <> -1 and LineId10 <> ID10 Then Text_Delete(LineId10);
If TodayOnly then LineId10 = ID10;
ID10 = TL_New(Date, StartTime, yHigh, Date, Time, yHigh);
//If TodayOnly then Value1 = TL_SetExtRight(ID10, True);
TL_SetEnd(ID10, Date, Time + Text_Offset, yHigh);
TL_SetColor(ID10, yHighLow_Color);
TL_SetStyle(ID10, yHighLow_Style);
TL_SetSize(ID10, yHighLow_LineSize);
ID10Text= Text_New(Date, Time + Text_Offset, yHigh, "Y High");
Text_SetStyle(ID10Text, 0, 1);
Text_SetColor(ID10Text, yHighLow_Color);
Text_SetFontName(ID10Text, Font_Name);
Text_SetSize(ID10Text, Font_Size);
Text_SetLocation(ID10Text, Date, Time + Text_Offset, yHigh);
//Draw yLow Line
If TodayOnly and LineId11 <> -1 and LineId11 <> ID11 Then TL_Delete(LineId11);
If TodayOnly and LineId11 <> -1 and LineId11 <> ID11 Then Text_Delete(LineId11);
If TodayOnly then LineId11 = ID11;
ID11 = TL_New(Date, StartTime, yLow, Date, Time, yLow);
//If TodayOnly then Value1 = TL_SetExtRight(ID11, True);
TL_SetEnd(ID11, Date, Time + Text_Offset, yLow);
TL_SetColor(ID11, yHighLow_Color);
TL_SetStyle(ID11, yHighLow_Style);
TL_SetSize(ID11, yHighLow_LineSize);
ID11Text= Text_New(Date, Time + Text_Offset, yLow, "Y Low");
Text_SetStyle(ID11Text, 0, 1);
Text_SetColor(ID11Text, yHighLow_Color);
Text_SetFontName(ID11Text, Font_Name);
Text_SetSize(ID11Text, Font_Size);
Text_SetLocation(ID11Text, Date, Time + Text_Offset, yLow);
//Draw yClose Line
If TodayOnly and LineId12 <> -1 and LineId12 <> ID12 Then TL_Delete(LineId12);
If TodayOnly and LineId12 <> -1 and LineId12 <> ID12 Then Text_Delete(LineId12);
If TodayOnly then LineId12 = ID12;
ID12 = TL_New(Date, StartTime, yClose, Date, Time, yClose);
//If TodayOnly then Value1 = TL_SetExtRight(ID12, True);
TL_SetEnd(ID12, Date, Time + Text_Offset, yClose);
TL_SetColor(ID12, yClose_Color);
TL_SetStyle(ID12, yClose_Style);
TL_SetSize(ID12, yClose_LineSize);
ID12Text= Text_New(Date, Time + Text_Offset, yClose, "Y Close");
Text_SetStyle(ID12Text, 0, 1);
Text_SetColor(ID12Text, yClose_Color);
Text_SetFontName(ID12Text, Font_Name);
Text_SetSize(ID12Text, Font_Size);
Text_SetLocation(ID12Text, Date, Time + Text_Offset, yClose);
end;
|