The following AFL scanner is not giving signal on Realtime. The signal is delayed by almost 1 hour or so. Please help me in modifying the AFL so that it can give signal on Realtime.
_SECTION_BEGIN("+VE");
Q = Param( "% Change", 2, 0.1, 10, 0.1 );
Z = Zig( C , q ) ;
HH = ( ( Z < Ref( Z, -1 ) AND Ref( Z, -1 ) > Ref( Z, -2 ) ) AND (Peak( z, q, 1 ) > Peak( Z, q, 2 ) ) );
LH = ( ( Z < Ref( Z, -1 ) AND Ref( Z, -1 ) > Ref( Z, -2 ) ) AND (Peak( Z, q, 1 ) < Peak( Z, q, 2 ) ) );
HL = ( ( Z > Ref( Z, -1 ) AND Ref( Z, -1 ) < Ref( Z, -2 ) ) AND (Trough( Z, q, 1 ) > Trough( Z, q, 2 ) ) );
LL = ( ( Z > Ref( Z, -1 ) AND Ref( Z, -1 ) < Ref( Z, -2 ) ) AND (Trough( Z, q, 1 ) < Trough( Z, q, 2 ) ) );
GraphXSpace = 5;
dist = 0.5 * ATR( 20 );
for ( i = 0; i < BarCount; i++ )
{
if ( HH[i] )
PlotText( "- -VE REVERSE", i, H[ i ] + dist[i], colorRed );
if ( LH[i] )
PlotText( "-VE REVERSE", i, H[ i ] + dist[i], colorRed );
if ( HL[i] )
PlotText( "+VE REVERSE", i, L[ i ] - dist[i], colorBrightGreen );
if ( LL[i] )
PlotText( "++ VE REVERSE", i, L[ i ] - dist[i], colorBrightGreen );
}
Filter=HH OR HL OR LH OR LL;
AddColumn(HH,"HH",1);
AddColumn(LH,"LH",1);
AddColumn(HL,"HL",1);
AddColumn (LL,"LL",1);
Buy = HL OR LL;
Sell = HH OR LH;
SellPrice=ValueWhen(Sell,H,1);
BuyPrice=ValueWhen(Buy,L,1);
//Long=Flip(Buy,Sell);
//Shrt=Flip(Sell,Buy );
Plot( Flip( Buy, Sell ), "BUY", colorDarkGreen, styleArea | styleOwnScale, 0, 20 );
Shape = (Buy * shapeSmallUpTriangle + Sell * shapeSmallDownTriangle);
PlotShapes( shape, IIf( Buy, colorYellow, colorYellow ),0, IIf( Buy, Low,High ));
_SECTION_END();