[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Adding price labels to end of horizontal lines TS2000i



PureBytes Links

Trading Reference Links

I am trying to add a text label at the end of 4 horizontal lines drawn by this Gann S/R indicator...but I'm stuck! I want to show the price level at each supp/res line. I'm New at this and am having some trouble with the proper code to achieve this. Can anyone help?
Code is shown below:

{Indicator: C.Lee_GannS&R
Purpose:Plot 3 Gann support and resistance lines at each pivot detected by SwingLee
User specifies Gann angles to use.
Author: Clyde Lee, Copyright 6/2000
Permission: Permission to use in any fashion desired if proper credit is given crediting author and indicating copyright.}


Inputs: NBars(19),{Number bars to use in SwingLee for detection of swing points}
Angle1(0.19),
Angle2(0.33),
Angle3(0.55);
{ShowTextLabels(True);}
Vars:Direct(0);
Vars:OldBar(0), OldPrice(0),
NewBar(0), NewPrice(0);
Vars:PriceRoot(0),Price1(0),Price2(0),Price3(0);

{Vars: TextID1(-1),
TextID2(-1),
TextID3(-1),
TextID4(-1),
Line1(-1),
Line2(-1),
Line3(-1),
Line4(-1),
Text1(-1),
Text2(-1),
Text3(-1),
Text4(-1),
FPC(GetBackGroundColor);}

Direct = Swing_Lee(NBars);

If Sign(Direct)<>Sign(Direct[1]) then begin
OldBar = NewBar;
OldPrice = NewPrice;
NewBar = CurrentBar-AbsValue(Direct);
If Direct<0 then
NewPrice = H[-Direct]
else
NewPrice = L[Direct];

PriceRoot = SquareRoot(NewPrice);
Price1 = Square(PriceRoot+Sign(Direct)*Angle1/360*2);
Price2 = Square(PriceRoot+Sign(Direct)*Angle2/360*2);
Price3 = Square(PriceRoot+Sign(Direct)*Angle3/360*2);

For Value1=AbsValue(Direct) downto 0 begin
Plot1[Value1](Price1,"GP1");
Plot2[Value1](Price2,"GP2");
Plot3[Value1](Price3,"GP3");
Plot4[Value1](NewPrice,"np");
End;
End
Else if OldPrice>0 then begin
Plot1[Value1](Price1,"GP1");
Plot2[Value1](Price2,"GP2");
Plot3[Value1](Price3,"GP3");
Plot4[Value1](NewPrice,"np");
End;


{If ShowTextLabels then begin
TextID1=Text1;
Text1=Text_New(D,Plot1,"GP1 ");
Text_SetLocation(Text1,);
Text_SetColor(Text1,Red);
Text_SetStyle(Text1,1,2);
If TextID1<>-1 Then
Text_Delete(TextID1);

TextID2=Text2;
Text2=Text_New(D,Plot2,"GP2 ");
Text_SetLocation(Text2,);
Text_SetColor(Text2,magenta);
Text_SetStyle(Text2,1,2);
If TextID2<>-1 Then
Text_Delete(TextID2);

TextID3=Text3;
Text3=Text_New(D,Plot3,"GP3 ");
Text_SetLocation(Text3,);
Text_SetColor(Text3,Green);
Text_SetStyle(Text3,1,2);
If TextID3<>-1 Then
Text_Delete(TextID3);

TextID4=Text4;
Text4=Text_New(D,Plot4,"np");
Text_SetLocation(Text4,);
Text_SetColor(Text4,cyan);
Text_SetStyle(Text4,1,2);
If TextID4<>-1 Then
Text_Delete(TextID4);
end;

end;}