AFL help --Buy if HIGH Cross the "HIGH of candle that cross Pivot line from down side" and vice versa for sell

#1
Hi all …
My first try to create a code with a simple pivot level crossover is not working.
Please any brother can help me in this ….

My buy condition----If high of any candle cross the high point of the candle that cross Pivot line from down side.
My sell condition---- If low of any candle cross the low point of the candle that cross Pivot line from up side.

here is my code.....…


PP = (DayL + DayH + DayC)/3; PPI = LastValue (PP,1); // Pivot

Buy1 =Cross(C,PP);
Sell1 =Cross(PP,C) ;
Breakout1 = Cross(H,Buy1);
Breakout2 = Cross(L,Sell1);

Buy = Cover= Breakout1;

Short = Sell= Breakout2;


PlotShapes( shapeUpArrow* Buy , colorBlue ,0,Low, Offset=-15);
PlotShapes( shapeDownArrow* Sell, colorRed ,0,High, Offset=-20);
PlotShapes( shapeUpTriangle* Cover , colorGreen ,0,Low, Offset=-30);
PlotShapes( shapeDownTriangle* Short, colorWhite ,0,High, Offset=-35);

_SECTION_END();
 
#3
DayL,DayH,DayC needs to be defined. These are not amibroker inbuilt variables
You should define those variable before using them.
eg.
DayH= TimeFrameGetPrice( "H", inDaily, -1 );
thanks Auto_Trader...
DayL,DayH,DayC are already defined.......only thing where code is not working is on my buy and sell conditions .
I will run it on 1 minute chart....

In case of BUY signal ,Candle that crosses Pivot line from below is identified......now I have to show BUY signal on candle that crosses high of prior identified candle high....
 
Last edited:
#4
I am guessing what you are trying to achieve is

buy = cover = cross ( H, valuewhen(cross(C,PP),H));
short = sell = cross ( valuewhen(cross(PP,C),L),L);