Hi I just switched over to esignal 10 and was a tradestation user. I was wondering if there is someone there that can help me change my pivot point lines to esignal. Here is the tradestation easy language program.
[LegacyColorValue = true];
Inputs:
StandardColor(Red),
FirstDate(LastCalcDate),
NumDays(3),
PivotType(0);
var:
ii(0),
BeginDate(CalcDate(FirstDate,-NumDays+1)),
EndDate(FirstDate),pDRange(0),pDH(0),pDL(0),pDC(0) ,pDO(0);
var:
kCP ( 1 ),
kR1 ( 2 ),
kS1 ( 3 ),
kR2 ( 4 ),
kS2 ( 5 ),
kR3 ( 6 ),
kS3 ( 7 ),
kS2S3( 8 ),
kS1S2( 9 ),
kCPS1( 10 ),
kCPR1( 11 ),
kR1R2( 12 ),
kR2R3( 13 ),
kMax ( kR2R3 ); { 13 }
Array:
LineID [ 13 ](-1), { should all be kMax }
SRValue [ 13 ](-1),
TextID [ 13 ](-1),
TextLabel[ 13 ]("");
If CurrentBar = 1 then Begin
TextLabel[ kCP ] = "CP";
TextLabel[ kR1 ] = "R1";
TextLabel[ kS1 ] = "S1";
TextLabel[ kR2 ] = "R2";
TextLabel[ kS2 ] = "S2";
TextLabel[ kR3 ] = "R3";
TextLabel[ kS3 ] = "S3";
TextLabel[ kS2S3 ] = "S2S3";
TextLabel[ kS1S2 ] = "S1S2";
TextLabel[ kCPS1 ] = "CPS1";
TextLabel[ kCPR1 ] = "CPR1";
TextLabel[ kR1R2 ] = "R1R2";
TextLabel[ kR2R3 ] = "R2R3";
end;
if false then begin
{ dummy plots to allow user choose their own colors in the standard way }
plot1(0,"S1R1");
plot2(0,"S2R2");
plot3(0,"CS3R3");
plot4(0,"CP");
end;
If DataCompression < 2 { intraday or tick bars }
and Date >= BeginDate and Date <= EndDate then begin
if Date = Date[ 1 ] then begin { other bars in day }
For ii = kCP to kMax begin
TL_SetEnd( LineID[ ii ], Date, Time, SRValue[ ii ] ) ;
end; { for }
end { if Date = Date[ 1 ] }
else Begin { first bar in day }
pDH = HighD(1); pDL = LowD(1); pDC = CloseD(1); pDO = OpenD(1);
pDRange = pDH - pDL;
if PivotType = 1 then SRValue[ kCP ] = (pDH + pDL + O)/3
else if PivotType = 2 then SRValue[ kCP ] = (pDH + pDL + O + O)/4
else if PivotType = 3 then SRValue[ kCP ] = (pDH + pDL + pDC + O)/4
else if PivotType = 4 then SRValue[ kCP ] = (pDH + pDL + pDC + pDO)/4
else SRValue[ kCP ] = (pDH + pDL + pDC)/3;
SRValue[ kR1 ] = SRValue[ kCP ] + pDRange/2;
SRValue[ kS1 ] = SRValue[ kCP ] - pDRange/2;
SRValue[ kR2 ] = SRValue[ kCP ] + pDRange;
SRValue[ kS2 ] = SRValue[ kCP ] - pDRange;
SRValue[ kR3 ] = SRValue[ kR2 ] + pDRange;
SRValue[ kS3 ] = SRValue[ kS2 ] - pDRange;
SRValue[ 8 ] = (SRValue[ kS3 ]+SRValue[ kS2 ])/2;
SRValue[ 9 ] = (SRValue[ kS2 ]+SRValue[ kS1 ])/2;
SRValue[ 10 ] = (SRValue[ kCP ]+SRValue[ kS1 ])/2;
SRValue[ 11 ] = (SRValue[ kCP ]+SRValue[ kR1 ])/2;
SRValue[ 12 ] = (SRValue[ kR1 ]+SRValue[ kR2 ])/2;
SRValue[ 13 ] = (SRValue[ kR2 ]+SRValue[ kR3 ])/2;
For ii = kCP to kMax Begin
{ create lines }
LineID[ ii ] = TL_New(Date,Time,SRValue[ ii ],Date[ 0 ],Time,SRValue[ ii ]);
print("created line ", ii:0:0, " at ", SRValue[ ii ]);
TL_SetExtLeft (LineID[ ii ],false);
TL_SetExtRight(LineID[ ii ],false);
if ii = kCP then
TL_SetColor(LineID[ ii ],GetPlotColor(4))
else if ii = kS1 or ii = kR1 then
TL_SetColor(LineID[ ii ],GetPlotColor(1))
else if ii = kS2 or ii = kR2 then
TL_SetColor(LineID[ ii ],GetPlotColor(2))
else if ii = kS3 or ii = kR3 then
TL_SetColor(LineID[ ii ],GetPlotColor(3))
else
TL_SetColor(LineID[ ii ],StandardColor);
{ create text labels }
TextID[ ii ] = Text_New(Date,Time,SRValue[ ii ],TextLabel[ ii ]);
Text_SetStyle(TextID[ ii ],1,2); { 1: HAlign=right, 2: VAlign=Centered }
if ii = kCP then
Text_SetColor(TextID[ ii ],GetPlotColor(4))
else if ii = kS1 or ii = kR1 then
Text_SetColor(TextID[ ii ],GetPlotColor(1))
else if ii = kS2 or ii = kR2 then
Text_SetColor(TextID[ ii ],GetPlotColor(2))
else if ii = kS3 or ii = kR3 then
Text_SetColor(TextID[ ii ],GetPlotColor(3))
else
Text_SetColor(TextID[ ii ],StandardColor);
{ set line style of the "in-between" levels }
If ii > kS3 then
TL_SetStyle(LineID[ ii ],Tool_dotted);
end; { for }
end; { else }
end;
[LegacyColorValue = true];
Inputs:
StandardColor(Red),
FirstDate(LastCalcDate),
NumDays(3),
PivotType(0);
var:
ii(0),
BeginDate(CalcDate(FirstDate,-NumDays+1)),
EndDate(FirstDate),pDRange(0),pDH(0),pDL(0),pDC(0) ,pDO(0);
var:
kCP ( 1 ),
kR1 ( 2 ),
kS1 ( 3 ),
kR2 ( 4 ),
kS2 ( 5 ),
kR3 ( 6 ),
kS3 ( 7 ),
kS2S3( 8 ),
kS1S2( 9 ),
kCPS1( 10 ),
kCPR1( 11 ),
kR1R2( 12 ),
kR2R3( 13 ),
kMax ( kR2R3 ); { 13 }
Array:
LineID [ 13 ](-1), { should all be kMax }
SRValue [ 13 ](-1),
TextID [ 13 ](-1),
TextLabel[ 13 ]("");
If CurrentBar = 1 then Begin
TextLabel[ kCP ] = "CP";
TextLabel[ kR1 ] = "R1";
TextLabel[ kS1 ] = "S1";
TextLabel[ kR2 ] = "R2";
TextLabel[ kS2 ] = "S2";
TextLabel[ kR3 ] = "R3";
TextLabel[ kS3 ] = "S3";
TextLabel[ kS2S3 ] = "S2S3";
TextLabel[ kS1S2 ] = "S1S2";
TextLabel[ kCPS1 ] = "CPS1";
TextLabel[ kCPR1 ] = "CPR1";
TextLabel[ kR1R2 ] = "R1R2";
TextLabel[ kR2R3 ] = "R2R3";
end;
if false then begin
{ dummy plots to allow user choose their own colors in the standard way }
plot1(0,"S1R1");
plot2(0,"S2R2");
plot3(0,"CS3R3");
plot4(0,"CP");
end;
If DataCompression < 2 { intraday or tick bars }
and Date >= BeginDate and Date <= EndDate then begin
if Date = Date[ 1 ] then begin { other bars in day }
For ii = kCP to kMax begin
TL_SetEnd( LineID[ ii ], Date, Time, SRValue[ ii ] ) ;
end; { for }
end { if Date = Date[ 1 ] }
else Begin { first bar in day }
pDH = HighD(1); pDL = LowD(1); pDC = CloseD(1); pDO = OpenD(1);
pDRange = pDH - pDL;
if PivotType = 1 then SRValue[ kCP ] = (pDH + pDL + O)/3
else if PivotType = 2 then SRValue[ kCP ] = (pDH + pDL + O + O)/4
else if PivotType = 3 then SRValue[ kCP ] = (pDH + pDL + pDC + O)/4
else if PivotType = 4 then SRValue[ kCP ] = (pDH + pDL + pDC + pDO)/4
else SRValue[ kCP ] = (pDH + pDL + pDC)/3;
SRValue[ kR1 ] = SRValue[ kCP ] + pDRange/2;
SRValue[ kS1 ] = SRValue[ kCP ] - pDRange/2;
SRValue[ kR2 ] = SRValue[ kCP ] + pDRange;
SRValue[ kS2 ] = SRValue[ kCP ] - pDRange;
SRValue[ kR3 ] = SRValue[ kR2 ] + pDRange;
SRValue[ kS3 ] = SRValue[ kS2 ] - pDRange;
SRValue[ 8 ] = (SRValue[ kS3 ]+SRValue[ kS2 ])/2;
SRValue[ 9 ] = (SRValue[ kS2 ]+SRValue[ kS1 ])/2;
SRValue[ 10 ] = (SRValue[ kCP ]+SRValue[ kS1 ])/2;
SRValue[ 11 ] = (SRValue[ kCP ]+SRValue[ kR1 ])/2;
SRValue[ 12 ] = (SRValue[ kR1 ]+SRValue[ kR2 ])/2;
SRValue[ 13 ] = (SRValue[ kR2 ]+SRValue[ kR3 ])/2;
For ii = kCP to kMax Begin
{ create lines }
LineID[ ii ] = TL_New(Date,Time,SRValue[ ii ],Date[ 0 ],Time,SRValue[ ii ]);
print("created line ", ii:0:0, " at ", SRValue[ ii ]);
TL_SetExtLeft (LineID[ ii ],false);
TL_SetExtRight(LineID[ ii ],false);
if ii = kCP then
TL_SetColor(LineID[ ii ],GetPlotColor(4))
else if ii = kS1 or ii = kR1 then
TL_SetColor(LineID[ ii ],GetPlotColor(1))
else if ii = kS2 or ii = kR2 then
TL_SetColor(LineID[ ii ],GetPlotColor(2))
else if ii = kS3 or ii = kR3 then
TL_SetColor(LineID[ ii ],GetPlotColor(3))
else
TL_SetColor(LineID[ ii ],StandardColor);
{ create text labels }
TextID[ ii ] = Text_New(Date,Time,SRValue[ ii ],TextLabel[ ii ]);
Text_SetStyle(TextID[ ii ],1,2); { 1: HAlign=right, 2: VAlign=Centered }
if ii = kCP then
Text_SetColor(TextID[ ii ],GetPlotColor(4))
else if ii = kS1 or ii = kR1 then
Text_SetColor(TextID[ ii ],GetPlotColor(1))
else if ii = kS2 or ii = kR2 then
Text_SetColor(TextID[ ii ],GetPlotColor(2))
else if ii = kS3 or ii = kR3 then
Text_SetColor(TextID[ ii ],GetPlotColor(3))
else
Text_SetColor(TextID[ ii ],StandardColor);
{ set line style of the "in-between" levels }
If ii > kS3 then
TL_SetStyle(LineID[ ii ],Tool_dotted);
end; { for }
end; { else }
end;
Comment