Plotting lines for specific array values only

Hello community,

I have coded a pivot high, pivot low CS pattern detection AFL code.
I am tring to plot a line from the Pivot High and the Pivot Low.
Not having any luck, nothing is plotting when I try.

Is possible, how can I control the amount of Pivot High/Low lines that are created on screen and how can I control the length of the lines?

My code is below. Thanks for your help

// Pivot High yesterdays close greater than todays close and greater than the day before yesterday. The opens are the same
// Pivot Low yesterdays close is lower than todays close and lower than the day before. The Opens follow the same pattern
// Pivot High and Pivot Low occur next to each other
// A PH or PL can occur first
// A PH has to occur above a PivLow


for(i=1; i < BarCount -1; i++)
//determining a Pivot High
if(H[i] > H[i-1] AND H[i] >H[i+1] AND
	L[i] > L[i-1] AND L[i] > L[i+1])
	PivotHigh[i] = 1;
	PivotHighValue = ValueWhen(PivotHigh ==1,H);
	//if(PivotHigh[i] == 1)
	//	{ PivotHighValue[i] = High[i];}
	//else {Pivothighvalue[i] = 0;}

		PivotHigh[i] = 0;

//determing a pivotlow
if(L[i] < L[i-1] AND L[i] < L[i+1] AND
   H[i] < H[i-1] AND H[i] < H[i+1])
   PivotLow[i] = 1;
   PivotLowValue = ValueWhen(PivotLow == 1,L);
  // if(pivotlow[i] ==1)
		//{PivotLowValue[i] = Low[i];}
  // Else	{PivotlowValue[i] = 0; }
	pivotlow[i] = 0;

A1 = ExRem(Pivothigh,pivotlow); A2 = ExRem(PivotLow,PivotHigh);
PivShape = IIf(A1 AND PivotHigh ==1, shapeUpArrow,IIf(A2 AND Pivotlow ==1, shapeDownArrow,shapeNone));
PlotShapes(PivShape,colorBlue,0, High + (0.03) );

A3 = IIf(A1 ==1 AND PivotHigh ==1,Pivothighvalue,Null);

// Exploration code for testing only
Filter = 1;
AddColumn(A1,"Exrem PVH,PVL",1.2,colorDefault,IIf(A1 ==1,colorRed,Null));
AddColumn(PivotHigh,"PivotHigh",1.2,colorDefault,IIf(Pivothigh ==1,colorRed,Null));

AddColumn(A2,"Exrem PVL,PVH",1.2,colorDefault,IIf(A2 ==1,colorLightBlue,Null));
AddColumn(PivotLow,"Pivotlow",1.2,colorDefault,IIf(PivotLow ==1,colorLightBlue,Null));


see if you can get any ideas from the following:
AFL Function Reference - LINEARRAY (

this is one should also do it.
Plot horizontal line until crossed - AFL Programming - AmiBroker Community Forum

Drawing Multiple Lines using GetAsyncKeyState (or any better method) - AFL Programming - AmiBroker Community Forum

Conditional horizontal lines. Custom values displayed on Y axis area - AFL Programming - AmiBroker Community Forum

1 Like

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.