hi,
I need help for writing afl.
i need buy signal in intraday chart when price closes abv. previous
day high and once it occurs then next buy level would be highest
high value after last buy and so on.
I started to write this as below
H1= TimeFrameGetPrice( "H", inDaily, -1 );
L1=TimeFrameGetPric e( "L", inDaily, -1 );
C1=TimeFrameGetPric e( "C", inDaily, -1 );
up= H1;
down=L1;
B1=Cross(C,up) AND TimeNum()>=101500;
S1=Cross(down, C) AND TimeNum()>=101500;
//timenum()is used for avoiding buy sell levels before 10.15 AM
// this part is for calculating next levels
up1=HighestSince( B1,H);
down1=LowestSince( S1,L);
B2=Cross(C,up1) AND TimeNum()>=101500;
S2=Cross(down1, C) AND TimeNum()>=101500;
//Generating Signals
Buy=B1 OR B2;
Sell=S1 OR S2;
Buy = ExRemSpan( Buy, 3 );
Sell = ExRemSpan( Sell,3 );
// For Exploration and Scanning and Arrow Display
Signalshape= Buy*shapeUpArrow + Sell*shapeDownArrow ;
pos = 1*ATR(50);
pos1 = 2.5*ATR(50);
PlotShapes( Signalshape, IIf( Buy, colorGreen, colorRed ),0, IIf(
Buy, Low-pos, High+pos ),0 );
//PlotShapes( (shapeSmallCircl e *Buy ,colorBrightGreen, 0,L,5)
for( i = 0; i < BarCount; i++ ) {
if( Buy[i] ) PlotText( "@ Buy : " +"\n"+ up[i], i, Low[i] -
pos1[i], colorGreen );
if( Sell[i] ) PlotText( "@ Sell : " +"\n"+ down[i], i, H[i] +
pos1[i], colorRed );
};
============ ========= ========= ========= ========= ========= ========= ==
But it is not working properly. Every time its putting arrow after
price crosses the previous high.
I think I have to arrest up and down variables after first buy sell
signal of the particular day and for the next time onwards teh
values would be new high and low.
Please help
Debdulal
Kolkata
India