Amibroker Exploration Help

#1
Hi I'm trying to create an ami exporation AFl which will scan stock for "intraday fall from high" and "intraday recovery from low". The section is supposed to scan for % change and provide net % change value with color. Its showing no value instead. Would be grateful if I could find some help here.

Code:
_SECTION_BEGIN("Formula2");
DOpen = TimeFrameGetPrice( "O", inDaily, 0 ); // gives you Todays Open price.
DHigh = TimeFrameGetPrice( "H", inDaily, 0 ); // gives you Todays High price.
DLow = TimeFrameGetPrice( "L", inDaily, 0 ); // gives you Todays High price.
DLast = TimeFrameGetPrice( "C", inDaily, 0); //


if ("DLast" == "DHigh")
mod = ((Dlast - Dlow)/Dlow*100);
else if ("DLast" == "DLow")
mod = ((Dlow - DHigh)/Dhigh*100);

Net = Param("mod",null,0,100);


Filter = Buy OR Sell ;

colorstatus = IIf( DLast == DHigh,colorGreen,IIf( DLast == DLow,colorRed,Null));

AddColumn(Net, "NET",1.2 );


shape = Buy*shapeUpArrow + Sell*shapeDownArrow;
PlotShapes(shape, IIf( Buy, colorLime, colorRed),0,IIf( Buy, low, high) );

_SECTION_END();
 
#2
//Percentage Fall From Days High

Filter = 1;
C1 = C - H;
CHANGE=100*(C1/H);
AddColumn( Open, "Open " );
AddColumn( High, "High " );
AddColumn( Low, "Low " );
AddColumn( Close, "Close " );
AddColumn( Change, "Change " );
AddColumn( Volume, "Volume " );

//Percentage recovered from Day's Low

Filter = 1;
C1 = C - L;
CHANGE=100*(C1/L);
AddColumn( Open, "Open " );
AddColumn( Low, "Low " );
AddColumn( High, "High " );
AddColumn( Close, "Close " );
AddColumn( Change, "Change " );
AddColumn( Volume, "Volume " );
 
#3
//Percentage Fall From Days High

Filter = 1;
C1 = C - H;
CHANGE=100*(C1/H);
AddColumn( Open, "Open " );
AddColumn( High, "High " );
AddColumn( Low, "Low " );
AddColumn( Close, "Close " );
AddColumn( Change, "Change " );
AddColumn( Volume, "Volume " );

//Percentage recovered from Day's Low

Filter = 1;
C1 = C - L;
CHANGE=100*(C1/L);
AddColumn( Open, "Open " );
AddColumn( Low, "Low " );
AddColumn( High, "High " );
AddColumn( Close, "Close " );
AddColumn( Change, "Change " );
AddColumn( Volume, "Volume " );


Hi Sushil, thanks for your reply. Unfortunately what im trying ti to achieve is slightly different than what you mentioned. When you will use exploration function on the below code, its saying Error 29. Variable 'net'used without having been initialized. Cant figure out whats wrong here.

Code:
_SECTION_BEGIN("High Low Exploration");

DDOpen = TimeFrameGetPrice( "O", inDaily, 0 ); // gives you Todays Open price.
DHigh = TimeFrameGetPrice( "H", inDaily, 0 ); // gives you Todays High price.
DLow = TimeFrameGetPrice( "L", inDaily, 0 ); // gives you Todays High price.
DLast = TimeFrameGetPrice( "C", inDaily, 0); //


if ("DLast" == "DHigh")
net = ((Dlast - Dlow)/Dlow*100);
else if ("DLast" == "DLow")
net = ((Dlow - DHigh)/Dhigh*100);


Buy = Ref(C, 0) > Ref(C,-1) AND Ref(C,-1) > Ref(C,-2) AND Ref(C,-2) > Ref(C, -3) AND Ref(C, 0)>30 AND ADX(14)>30  AND PDI(14)>30  AND PDI(14)>ADX(14) AND MDI(14) <15 AND Ref(C,0)> MA(C,250) AND High > Ref(HHV(C,50),-1) ;
Sell = Ref(C, 0) < Ref(C,-1) AND Ref(C,-1) < Ref(C,-2) AND Ref(C,-2) < Ref(C, -3)  AND Ref(C, 0)>25 AND ADX(14)>30  AND MDI(14)>30  AND MDI(14)>ADX(14) AND PDI(14)<15 AND Ref(C,0) < MA(C,250) AND  Low  < Ref(LLV(C,50),-1) ;

Filter = Buy OR Sell ;

colorstatus = IIf( DLast == DHigh,colorGreen,IIf( DLast == DLow,colorRed,Null));

AddColumn(net, "NET",1.2 );


shape = Buy*shapeUpArrow + Sell*shapeDownArrow;
PlotShapes(shape, IIf( Buy, colorLime, colorRed),0,IIf( Buy, low, high) );

_SECTION_END();
 

Similar threads