Code help please

Trdr

Well-known member
Messages
461
Likes
21
The following code is supposed to draw angles from the H, L or C, but only draws a line from the LL regardless of settings — see chart 'Angle 1'.

Can you provide the code so lines will draw up or down from the H, L or C and also include the code to enter HHMM as well as the date so the indicator can be used on intraday charts.
Also is it possible for the line to 're-scale' as the scaling of the chart changes so the angle retains it's position thru the price bars.

I want to be able to draw user defined 'Gann Angle' lines. If you can create an 'Angle' indicator according to the requested requirements I'll provide a 'methodology' of how to use the 'Angle' to create a 'matrix' and how it might be used to assist in trading — see chart 'Angle 2'.

YMD := Input("Please enter date (YYYYMMDD)",
19010101,29991231,20050501);
Y0Type := Input("From 1-H, 2-L, 3-C",1,3,3);
Angle := Input("Angle",0,360,45);

{Build date counter}
xYMD := Year() * 10000 + Month() * 100 + DayOfMonth();

{Calculate slope from angle}
dY := Cos(Angle) / Sin(Angle);

{Draw angle when we hit the date}
(xYMD>=YMD)*dY+((Y0Type=1)*H+(Y0Type=2)*L+(Y0Type=3)*C)*(Ref(xYMD,-1)=YMD)+PREV
 

Attachments

  • Angle 1.jpg
    Angle 1.jpg
    37.4 KB · Views: 376
  • Angle 2.jpg
    Angle 2.jpg
    68.2 KB · Views: 359
Top