indiTraders - Forum for the Active Indian Trader  

Go Back   indiTraders - Forum for the Active Indian Trader > Tools > Software > Amibroker

DPonline
Reply
 
Bookmark and Share LinkBack Thread Tools Display Modes
  #811 (permalink)  
Old 03-10-2014, 04:00 PM
sumit sumit is offline
Regulars
 
Join Date: May 2013
Posts: 218
Thanks: 642
Thanked 376 Times in 186 Posts
sumit has a spectacular aura aboutsumit has a spectacular aura aboutsumit has a spectacular aura aboutsumit has a spectacular aura aboutsumit has a spectacular aura about
Default

hello to all . the following is an afl from asnavale sir for nr4 and nr7 .

i request following modifications


a) instead of nr4 in the above afl i need nr21 . so can any one insert the param option to select according to one's choice of narrow range. so it may be nr4 ,nr7 or nr21 or whatever may be the trader's choice

b) Also can an option be also introduced in parameters to plot on chart what one wants to see eg nr7 only or nr7 +id (inside day.bar) similarly nr 21 only or nr21+id only .

my whole purpose is to make charts look uncluttered !

best regards

Quote:
_SECTION_BEGIN("NR7");

/*********** NR7 System for Chart and Exploration ***********************/

R = H - L;
NR7 = False;
NR4 = False;
m7 = m4 = idm7 = idm4 = idm = 0;

for(i = 7; i < BarCount; i++)
{
if( R[i] < R[i - 1] AND R[i] < R[i -2] AND R[i] < R[i - 3] AND R[i] < R[i - 4] AND R[i] < R[i - 5] AND R[i] < R[i - 6])
{
NR7[i] = True;
m7[i] = 1;
}
}

for(i = 4; i < BarCount; i++)
{
if((R[i] < R[i - 1] AND R[i] < R[i -2] AND R[i] < R[i - 3] ) AND NOT NR7[i])
{
NR4[i] = True;
m4[i] = 1;
}
}
IDNR7 = Inside() * NR7;
IDNR4 = Inside() * NR4;
ID = Inside();
idm7 = IIf(IDNR7, 1, 0);
idm4 = IIf(IDNR4, 1, 0);
idm = IIf(id, 1, 0);

for(i = 1; i < BarCount; i++)
{
if(IDNR7[i] == IDNR7[i - 1]) idm7[i] = idm7[i] + idm7[i - 1];
if(IDNR4[i] == IDNR4[i - 1]) idm4[i] = idm4[i] + idm4[i - 1];
if(NR7[i] == NR7[i - 1]) m7[i] = m7[i] + m7[i - 1];
if(NR4[i] == NR4[i - 1]) m4[i] = m4[i] + m4[i - 1];
if(ID[i] == ID[i - 1]) idm[i] = idm[i] + idm[i - 1];
}

MarkerIDNR7 = MarkerIDNR4 = shapeStar ;

Marker7 = shapeDigit7;
NR7Color = colorBrightGreen;

Marker4 = shapeDigit4;
NR4Color = colorLightOrange;

MarkerID = shapeHollowCircle;
IDColor = colorYellow;

IDNR7Color = colorBrightGreen;
IDNR4Color = colorLightOrange;

MarkerDist = L * 0.995;
IDNRDist = H * 1.03;

if(Status("action") == actionIndicator)
{
_N(Title = StrFormat("{{NAME}}, {{DATE}} ({{INTERVAL}}): {{VALUES}}") + ", Range=" + Prec(R + 0.00001, 2) + ","
+ WriteIf(IDNR7, EncodeColor(colorBrightGreen) + WriteIf(idm7 > 1, StrLeft(NumToStr(idm7), 4), "") + " IDNR7 ", "")
+ WriteIf(IDNR4, EncodeColor(colorLightOrange) + WriteIf(idm4 > 1, StrLeft(NumToStr(idm4), 4), "") + " IDNR4 ", "")
+ WriteIf(NR7 AND NOT ID, EncodeColor(colorBrightGreen) + WriteIf(m7 > 1, StrLeft(NumToStr(m7), 4), "") + " NR7 ", "")
+ WriteIf(NR4 AND NOT ID, EncodeColor(colorLightOrange) + WriteIf(m4 > 1, StrLeft(NumToStr(m4), 4), "") + " NR4 ", "")
+ WriteIf(ID AND NOT NR7 AND NOT NR4, EncodeColor(colorTurquoise) + WriteIf(idm > 1, StrLeft(NumToStr(idm), 4), "") + " Inside Day ", ""));

PlotOHLC(O, H, L, C, "Close", colorLightGrey, styleBar);
PlotShapes(IIf(IDNR7, MarkerIDNR7, shapeNone), IDNR7Color, 0, IDNRDist);
PlotShapes(IIf(IDNR4 AND NOT IDNR7, MarkerIDNR4, shapeNone), IDNR4Color, 0, IDNRDist);
PlotShapes(IIf(NR7 AND NOT ID, Marker7, shapeNone), NR7Color, 0, MarkerDist);
PlotShapes(IIf(NR4 AND NOT NR7 AND NOT ID, Marker4, shapeNone), NR4Color, 0, MarkerDist);
PlotShapes(IIf(ID AND NOT NR7 AND NOT NR4, MarkerID, shapeNone), IDColor, 0, IDNRDist);
}

if(Status("action") == actionExplore)
{
Filter = (m7 > 0) OR (m4 > 0) OR (idm > 0);

SetOption("NoDefaultColumns", True);

AddColumn(DateTime(), "DATE", formatDateTime, colorDefault, colorDefault, 96);
AddTextColumn(Name(), "SYMBOL", 77, colorDefault, colorDefault, 120);
AddColumn(R, "Range", 6.2, colorDefault, colorDefault, 84);
AddColumn(IIf(idm, 48 + idm, 32), "INSIDE", formatChar, colorYellow, IIf(idm, colorLightBlue, colorDefault));
AddColumn(IIf(m4, 48 + m4, 32), "NR4", formatChar, colorYellow, IIf(m4, colorBlue, colorDefault));
AddColumn(IIf(m7, 48 + m7, 32), "NR7", formatChar, colorYellow, IIf(m7, colorGreen, colorDefault));
}

/************************** END OF AFL CODE *****************************/

_SECTION_END();


Last edited by sumit; 03-10-2014 at 04:16 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 2 Users Say Thank You to sumit For This Useful Post:
  #812 (permalink)  
Old 03-10-2014, 04:16 PM
sumit sumit is offline
Regulars
 
Join Date: May 2013
Posts: 218
Thanks: 642
Thanked 376 Times in 186 Posts
sumit has a spectacular aura aboutsumit has a spectacular aura aboutsumit has a spectacular aura aboutsumit has a spectacular aura aboutsumit has a spectacular aura about
Default

the following is an AFL from asnavale sir for various candle patterns !

i request from asnavale sir and or other esteemed members of this forum that bullish and bearish engulfing candles be also included in this afl .

YOUR HELP WILL BE VERY MUCH APPRECIATED

best regards


Quote:
/************************************************** ****/
/* */
/* PATTERNS.AFL */
/* ============ */
/* (By A. S. Navale) */
/* */
/* This AFL marks different patterns on the chart. */
/* The Patterns to mark can be selected from the */
/* 'Parameters' Drop-down list which appears when */
/* right-click in the chart. By Fefault all patterns */
/* are marked. */
/* */
/* The Title of the chart displays the name of the */
/* pattern made by the candle which is selected. */
/* */
/* The patterns are: Inside Bar (IB), Doji, */
/* Double Doji, 3IB(Double Inside Bar), PopGun and */
/* Master Candle. */
/* */
/* You can also run Exploration to list the stocks */
/* which have the selected pattern. */
/* */
/************************************************** ****/


SetChartOptions(0, chartShowDates | chartWrapTitle);
SetChartBkColor(colorBlack);

DJ = CdDoji();
DblDJ = DJ AND Ref(DJ, -1);

OB = Outside();
IB = Inside();
IIB = IB AND Ref(IB, -1);

PopGun = OB AND Ref(IB, -1);

M = H < Ref(H, -4) AND Ref(H, -1) < Ref(H, -4) AND Ref(H, -2) < Ref(H, -4) AND Ref(H, -3) < Ref(H, -4) AND L > Ref(L, -4) AND Ref(L, -1) > Ref(L, -4) AND Ref(L, -2) > Ref(L, -4) AND Ref(L, -3) > Ref(L, -4);
MC = Null;

for(i = 4; i< BarCount; i++)
{
MC[i - 4] = M[i];
}

VMin = Param("Min Vol", 50000, 100, 1000000000, 100);

Fltr = ParamList("Filter on", "All,Doji,DoubleDoji,InsideBar,3IB,PopGun,MasterCa ndle");

IBTxt = WriteIf(IB, " Inside Bar", "");
IIBTxt = WriteIf(IIB, " 3IB", "");
DblDJTxt = WriteIf(DblDJ, " Double", "");
DJTxt = WriteIf(DJ, " Doji", "");
PGTxt = WriteIf(PopGun, " Pop Gun", "");
MCTxt = WriteIf(MC, " Master Candle", "");


if(Status("action") == actionIndicator)
{
_N(Title = StrFormat("{{NAME}}({{INTERVAL}}), {{DATE}} : {{OHLCX}}, V=%1.0f,", V) + IBTxt + IIBTxt + DblDJTxt + DJTxt + PGTxt + MCTxt);

Plot(C, "", colorLightGrey, styleCandle);
if(Fltr == "All")
{
PlotShapes(IIf(DJ, shapeSmallCircle, shapeNone), colorSkyblue, 0, L);
PlotShapes(IIf(DblDJ, shapeHollowCircle, shapeNone), colorSkyblue, 0, L);
PlotShapes(IIf(PopGun, shapeSmallSquare, shapeNone), colorYellow, 0, H, 12);
PlotShapes(IIf(IB, shapeHollowSmallCircle, shapeNone), colorGold, 0, H, 12);
PlotShapes(IIf(IIB, shapeDigit3, shapeNone), colorPink, 0, H, 12);
PlotShapes(IIf(MC, shapeCircle, shapeNone), colorYellow, 0, H, 12);
}
if(Fltr == "Doji")
{
PlotShapes(IIf(DJ, shapeSmallCircle, shapeNone), colorSkyblue, 0, L);
}
if (Fltr == "DoubleDoji")
{
PlotShapes(IIf(DblDJ, shapeHollowCircle, shapeNone), colorSkyblue, 0, L);
}
if(Fltr == "PopGun")
{
PlotShapes(IIf(PopGun, shapeSmallSquare, shapeNone), colorYellow, 0, H, 12);
}
if(Fltr == "InsideBar")
{
PlotShapes(IIf(IB, shapeHollowSmallCircle, shapeNone), colorGold, 0, H, 12);
}
if(Fltr == "3IB")
{
PlotShapes(IIf(IIB, shapeDigit3, shapeNone), colorPink, 0, H, 12);
}
if(Fltr == "MasterCandle")
{
PlotShapes(IIf(MC, shapeCircle, shapeNone), colorYellow, 0, H, 12);
}

}

if(Status("action") == actionExplore)
{
if(Fltr == "All") Filter = (V >= VMin) AND (DJ OR DblDJ OR IB OR IIB OR PopGun OR MC);
if(Fltr == "Doji") Filter = (V >= VMin) AND DJ;
if(Fltr == "DoubleDoji") Filter = (V >= VMin) AND DblDJ;
if(Fltr == "InsideBar") Filter = (V >= VMin) AND IB;
if(Fltr == "3IB") Filter = (V >= VMin) AND IIB;
if(Fltr == "PopGun") Filter = (V >= VMin) AND PopGun;
if(Fltr == "MasterCandle") Filter = (V >= VMin) AND MC;

SetOption("NoDefaultColumns", True);

AddTextColumn(Name(), "SYMBOL");
AddColumn(DateTime(), "DATE & TIME", formatDateTime);
AddColumn(C, "LAST CLOSE", 1.2);
AddColumn(V, "VOLUME", 1.0);
AddTextColumn(IBTxt, "Pattern");
AddTextColumn(IIBTxt, "Pattern");
AddTextColumn(DblDJTxt, "Pattern");
AddTextColumn(DJTxt, "Pattern");
AddTextColumn(PGTxt, "Pattern");
AddTextColumn(MCTxt, "Pattern");

}

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 2 Users Say Thank You to sumit For This Useful Post:
  #813 (permalink)  
Old 12-10-2014, 03:14 PM
sumit sumit is offline
Regulars
 
Join Date: May 2013
Posts: 218
Thanks: 642
Thanked 376 Times in 186 Posts
sumit has a spectacular aura aboutsumit has a spectacular aura aboutsumit has a spectacular aura aboutsumit has a spectacular aura aboutsumit has a spectacular aura about
Default

hello to all .

i am attaching an afl which plots bullish engulfing and bearish engulfing candles without cluttering the chart too much ! it plots on charts and i dont know whether it scans these patterns or not since for scanning i use keystock .

the code is very big and makes the charts cluttered so i have put // ( forward slashes ) this makes the chart look nice and clean

best regards


PHP Code:
_SECTION_BEGIN("CANDLE REWORKING combination of Meta TC TS");
O1 Ref(O,-1);O2 Ref(O,-2);O3 Ref(O,-3);O4 Ref(O,-4);
H1 Ref(H,-1);H2 Ref(H,-2);H3 Ref(H,-3);H4 Ref(H,-4);
C1 Ref(C,-1);C2 Ref(C,-2);C3 Ref(C,-3);C4 Ref(C,-4);
L1 Ref(L,-1);L2 Ref(L,-2);L3 Ref(L,-3);L4 Ref(L,-4);
GraphXSpace 5;
/*UP and Down Trend of last 4 days*/
dtrend = (L1 L2)AND (L2 L3) AND (L3 L4);
utrend = (H1 H2)AND (H2 H3) AND (H3 H4);
/*Maximum High Today - (MHT)
Today is the maximum High in the last 5 days*/
MHT=  HHV(H,5)==H;
/*Maximum High Yesterday - (MHY)
Yesterday is the maximum High in the last 5 days*/
MHY=   HHV(H,5)==Ref H, -1);
/*Minimum Low Today - (MLT)
Today is the minimum Low in the last 5 days*/
MLT=   LLV(L,5)==L;
/*Minimum Low Yesterday - (MLY)
Yesterday is the minimum Low in the last 5 days*/
MLY=   LLV(L,5)==Ref(L,-1);
/*Peircing Percent*/
PiercingPercent = ((C1)/C1) * 100;
LongBlackCandle = (O>AND (O-C)/(.001+H-L)>.6); 
LongWhiteCandle  = ((C>O) AND ((C-O)/(.001+H-L)>.6)); 
OpenGap = ((C1 O)/O) * 100;

CloseGap = ((C1)/C1) * 100;
///////************************************** Engulfings ********************************************//////////////
BullishEngulfing  = (LongWhiteCandle AND dtrend AND (O1>C1) AND (C>O) AND (C>= O1) AND (C1>= O) AND ((C-O)>(O1-C1))); 
_SECTION_BEGIN("");
BI BarIndex();
BV BeginValue(BarIndex());
EV EndValue(BarIndex());
SV SelectedValue(BarIndex());
BuWholeEngulf 0;                    
CurrentBar SelectedValueBarIndex() ); 
FirstBullBar CurrentBar 30;
Bar CurrentBar;
do
{
if ( 
SelectedValue(Close) >= ( Open[Bar-1]) AND SelectedValue(Close) >= ( Close[Bar-1]) AND SelectedValue(Open) <= ( Open[Bar-1]) AND SelectedValue(Open) <= ( Close[Bar-1]) )
        {
                
BuWholeEngulf BuWholeEngulf 1
                
Bar--;  
        }
  
}
while( 
BarFirstBullBar  AND   SelectedValue(Close) >= ( Open[Bar-1]) AND SelectedValue(Close) >= ( Close[Bar-1]) AND SelectedValue(Open) <= ( Open[Bar-1]) AND SelectedValue(Open) <= ( Close[Bar-1]));
_SECTION_END();

_SECTION_BEGIN("");

BearishEngulfing  = (MHT AND utrend  AND LongBlackCandle AND (C1>O1) AND (O>C) AND (O>= C1) AND (O1>= C) AND ((O-C)>(C1-O1)));
_SECTION_BEGIN("");
BI BarIndex();
BV BeginValue(BarIndex());
EV EndValue(BarIndex());
SV SelectedValue(BarIndex());
BeWholeEngulf 0;                    
CurrentBar SelectedValueBarIndex() ); 
FirstBearBar CurrentBar 30;
Bar CurrentBar;

do
{

if ( 
SelectedValue(Close) <= ( Open[Bar-1]) AND SelectedValue(Close) <= ( Close[Bar-1]) AND SelectedValue(Open) >= ( Open[Bar-1]) AND SelectedValue(Open) >= ( Close[Bar-1]) )
        {
                
                    
BeWholeEngulf BeWholeEngulf 1
                               
 
Bar--;
        }
      
}
while( 
BarFirstBearBar  AND   SelectedValue(Close) <= ( Open[Bar-1]) AND SelectedValue(Close) <= ( Close[Bar-1]) AND SelectedValue(Open) >= ( Open[Bar-1]) AND SelectedValue(Open) >= ( Close[Bar-1]));
                                 
_SECTION_END();

/***********************************************************************************
                                   LABELS  
***********************************************************************************/
 
//_SECTION_BEGIN("PRASAD SYSTEMS");
//Param("DEDICATED TO MY FATHER",5);
//_SECTION_END();

_SECTION_BEGIN("");
CANDLE_LABELS_TOGGLE ParamToggle("Labels","Off|On",1);
if(
CANDLE_LABELS_TOGGLE==1)
{

for( 
0BarCounta++ )
{
 

if (
BullishEngulfing[a]) (PlotText("  BuE",a,H[a]+2,colorPaleGreen));

if (
BearishEngulfing[a]) (PlotText("BeE",a,H[a]+2,colorRed));


}
}

CANDLE_ARROWS_TOGGLE ParamToggle("CANDLE ARROWS","Off|On",1);
if(
CANDLE_ARROWS_TOGGLE==1)
{

(
PlotShapes(BullishEngulfing shapeSmallUpTriangle,colorPaleGreen,0,H,10));


(
PlotShapes(BearishEngulfing shapeSmallDownTriangle,colorLightOrange,0,H,-20));


}
_SECTION_END();



BULL_ENG LastValue(Cum(BullishEngulfing)); 
printf("Bull Eng %g\n",BULL_ENG);
PlotText"*",BULL_ENG,H[BULL_ENG]+4colorYellow ); 

CURRENT_BULL_ENG Ref(BullishEngulfing,0);

PRI_CANDLE_BULLISH WriteIf(BullishEngulfing,"Bullish Engulfing","");

PRI_CANDLE_BEARISH =  WriteIf(BearishEngulfing,"Bearish Engulfing","");


/******************************************************************************************
                   CHART TITLES
***********************************************************************************************/




SetBarFillColorIIf(O>C,colorOrangecolorDarkGreen ) ); 
PlotC"Price"IIfO>C,colorRedcolorGreen ), styleCandle );

Plot(C,"Close",colorWhite,64);
Chg=Ref(C,-1);
Title EncodeColor(colorYellow)+  Title Name() + "    " EncodeColor(2) + Date() +EncodeColor(11) + EncodeColor(colorWhite) + "{{INTERVAL}}  " +
   
EncodeColor(55)+ "   Open:  "EncodeColor(colorWhite)+ WriteVal(O,format=1.2) + 
   
EncodeColor(55)+ "   High:  "EncodeColor(colorWhite) + WriteVal(H,format=1.2) +
   
EncodeColor(55)+ "   Low:  "EncodeColor(colorWhite)+ WriteVal(L,format=1.2) + 
   
EncodeColor(55)+ "   Close:  "WriteIf(CChg,EncodeColor(colorBrightGreen),EncodeColor(colorRed))+ WriteVal(C,format=1.2)+  
   
EncodeColor(55)+ "   Change:  "WriteIf(CChg,EncodeColor(colorBrightGreen),EncodeColor(colorRed))+ WriteVal(ROC(C,1),format=1.2)+ "%"+
   
EncodeColor(55)+ "   Volume: "EncodeColor(colorWhite)+ WriteVal(V,1)



+
"\n"+"\n"

+"\n"+EncodeColor(colorWhite)+"> Candle           : "+EncodeColor(colorBrightGreen)+PRI_CANDLE_BULLISH 

EncodeColor(colorRed)+PRI_CANDLE_BEARISH EncodeColor(colorRed)+"."+


"\n"+/***********************************************************************************************
Standards of Cover (Moderate and low Reliability)
/****************************************************************************************************/
EncodeColor(colorOrange)+
WriteIf(BullishEngulfing,"> Prior Trend    " EncodeColor(colorWhite) + ": Bearish.\n"+
EncodeColor(colorOrange)+"> Type                " EncodeColor(colorWhite) + ": Reversal.\n"+
EncodeColor(colorOrange)+"> Confirmation " EncodeColor(colorWhite) + ": Required.\n"+"\n"+
EncodeColor(colorLightBlue)+"> IMPORTANT FACTORS   " EncodeColor(colorWhite) + "\n"+
EncodeColor(colorYellow)+"1) Disparity of white vs black body is indicative of the\n     emerging bull power.\n" +
"2) Higher probability of reversal if there is heavy\n     volume on the day of second real body.\n" +
"3) Higher probability of reversal if the second day\n     body engulfs more than one real body. \n" +
"4) Greater the open gaps down from previous close\n     greater the probability of strong reversal. \n" +
"5) If engulfing body engulfs body and shadow of the\n     previous day may be probability of strong reversal. \n \n" +

EncodeColor(colorPink)+" > CONFIRMATION :\n Third Day Confirmation needed in form of a \na)  white candle ,\nb)  large gap up or \nc)  higher close.\n\n" +
EncodeColor(colorRed)+" > CURRENT CANDLE\n"+
EncodeColor(colorAqua)+" *  The gap down opening of the current candle is\n     "+Prec(OpenGap,1)+" % from previous Day.\n" +
"*  The current white body is engulfing the\n    preceeding "+BuWholeEngulf+" bodies","")+




EncodeColor(colorOrange)+
WriteIf(BearishEngulfing,"> Prior Trend    " EncodeColor(colorWhite) + ": Bullish.\n"+
EncodeColor(colorOrange)+"> Type                " EncodeColor(colorWhite) + ": Reversal.\n"+
EncodeColor(colorOrange)+"> Confirmation " EncodeColor(colorWhite) + ": Required.\n"+"\n"+
EncodeColor(colorLightBlue)+"> IMPORTANT FACTORS   " EncodeColor(colorWhite) + "\n"+
EncodeColor(colorYellow)+"1) Disparity of black vs white body is indicative of the\n     emerging bear power.\n" +
"2) Higher probability of reversal if there is heavy\n     volume on the day of second real body.\n" +
"3) Higher probability of reversal if the second day\n     body engulfs more than one real body. \n" +
"4) Greater the open gaps up from previous close\n     greater the probability of strong reversal. \n" +
"5) If engulfing body engulfs body and shadow of the\n     previous day may be probability of strong reversal. \n \n" +

EncodeColor(colorPink)+" > CONFIRMATION :\n Third Day Confirmation needed in form of a \na)  black candle ,\nb)  large gap down or \nc)  lower close.\n\n" +
EncodeColor(colorRed)+" > CURRENT CANDLE\n"+
EncodeColor(colorAqua)+" *  The gap up opening of the current candle is\n     "+Prec(CloseGap,1)+" % from previous Day.\n" +
"*  The current black body is engulfing the\n    preceeding "+BeWholeEngulf+" bodies","") ;

_SECTION_BEGIN("CANDLE REWORKING combination of Meta TC TS");
O1 Ref(O,-1);O2 Ref(O,-2);O3 Ref(O,-3);O4 Ref(O,-4);
H1 Ref(H,-1);H2 Ref(H,-2);H3 Ref(H,-3);H4 Ref(H,-4);
C1 Ref(C,-1);C2 Ref(C,-2);C3 Ref(C,-3);C4 Ref(C,-4);
L1 Ref(L,-1);L2 Ref(L,-2);L3 Ref(L,-3);L4 Ref(L,-4);

GraphXSpace 5;

/*UP and Down Trend of last 4 days*/

dtrend = (L1 L2)AND (L2 L3) AND (L3 L4);
utrend = (H1 H2)AND (H2 H3) AND (H3 H4);

/*Maximum High Today - (MHT)
Today is the maximum High in the last 5 days*/
MHT=  HHV(H,5)==H;

/*Maximum High Yesterday - (MHY)
Yesterday is the maximum High in the last 5 days*/
MHY=   HHV(H,5)==Ref H, -1);

/*Minimum Low Today - (MLT)
Today is the minimum Low in the last 5 days*/
MLT=   LLV(L,5)==L;

/*Minimum Low Yesterday - (MLY)
Yesterday is the minimum Low in the last 5 days*/
MLY=   LLV(L,5)==Ref(L,-1);

/*Peircing Percent*/

PiercingPercent = ((C1)/C1) * 100;











LongBlackCandle = (O>AND (O-C)/(.001+H-L)>.6); 

 

 

LongWhiteCandle  = ((C>O) AND ((C-O)/(.001+H-L)>.6)); 




OpenGap = ((C1 O)/O) * 100;

CloseGap = ((C1)/C1) * 100;





///////************************************** Engulfings ********************************************//////////////
BullishEngulfing  = (LongWhiteCandle AND dtrend AND (O1>C1) AND (C>O) AND (C>= O1) AND (C1>= O) AND ((C-O)>(O1-C1))); 




_SECTION_BEGIN("");
BI BarIndex();
BV BeginValue(BarIndex());
EV EndValue(BarIndex());
SV SelectedValue(BarIndex());

BuWholeEngulf 0;                    
CurrentBar SelectedValueBarIndex() ); 
FirstBullBar CurrentBar 30;
Bar CurrentBar;

do
{
if ( 
SelectedValue(Close) >= ( Open[Bar-1]) AND SelectedValue(Close) >= ( Close[Bar-1]) AND SelectedValue(Open) <= ( Open[Bar-1]) AND SelectedValue(Open) <= ( Close[Bar-1]) )
        {
                
BuWholeEngulf BuWholeEngulf 1
                
Bar--;  
        }
      
}
while( 
BarFirstBullBar  AND   SelectedValue(Close) >= ( Open[Bar-1]) AND SelectedValue(Close) >= ( Close[Bar-1]) AND SelectedValue(Open) <= ( Open[Bar-1]) AND SelectedValue(Open) <= ( Close[Bar-1]));
_SECTION_END();


_SECTION_BEGIN("");

 




        

BearishEngulfing  = (MHT AND utrend  AND LongBlackCandle AND (C1>O1) AND (O>C) AND (O>= C1) AND (O1>= C) AND ((O-C)>(C1-O1)));



_SECTION_BEGIN("");
BI BarIndex();
BV BeginValue(BarIndex());
EV EndValue(BarIndex());
SV SelectedValue(BarIndex());

BeWholeEngulf 0;                    
CurrentBar SelectedValueBarIndex() ); 
FirstBearBar CurrentBar 30;
Bar CurrentBar;

do
{

if ( 
SelectedValue(Close) <= ( Open[Bar-1]) AND SelectedValue(Close) <= ( Close[Bar-1]) AND SelectedValue(Open) >= ( Open[Bar-1]) AND SelectedValue(Open) >= ( Close[Bar-1]) )
        {
                
                    
BeWholeEngulf BeWholeEngulf 1
                               
 
Bar--;
        }
      
}
while( 
BarFirstBearBar  AND   SelectedValue(Close) <= ( Open[Bar-1]) AND SelectedValue(Close) <= ( Close[Bar-1]) AND SelectedValue(Open) >= ( Open[Bar-1]) AND SelectedValue(Open) >= ( Close[Bar-1]));
                                 
_SECTION_END();


/***********************************************************************************
                                   LABELS  
***********************************************************************************/
 
//_SECTION_BEGIN("PRASAD SYSTEMS");
//Param("DEDICATED TO MY FATHER",5);
//_SECTION_END();

_SECTION_BEGIN("");
CANDLE_LABELS_TOGGLE ParamToggle("Labels","Off|On",1);
if(
CANDLE_LABELS_TOGGLE==1)
{

for( 
0BarCounta++ )
{
 

if (
BullishEngulfing[a]) (PlotText("  BuE",a,H[a]+2,colorPaleGreen));

if (
BearishEngulfing[a]) (PlotText("BeE",a,H[a]+2,colorRed));


}
}

CANDLE_ARROWS_TOGGLE ParamToggle("CANDLE ARROWS","Off|On",1);
if(
CANDLE_ARROWS_TOGGLE==1)
{

(
PlotShapes(BullishEngulfing shapeSmallUpTriangle,colorPaleGreen,0,H,10));


(
PlotShapes(BearishEngulfing shapeSmallDownTriangle,colorLightOrange,0,H,-20));


}
_SECTION_END();

BULL_ENG LastValue(Cum(BullishEngulfing)); 
printf("Bull Eng %g\n",BULL_ENG);
PlotText"*",BULL_ENG,H[BULL_ENG]+4colorYellow ); 

CURRENT_BULL_ENG Ref(BullishEngulfing,0);

PRI_CANDLE_BULLISH WriteIf(BullishEngulfing,"Bullish Engulfing","");

PRI_CANDLE_BEARISH =  WriteIf(BearishEngulfing,"Bearish Engulfing","");


/******************************************************************************************
                   CHART TITLES
***********************************************************************************************/


= (GetPerformanceCounter()/100)%256
printf("GetPerformance Counter %g",k);


GfxSelectFont("Arial Narrow"10700 ); 
GfxSetBkMode(1); 
GfxSetTextColor(colorYellow); 
//GfxTextOut("Dedicated to the loving memory of MY FATHER on his 75th Birth  Anniversay - LATE BALKRISHNA RAMCHANDRA RAO 13.10.1935",100+k ,12); 
GfxSelectFont("Century Goliath",12,500); 
GfxSetBkMode(1); 
GfxSetTextColor(colorLime); 
//GfxTextOut("Prasad Inspirations",80 ,25); 
RequestTimedRefresh(1); 
_SECTION_END();

SetBarFillColorIIf(O>C,colorOrangecolorDarkGreen ) ); 
PlotC"Price"IIfO>C,colorRedcolorGreen ), styleCandle );

Plot(C,"Close",colorWhite,64);
Chg=Ref(C,-1);
Title EncodeColor(colorYellow)+  Title Name() + "    " EncodeColor(2) + Date() +EncodeColor(11) + EncodeColor(colorWhite) + "{{INTERVAL}}  " +
   
//EncodeColor(55)+ "   Open:  "+ EncodeColor(colorWhite)+ WriteVal(O,format=1.2) + 
   //EncodeColor(55)+ "   High:  "+ EncodeColor(colorWhite) + WriteVal(H,format=1.2) +
   //EncodeColor(55)+ "   Low:  "+ EncodeColor(colorWhite)+ WriteVal(L,format=1.2) + 
   //EncodeColor(55)+ "   Close:  "+ WriteIf(C> Chg,EncodeColor(colorBrightGreen),EncodeColor(colorRed))+ WriteVal(C,format=1.2)+  
   //EncodeColor(55)+ "   Change:  "+ WriteIf(C> Chg,EncodeColor(colorBrightGreen),EncodeColor(colorRed))+ WriteVal(ROC(C,1),format=1.2)+ "%"+
   
EncodeColor(55)+ "   Volume: "EncodeColor(colorWhite)+ WriteVal(V,1)



+
"\n"+"\n"

+"\n"+EncodeColor(colorWhite)+"> Candle           : "+EncodeColor(colorBrightGreen)+PRI_CANDLE_BULLISH 

EncodeColor(colorRed)+PRI_CANDLE_BEARISH EncodeColor(colorRed)+"."+


"\n"+/***********************************************************************************************
Standards of Cover (Moderate and low Reliability)
/****************************************************************************************************/
EncodeColor(colorOrange)+
WriteIf(BullishEngulfing,"> Prior Trend    " EncodeColor(colorWhite) + ": Bearish.\n"+
//EncodeColor(colorOrange)+"> Type                " + EncodeColor(colorWhite) + ": Reversal.\n"+
//EncodeColor(colorOrange)+"> Confirmation " + EncodeColor(colorWhite) + ": Required.\n"+"\n"+
//EncodeColor(colorLightBlue)+"> IMPORTANT FACTORS   " + EncodeColor(colorWhite) + "\n"+
//EncodeColor(colorYellow)+"1) Disparity of white vs black body is indicative of the\n     emerging bull power.\n" +
//"2) Higher probability of reversal if there is heavy\n     volume on the day of second real body.\n" +
//"3) Higher probability of reversal if the second day\n     body engulfs more than one real body. \n" +
//"4) Greater the open gaps down from previous close\n     greater the probability of strong reversal. \n" +
//"5) If engulfing body engulfs body and shadow of the\n     previous day may be probability of strong reversal. \n \n" +

//EncodeColor(colorPink)+" > CONFIRMATION :\n Third Day Confirmation needed in form of a \na)  white candle ,\nb)  large gap up or \nc)  higher close.\n\n" +
//EncodeColor(colorRed)+" > CURRENT CANDLE\n"+
//EncodeColor(colorAqua)+" *  The gap down opening of the current candle is\n     "+Prec(OpenGap,1)+" % from previous Day.\n" +
"*  The current white body is engulfing the\n    preceeding "+BuWholeEngulf+" bodies","")+




//EncodeColor(colorOrange)+
WriteIf(BearishEngulfing,"> Prior Trend    " EncodeColor(colorWhite) + ": Bullish.\n"+
//EncodeColor(colorOrange)+"> Type                " + EncodeColor(colorWhite) + ": Reversal.\n"+
//EncodeColor(colorOrange)+"> Confirmation " + EncodeColor(colorWhite) + ": Required.\n"+"\n"+
//EncodeColor(colorLightBlue)+"> IMPORTANT FACTORS   " + EncodeColor(colorWhite) + "\n"+
//EncodeColor(colorYellow)+"1) Disparity of black vs white body is indicative of the\n     emerging bear power.\n" +
//"2) Higher probability of reversal if there is heavy\n     volume on the day of second real body.\n" +
//"3) Higher probability of reversal if the second day\n     body engulfs more than one real body. \n" +
//"4) Greater the open gaps up from previous close\n     greater the probability of strong reversal. \n" +
//"5) If engulfing body engulfs body and shadow of the\n     previous day may be probability of strong reversal. \n \n" +

//EncodeColor(colorPink)+" > CONFIRMATION :\n Third Day Confirmation needed in form of a \na)  black candle ,\nb)  large gap down or \nc)  lower close.\n\n" +
//EncodeColor(colorRed)+" > CURRENT CANDLE\n"+
//EncodeColor(colorAqua)+" *  The gap up opening of the current candle is\n     "+Prec(CloseGap,1)+" % from previous Day.\n" +
"*  The current black body is engulfing the\n    preceeding "+BeWholeEngulf+" bodies","") ; 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 4 Users Say Thank You to sumit For This Useful Post:
  #814 (permalink)  
Old 23-10-2014, 12:13 PM
sairam1 sairam1 is offline
Newbie
 
Join Date: Mar 2013
Posts: 3
Thanks: 0
Thanked 4 Times in 2 Posts
sairam1 is on a distinguished road
Default

hai to all

this is my first post

i want amibroker afl.

which scans and shows

1.stocks which crossed previous week high/low
2.stocks which crossed this week high/low
3.stocks which crossed previous month high/low
4.stocks which crossed this month high/low

thanks in advance
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 2 Users Say Thank You to sairam1 For This Useful Post:
  #815 (permalink)  
Old 23-10-2014, 12:15 PM
sairam1 sairam1 is offline
Newbie
 
Join Date: Mar 2013
Posts: 3
Thanks: 0
Thanked 4 Times in 2 Posts
sairam1 is on a distinguished road
Default

i forget to mention

all the above said conditions should scan during intraday not for eod
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 2 Users Say Thank You to sairam1 For This Useful Post:
  #816 (permalink)  
Old 25-10-2014, 10:26 PM
nTP's Avatar
nTP nTP is offline
Flash Crash
 
Join Date: Dec 2013
Location: kolkata
Posts: 2,087
Thanks: 7,915
Thanked 2,314 Times in 1,381 Posts
nTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud of
Default

Hi

i had a cheapest indicator found in the forum somewhere (IDK)
http://qusma.com/2012/11/06/closing-...ean-reversion/

Code:
_SECTION_BEGIN("CRTDR");
CRTDR=(C-L)/(H-L);
CRTDRpct=CRTDR*100;
PlotOHLC(0,CRTDR,0,CRTDRpct,"CRTDR",IIf(CRTDRpct<45,colorLime,IIf(CRTDRpct>95,colorRed,colorYellow)) , ParamStyle("Histogram style", styleHistogram|styleThick | styleNoLabel, maskHistogram ) ) ;
//PlotOHLC(RSI(3),0,CRTDRpct,0,"CRTDR-RSI",IIf(CRTDRpct<45&&RSI(3)<10,colorBlue,IIf(CRTDRpct>95&&RSI(3)>50,colorGold,colorWhite)) , ParamStyle("Histogram style", styleHistogram|styleThick | styleNoLabel, maskHistogram ) ) ;
//PlotOHLC(0,CRTDRpct,0,CRTDR,"CRTDR",IIf(CRTDRpct>95,colorLime,0) , ParamStyle("Histogram style", styleHistogram|styleThick | styleNoLabel, maskHistogram ) ) ;

_SECTION_END();
Try it on weekly/Daily .Or It might be used with IB families (it can be used to filter anything as mentioned in the paper )
__________________
thx
nTuple

Disclaimer: I am not a Research Analyst and not registered with any regulating authority. All posts are for educational purpose only.

Consider us a dumb -dumble guy in this analysis, any type of real time example will be quick-learn approach.

Last edited by nTP; 26-10-2014 at 12:18 AM. Reason: CRTDR
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #817 (permalink)  
Old 29-10-2014, 06:19 PM
nTP's Avatar
nTP nTP is offline
Flash Crash
 
Join Date: Dec 2013
Location: kolkata
Posts: 2,087
Thanks: 7,915
Thanked 2,314 Times in 1,381 Posts
nTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud of
Default elder dot com

Originally Posted by sairam1 View Post
hai to all

this is my first post

i want amibroker afl.

which scans and shows

1.stocks which crossed previous week high/low
2.stocks which crossed this week high/low
3.stocks which crossed previous month high/low
4.stocks which crossed this month high/low

thanks in advance

Hi

R you searching this one ?
Attached Files
File Type: pdf 2014_08_215A.pdf (651.3 KB, 54 views)
__________________
thx
nTuple

Disclaimer: I am not a Research Analyst and not registered with any regulating authority. All posts are for educational purpose only.

Consider us a dumb -dumble guy in this analysis, any type of real time example will be quick-learn approach.

Last edited by nTP; 29-10-2014 at 06:23 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #818 (permalink)  
Old 29-10-2014, 07:36 PM
ashis_ch ashis_ch is offline
Market Lizard
 
Join Date: Oct 2010
Posts: 272
Thanks: 585
Thanked 600 Times in 222 Posts
ashis_ch is a jewel in the roughashis_ch is a jewel in the roughashis_ch is a jewel in the roughashis_ch is a jewel in the roughashis_ch is a jewel in the roughashis_ch is a jewel in the roughashis_ch is a jewel in the rough
Default

Originally Posted by sumitalwar View Post
hello to all . the following is an afl from asnavale sir for nr4 and nr7 .

i request following modifications


a) instead of nr4 in the above afl i need nr21 . so can any one insert the param option to select according to one's choice of narrow range. so it may be nr4 ,nr7 or nr21 or whatever may be the trader's choice

b) Also can an option be also introduced in parameters to plot on chart what one wants to see eg nr7 only or nr7 +id (inside day.bar) similarly nr 21 only or nr21+id only .

my whole purpose is to make charts look uncluttered !

best regards

I wrote an afl of the same , please try this and let me know..

================================================== =

SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkGradientFill( ParamColor("BgTop", colorBlack),ParamColor("BgBottom", colorBlack));
SetChartBkColor(ParamColor("bkcolor",ColorRGB(0,0, 0)));
SetBarFillColor(IIf(C>O,ParamColor("Candle UP Color", colorDarkGreen),IIf(C<=O,ParamColor("Candle Down Color", colorDarkRed),colorLightGrey)));
Plot(Close,"Price",ParamColor("Candle Color",colorWhite), styleCandle|styleNoTitle);
/////////////////////////////////////////////////////////////////////////////////////////

x=Param("NR Period",7,1,100,1);
nr=H-L;
nrx=LLV(nr,x);

PlotShapes(IIf(nr==nrx,shapeUpArrow,shapeNone),col orBrightGreen,0,Low,-16);

/////////////////////////////////////////////////////////////////////////////////////

Filter=nr==nrx;

Last edited by ashis_ch; 29-10-2014 at 09:48 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 4 Users Say Thank You to ashis_ch For This Useful Post:
  #819 (permalink)  
Old 01-11-2014, 01:17 PM
sumit sumit is offline
Regulars
 
Join Date: May 2013
Posts: 218
Thanks: 642
Thanked 376 Times in 186 Posts
sumit has a spectacular aura aboutsumit has a spectacular aura aboutsumit has a spectacular aura aboutsumit has a spectacular aura aboutsumit has a spectacular aura about
Default

hello i am attaching one code plotting yesterday's high and yesterday's low

PHP Code:
//D1=yesterday

_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}"OHLCSelectedValueROCC) ) ));
PlotC"Close"ParamColor("Color"colorBlack ), styleNoTitle ParamStyle("Style") | GetPriceStyle() ); 
Plot(O"Open"colorBlackstyleHidden);
nday IIf(Day()!=Ref(Day(),-1),1,0);  
Plot(nday,"",3,styleHistogram|styleDashed|styleNoLabel|styleOwnScale,0,1);
_SECTION_END();

ShowD1OHLCParamToggle("ShowD1OHLC""No|Yes"1);

numbarsLastValue(Cum(Status("barvisible")));
hts= -33.5;

dtDateTime() ;
dtnumDateTimeConvert(0dt) ;
isNewDtdtnum != Ref(dtnum, -1) ;
isLastbarH-;
isLastbardtnum != Ref(dtnum1) ;


_SECTION_BEGIN("Last days H/L");
D1HColorParamColor("D1HColor"colorWhite);
D1LColorParamColor("D1LColor"colorWhite);

D1HStyleParamStyle("D1HStyle"styleDashed|styleNoLabel|styleNoRescale);
D1LStyleParamStyle("D1LStyle"styleDashed|styleNoLabel|styleNoRescale);

if(
ShowD1OHLC)
{
D1HTimeFrameGetPrice("H"inDaily, -1);
D1LTimeFrameGetPrice("L"inDaily, -1);

Plot(IIf(isLastbar,Null,D1H), "D1H"D1HColorD1HStyle);
Plot(IIf(isLastbar,Null,D1L), "D1L"D1LColorD1LStyle);

PlotText("D1H "LastValue(BarIndex())-(numbars/Hts), LastValue(D1H,1), D1HColor);
PlotText("D1L "LastValue(BarIndex())-(numbars/Hts), LastValue(D1L,1), D1LColor);
}

_SECTION_END(); 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 2 Users Say Thank You to sumit For This Useful Post:
  #820 (permalink)  
Old 01-11-2014, 01:18 PM
sumit sumit is offline
Regulars
 
Join Date: May 2013
Posts: 218
Thanks: 642
Thanked 376 Times in 186 Posts
sumit has a spectacular aura aboutsumit has a spectacular aura aboutsumit has a spectacular aura aboutsumit has a spectacular aura aboutsumit has a spectacular aura about
Default

i am attaching an afl which plots previous week's high low


HTML Code:
_SECTION_BEGIN("HighLow");
w1H = TimeFrameGetPrice("H", inWeekly, -1);
w1L = TimeFrameGetPrice("L", inWeekly, -1);
Today = LastValue(Day());
W1HL = ParamToggle("Last week High Low","Show|Hide",1);
if(W1HL==1) {
	Plot(IIf(Today == Day(),w1L,Null),"WL",colorRed,styleLine|styleNoRescale|styleNoTitle);
	Plot(IIf(Today==Day(),w1H,Null),"WH",colorBlue,styleLine|styleNoRescale|styleNoTitle);
}
_SECTION_END();
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following User Says Thank You to sumit For This Useful Post:
Reply

indiTraders - Forum for the Active Indian Trader > Tools > Software > Amibroker


Tags
afl, amibroker nifty

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


DPonline

All times are GMT +5.5. The time now is 01:54 AM.


vBulletin Copyright by vBulletin

Content Relevant URLs by vBSEO 3.3.2