|
inputs:
DailyHigh( 0),
DailyLow( 0),
DailyClose( 0),
WeeklyHigh( 0),
WeeklyLow(0),
WeeklyClose( 0),
MonthlyHigh( 0),
MonthlyLow( 0),
MonthlyClose( 0),
PlotDailyMidPts( true),
PlotWeeklyMidPts( false),
PlotMonthlyMidPts( false),
DailyR3color( Yellow),
DailyR2color( Yellow),
DailyR1color( Yellow),
DailyPPcolor( Yellow),
DailyS1color( Yellow),
DailyS2color( Yellow),
DailyS3color( Yellow),
WeeklyR3color( Cyan),
WeeklyR2color( Cyan),
WeeklyR1color( Cyan),
WeeklyPPcolor( Cyan),
WeeklyS1color( Cyan),
WeeklyS2color( Cyan),
WeeklyS3color( Cyan),
MonthlyR3color( Magenta),
MonthlyR2color( Magenta),
MonthlyR1color( Magenta),
MonthlyPPcolor( Magenta),
MonthlyS1color( Magenta),
MonthlyS2color( Magenta),
MonthlyS3color( Magenta),
DailyMidPtcolor( Yellow),
WeeklyMidPtcolor( Cyan),
MonthlyMidPtcolor( Magenta),
DailyResSupStyle( 1), // 1 = solid, 2 = dashed, 3 = dotted, 4 = Dashed2, 5 = dashed3
ResSupStyle( 2),
PivotPointStyle (1),
MidPtStyle( 3);
variables:
S1( 0 ),
S2( 0 ),
S3( 0 ),
R1( 0 ),
R2( 0 ),
R3( 0 ),
PP( 0 ),
Rng( 0 ),
TL_S1( 0 ),
TL_S2( 0 ),
TL_S3( 0 ),
TL_R1( 0 ),
TL_R2( 0 ),
TL_R3( 0 ),
TL_PP( 0 ),
TL_M1( 0 ),
TL_M2( 0 ),
TL_M3( 0 ),
TL_M4( 0 ),
TL_M5( 0 ),
TL_M6( 0 ),
StartDate( 0 ),
StartTime( 0 ),
Text_S1( 0 ),
Text_S2( 0 ),
Text_S3( 0 ),
Text_R1( 0 ),
Text_R2( 0 ),
Text_R3( 0 ),
Text_PP( 0 );
if CurrentBar = 1 then
begin
StartDate = Date;
StartTime = Time;
end;
if LastBarOnChart then
begin
// Daily Pivot Points
Rng = DailyHigh - DailyLow;
PP = (DailyHigh + DailyLow + DailyClose) / 3 ;
R1 = (2*PP) - DailyLow ;
R2 = PP + Rng ;
R3 = R1 + Rng;
S1 = (2*PP) - DailyHigh ;
S2 = PP - Rng ;
S3 = S1 - Rng ;
TL_R3 = TL_New(StartDate, StartTime, R3, Date, Time, R3);
TL_SetColor(TL_R3, DailyR3color);
TL_SetStyle(TL_R3, DailyResSupStyle);
TL_SetExtRight(TL_R3, True);
Text_R3 = Text_New(Date, Time, TL_GetValue(TL_R3, Date, Time), "R3 " + NumToStr(TL_GetValue(TL_R3, Date, Time),2));
Text_SetColor(Text_R3, DailyR1color);
Text_R3 = Text_SetLocation(Text_R3, Date, Time, TL_GetValue(TL_R3, Date, Time));
TL_R2 = TL_New(StartDate, StartTime, R2, Date, Time, R2);
TL_SetColor(TL_R2, DailyR2color);
TL_SetStyle(TL_R2, DailyResSupStyle);
TL_SetExtRight(TL_R2, True);
Text_R2 = Text_New(Date, Time, TL_GetValue(TL_R2, Date, Time), "R2 " + NumToStr(TL_GetValue(TL_R2, Date, Time),2));
Text_SetColor(Text_R2, DailyR1color);
Text_R2 = Text_SetLocation(Text_R2, Date, Time, TL_GetValue(TL_R2, Date, Time));
TL_R1 = TL_New(StartDate, StartTime, R1, Date, Time, R1);
TL_SetColor(TL_R1, DailyR1color);
TL_SetStyle(TL_R1, DailyResSupStyle);
TL_SetExtRight(TL_R1, True);
Text_R1 = Text_New(Date, Time, TL_GetValue(TL_R1, Date, Time), "R1 " + NumToStr(TL_GetValue(TL_R1, Date, Time),2));
Text_SetColor(Text_R1, DailyR1color);
Text_R1 = Text_SetLocation(Text_R1, Date, Time, TL_GetValue(TL_R1, Date, Time));
TL_PP = TL_New(StartDate, StartTime, PP, Date, Time, PP);
TL_SetColor(TL_PP, DailyPPcolor);
TL_SetStyle(TL_PP, PivotPointStyle);
TL_SetSize(TL_PP, 1);
TL_SetExtRight(TL_PP, True);
Text_PP = Text_New(Date, Time, TL_GetValue(TL_PP, Date, Time), "D PP " + NumToStr(TL_GetValue(TL_PP, Date, Time),2));
Text_SetColor(Text_PP, DailyPPcolor);
Text_PP = Text_SetLocation(Text_PP, Date, Time, TL_GetValue(TL_PP, Date, Time));
TL_S1 = TL_New(StartDate, StartTime, S1, Date, Time, S1);
TL_SetColor(TL_S1, DailyS1color);
TL_SetStyle(TL_S1, DailyResSupStyle);
TL_SetExtRight(TL_S1, True);
Text_S1 = Text_New(Date, Time, TL_GetValue(TL_S1, Date, Time), "S1 " + NumToStr(TL_GetValue(TL_S1, Date, Time),2));
Text_SetColor(Text_S1, DailyS1color);
Text_S1 = Text_SetLocation(Text_S1, Date, Time, TL_GetValue(TL_S1, Date, Time));
TL_S2 = TL_New(StartDate, StartTime, S2, Date, Time, S2);
TL_SetColor(TL_S2, DailyS2color);
TL_SetStyle(TL_S2, DailyResSupStyle);
TL_SetExtRight(TL_S2, True);
Text_S2 = Text_New(Date, Time, TL_GetValue(TL_S2, Date, Time), "S2 " + NumToStr(TL_GetValue(TL_S2, Date, Time),2));
Text_SetColor(Text_S2, DailyS1color);
Text_S2 = Text_SetLocation(Text_S2, Date, Time, TL_GetValue(TL_S2, Date, Time));
TL_S3 = TL_New(StartDate, StartTime, S3, Date, Time, S3);
TL_SetColor(TL_S3, DailyS3color);
TL_SetStyle(TL_S3, DailyResSupStyle);
TL_SetExtRight(TL_S3, True);
Text_S3 = Text_New(Date, Time, TL_GetValue(TL_S3, Date, Time), "S3 " + NumToStr(TL_GetValue(TL_S3, Date, Time),2));
Text_SetColor(Text_S3, DailyS1color);
Text_S3 = Text_SetLocation(Text_S3, Date, Time, TL_GetValue(TL_S3, Date, Time));
if PlotDailyMidPts then
begin
TL_M1 = TL_New(StartDate, StartTime, (R2+R3)/2, Date, Time, (R2+R3)/2);
TL_SetColor(TL_M1, DailyMidPtcolor);
TL_SetStyle(TL_M1, MidPtStyle);
TL_SetExtRight(TL_M1, True);
TL_M2 = TL_New(StartDate, StartTime, (R1+R2)/2, Date, Time, (R1+R2)/2);
TL_SetColor(TL_M2, DailyMidPtcolor);
TL_SetStyle(TL_M2, MidptStyle);
TL_SetExtRight(TL_M2, True);
TL_M3 = TL_New(StartDate, StartTime, (PP+R1)/2, Date, Time, (PP+R1)/2);
TL_SetColor(TL_M3, DailyMidPtcolor);
TL_SetStyle(TL_M3, MidPtStyle);
TL_SetExtRight(TL_M3, True);
TL_M4 = TL_New(StartDate, StartTime, (S1+PP)/2, Date, Time, (S1+PP)/2);
TL_SetColor(TL_M4, DailyMidPtcolor);
TL_SetStyle(TL_M4, MidPtStyle);
TL_SetExtRight(TL_M4, True);
TL_M5 = TL_New(StartDate, StartTime, (S2+S1)/2, Date, Time, (S2+S1)/2);
TL_SetColor(TL_M5, DailyMidPtcolor);
TL_SetStyle(TL_M5, MidPtStyle);
TL_SetExtRight(TL_M5, True);
TL_M6 = TL_New(StartDate, StartTime, (S3+S2)/2, Date, Time, (S3+S2)/2);
TL_SetColor(TL_M6, DailyMidPtcolor);
TL_SetStyle(TL_M6, MidPtStyle);
TL_SetExtRight(TL_M6, True);
end;
// Weekly Pivot Points
Rng = WeeklyHigh - WeeklyLow;
PP = (WeeklyHigh + WeeklyLow + WeeklyClose) / 3 ;
R1 = (2*PP) - WeeklyLow ;
R2 = PP + Rng ;
R3 = R1 + Rng;
S1 = (2*PP) - WeeklyHigh ;
S2 = PP - Rng ;
S3 = S1 - Rng ;
TL_R3 = TL_New(StartDate, StartTime, R3, Date, Time, R3);
TL_SetColor(TL_R3, WeeklyR3color);
TL_SetStyle(TL_R3, ResSupStyle);
TL_SetExtRight(TL_R3, True);
Text_R3 = Text_New(Date, Time, TL_GetValue(TL_R3, Date, Time), "R3 " + NumToStr(TL_GetValue(TL_R3, Date, Time),2));
Text_SetColor(Text_R3, WeeklyR3color);
Text_R3 = Text_SetLocation(Text_R3, Date, Time, TL_GetValue(TL_R3, Date, Time));
TL_R2 = TL_New(StartDate, StartTime, R2, Date, Time, R2);
TL_SetColor(TL_R2, WeeklyR2color);
TL_SetStyle(TL_R2, ResSupStyle);
TL_SetExtRight(TL_R2, True);
Text_R2 = Text_New(Date, Time, TL_GetValue(TL_R2, Date, Time), "R2 " + NumToStr(TL_GetValue(TL_R2, Date, Time),2));
Text_SetColor(Text_R2, WeeklyR2color);
Text_R2 = Text_SetLocation(Text_R2, Date, Time, TL_GetValue(TL_R2, Date, Time));
TL_R1 = TL_New(StartDate, StartTime, R1, Date, Time, R1);
TL_SetColor(TL_R1, WeeklyR1color);
TL_SetStyle(TL_R1, ResSupStyle);
TL_SetExtRight(TL_R1, True);
Text_R1 = Text_New(Date, Time, TL_GetValue(TL_R1, Date, Time), "R1 " + NumToStr(TL_GetValue(TL_R1, Date, Time),2));
Text_SetColor(Text_R1, WeeklyR1color);
Text_R1 = Text_SetLocation(Text_R1, Date, Time, TL_GetValue(TL_R1, Date, Time));
TL_PP = TL_New(StartDate, StartTime, PP, Date, Time, PP);
TL_SetColor(TL_PP, WeeklyPPcolor);
TL_SetStyle(TL_PP, PivotPointStyle);
TL_SetExtRight(TL_PP, True);
Text_PP = Text_New(Date, Time, TL_GetValue(TL_PP, Date, Time), "W PP " + NumToStr(TL_GetValue(TL_PP, Date, Time),2));
Text_SetColor(Text_PP, WeeklyPPcolor);
Text_PP = Text_SetLocation(Text_PP, Date, Time, TL_GetValue(TL_PP, Date, Time));
TL_S1 = TL_New(StartDate, StartTime, S1, Date, Time, S1);
TL_SetColor(TL_S1, WeeklyS1color);
TL_SetStyle(TL_S1, ResSupStyle);
TL_SetExtRight(TL_S1, True);
Text_S1 = Text_New(Date, Time, TL_GetValue(TL_S1, Date, Time), "S1 " + NumToStr(TL_GetValue(TL_S1, Date, Time),2));
Text_SetColor(Text_S1, WeeklyS1color);
Text_S1 = Text_SetLocation(Text_S1, Date, Time, TL_GetValue(TL_S1, Date, Time));
TL_S2 = TL_New(StartDate, StartTime, S2, Date, Time, S2);
TL_SetColor(TL_S2, WeeklyS2color);
TL_SetStyle(TL_S2, ResSupStyle);
TL_SetExtRight(TL_S2, True);
Text_S2 = Text_New(Date, Time, TL_GetValue(TL_S2, Date, Time), "S2 " + NumToStr(TL_GetValue(TL_S2, Date, Time),2));
Text_SetColor(Text_S2, WeeklyS2color);
Text_S2 = Text_SetLocation(Text_S2, Date, Time, TL_GetValue(TL_S2, Date, Time));
TL_S3 = TL_New(StartDate, StartTime, S3, Date, Time, S3);
TL_SetColor(TL_S3, WeeklyS3color);
TL_SetStyle(TL_S3, ResSupStyle);
TL_SetExtRight(TL_S3, True);
Text_S3 = Text_New(Date, Time, TL_GetValue(TL_S3, Date, Time), "S3 " + NumToStr(TL_GetValue(TL_S3, Date, Time),2));
Text_SetColor(Text_S3, WeeklyS3color);
Text_S3 = Text_SetLocation(Text_S3, Date, Time, TL_GetValue(TL_S3, Date, Time));
if PlotWeeklyMidPts then
begin
TL_M1 = TL_New(StartDate, StartTime, (R2+R3)/2, Date, Time, (R2+R3)/2);
TL_SetColor(TL_M1, WeeklyMidPtcolor);
TL_SetStyle(TL_M1, MidPtStyle);
TL_SetExtRight(TL_M1, True);
TL_M2 = TL_New(StartDate, StartTime, (R1+R2)/2, Date, Time, (R1+R2)/2);
TL_SetColor(TL_M2, WeeklyMidPtcolor);
TL_SetStyle(TL_M2, MidptStyle);
TL_SetExtRight(TL_M2, True);
TL_M3 = TL_New(StartDate, StartTime, (PP+R1)/2, Date, Time, (PP+R1)/2);
TL_SetColor(TL_M3, WeeklyMidPtcolor);
TL_SetStyle(TL_M3, MidPtStyle);
TL_SetExtRight(TL_M3, True);
TL_M4 = TL_New(StartDate, StartTime, (S1+PP)/2, Date, Time, (S1+PP)/2);
TL_SetColor(TL_M4, WeeklyMidPtcolor);
TL_SetStyle(TL_M4, MidPtStyle);
TL_SetExtRight(TL_M4, True);
TL_M5 = TL_New(StartDate, StartTime, (S2+S1)/2, Date, Time, (S2+S1)/2);
TL_SetColor(TL_M5, WeeklyMidPtcolor);
TL_SetStyle(TL_M5, MidPtStyle);
TL_SetExtRight(TL_M5, True);
TL_M6 = TL_New(StartDate, StartTime, (S3+S2)/2, Date, Time, (S3+S2)/2);
TL_SetColor(TL_M6, WeeklyMidPtcolor);
TL_SetStyle(TL_M6, MidPtStyle);
TL_SetExtRight(TL_M6, True);
end;
// Monthly Pivot Points
Rng = MonthlyHigh - MonthlyLow;
PP = (MonthlyHigh + MonthlyLow + MonthlyClose) / 3 ;
R1 = (2*PP) - MonthlyLow ;
R2 = PP + Rng ;
R3 = R1 + Rng;
S1 = (2*PP) - MonthlyHigh ;
S2 = PP - Rng ;
S3 = S1 - Rng ;
TL_R3 = TL_New(StartDate, StartTime, R3, Date, Time, R3);
TL_SetColor(TL_R3, MonthlyR3color);
TL_SetStyle(TL_R3, ResSupStyle);
TL_SetExtRight(TL_R3, True);
Text_R3 = Text_New(Date, Time, TL_GetValue(TL_R3, Date, Time), "R3 " + NumToStr(TL_GetValue(TL_R3, Date, Time),2));
Text_SetColor(Text_R3, MonthlyR3color);
Text_R3 = Text_SetLocation(Text_R3, Date, Time, TL_GetValue(TL_R3, Date, Time));
TL_R2 = TL_New(StartDate, StartTime, R2, Date, Time, R2);
TL_SetColor(TL_R2, MonthlyR2color);
TL_SetStyle(TL_R2, ResSupStyle);
TL_SetExtRight(TL_R2, True);
Text_R2 = Text_New(Date, Time, TL_GetValue(TL_R2, Date, Time), "R2 " + NumToStr(TL_GetValue(TL_R2, Date, Time),2));
Text_SetColor(Text_R2, MonthlyR2color);
Text_R2 = Text_SetLocation(Text_R2, Date, Time, TL_GetValue(TL_R2, Date, Time));
TL_R1 = TL_New(StartDate, StartTime, R1, Date, Time, R1);
TL_SetColor(TL_R1, MonthlyR1color);
TL_SetStyle(TL_R1, ResSupStyle);
TL_SetExtRight(TL_R1, True);
Text_R1 = Text_New(Date, Time, TL_GetValue(TL_R1, Date, Time), "R1 " + NumToStr(TL_GetValue(TL_R1, Date, Time),2));
Text_SetColor(Text_R1, MonthlyR1color);
Text_R1 = Text_SetLocation(Text_R1, Date, Time, TL_GetValue(TL_R1, Date, Time));
TL_PP = TL_New(StartDate, StartTime, PP, Date, Time, PP);
TL_SetColor(TL_PP, MonthlyPPcolor);
TL_SetStyle(TL_PP, PivotPointStyle);
TL_SetExtRight(TL_PP, True);
Text_PP = Text_New(Date, Time, TL_GetValue(TL_PP, Date, Time), "M PP " + NumToStr(TL_GetValue(TL_PP, Date, Time),2));
Text_SetColor(Text_PP, MonthlyPPcolor);
Text_PP = Text_SetLocation(Text_PP, Date, Time, TL_GetValue(TL_PP, Date, Time));
TL_S1 = TL_New(StartDate, StartTime, S1, Date, Time, S1);
TL_SetColor(TL_S1, MonthlyS1color);
TL_SetStyle(TL_S1, ResSupStyle);
TL_SetExtRight(TL_S1, True);
Text_S1 = Text_New(Date, Time, TL_GetValue(TL_S1, Date, Time), "S1 " + NumToStr(TL_GetValue(TL_S1, Date, Time),2));
Text_SetColor(Text_S1, MonthlyS1color);
Text_S1 = Text_SetLocation(Text_S1, Date, Time, TL_GetValue(TL_S1, Date, Time));
TL_S2 = TL_New(StartDate, StartTime, S2, Date, Time, S2);
TL_SetColor(TL_S2, MonthlyS2color);
TL_SetStyle(TL_S2, ResSupStyle);
TL_SetExtRight(TL_S2, True);
Text_S2 = Text_New(Date, Time, TL_GetValue(TL_S2, Date, Time), "S2 " + NumToStr(TL_GetValue(TL_S2, Date, Time),2));
Text_SetColor(Text_S2, MonthlyS2color);
Text_S2 = Text_SetLocation(Text_S2, Date, Time, TL_GetValue(TL_S2, Date, Time));
TL_S3 = TL_New(StartDate, StartTime, S3, Date, Time, S3);
TL_SetColor(TL_S3, MonthlyS3color);
TL_SetStyle(TL_S3, ResSupStyle);
TL_SetExtRight(TL_S3, True);
Text_S3 = Text_New(Date, Time, TL_GetValue(TL_S3, Date, Time), "S3 " + NumToStr(TL_GetValue(TL_S3, Date, Time),2));
Text_SetColor(Text_S3, MonthlyS3color);
Text_S3 = Text_SetLocation(Text_S3, Date, Time, TL_GetValue(TL_S3, Date, Time));
if PlotMonthlyMidPts then
begin
TL_M1 = TL_New(StartDate, StartTime, (R2+R3)/2, Date, Time, (R2+R3)/2);
TL_SetColor(TL_M1, MonthlyMidPtcolor);
TL_SetStyle(TL_M1, MidPtStyle);
TL_SetExtRight(TL_M1, True);
TL_M2 = TL_New(StartDate, StartTime, (R1+R2)/2, Date, Time, (R1+R2)/2);
TL_SetColor(TL_M2, MonthlyMidPtcolor);
TL_SetStyle(TL_M2, MidptStyle);
TL_SetExtRight(TL_M2, True);
TL_M3 = TL_New(StartDate, StartTime, (PP+R1)/2, Date, Time, (PP+R1)/2);
TL_SetColor(TL_M3, MonthlyMidPtcolor);
TL_SetStyle(TL_M3, MidPtStyle);
TL_SetExtRight(TL_M3, True);
TL_M4 = TL_New(StartDate, StartTime, (S1+PP)/2, Date, Time, (S1+PP)/2);
TL_SetColor(TL_M4, MonthlyMidPtcolor);
TL_SetStyle(TL_M4, MidPtStyle);
TL_SetExtRight(TL_M4, True);
TL_M5 = TL_New(StartDate, StartTime, (S2+S1)/2, Date, Time, (S2+S1)/2);
TL_SetColor(TL_M5, MonthlyMidPtcolor);
TL_SetStyle(TL_M5, MidPtStyle);
TL_SetExtRight(TL_M5, True);
TL_M6 = TL_New(StartDate, StartTime, (S3+S2)/2, Date, Time, (S3+S2)/2);
TL_SetColor(TL_M6, MonthlyMidPtcolor);
TL_SetStyle(TL_M6, MidPtStyle);
TL_SetExtRight(TL_M6, True);
end;
end; |
|