Need help on Amibroker AFL.

infor

New Member
#1
Hello Friends,

Greeting! I am new learning amibroker coding and have been in this for the last few months. I am looking for a code to draw a slope line between 2 points

example line between today's high and today's low , between yesterday's high yesterday's line. Likewise making a zigzag patteren between the time interval highs and lows. Can someone please help me with the code. I would be very thankful.

I am attaching a picture to make things understand what i actually need.

I have tried using the linearray function but could not make it work
 

Attachments

travi

Well-Known Member
#3
Post your code.

Anyways, this should get u started.

// Days to go back
A = 1;
B = 2

// Yest Bar
DaybarX1 = BarCount - 1 - A;

// 2 days ago bar
DaybarX0 = BarCount - 1 - B;

// High of yest
NDayH1 = H[DaybarX1];

// Low of 2 days ago
NDayLo = L[DaybarX0];

//Create a line from 2 days ago low to yesterdays high.
Line1 = LineArray( DaybarX0, NDayLo, DaybarX0, NDayH1, 1 );

// Draw the line
Plot( Line1, "Trend line", colorBlue );

//You need to play with the variables A,B like in a FOR Loop etc to reference the required bars on your TF eg. Daily in this case
 
Last edited:

infor

New Member
#4
Hello travi,

Thank you very much for you response. I really appreciate it.

I will try this code and see if it works for me. Will keep u posted.

Thanks again. GOD Bless. :)
 

Similar threads