My afl collection

Status
Not open for further replies.

ocil

Well-Known Member
Hi Ocil,

Would you share your AFL or tell us what indicators? It's very clean, thanks
Hi lerxts find below is the code:-

_SECTION_BEGIN("Background_Setting");
SetChartBkGradientFill( ParamColor("BgTop", colorBlack),

ParamColor("BgBottom", colorBlack),ParamColor("titleblock",colorDarkGrey ));
_SECTION_END();


_SECTION_BEGIN("Flower");
Show_color = ParamToggle("Display CandleColor", "No|Yes", 1);
r1 = Param( "ColorFast avg", 5, 2, 200, 1 );
r2 = Param( "ColorSlow avg", 10, 2, 200, 1 );
r3 = Param( "ColorSignal avg", 5, 2, 200, 1 );

Prd1=Param("ATR Period",4,1,20,1);
Prd2=Param("Look Back",7,1,20,1);
green = HHV(LLV(L,Prd1)+ATR(Prd1),Prd2);
red = LLV(HHV(H,Prd1)-ATR(Prd1),Prd2);
flowerClose = EMA((Open+High+Low+Close)/4,3) ;
flowerOpen = EMA((Ref(Open,-1) + Ref(flowerClose,-1))/2,3);
Temp = Max(High, flowerOpen);
flowerHigh = EMA(Max(Temp, flowerClose),3);
Temp = Min(Low,flowerOpen);
flowerLow = EMA(Min(Temp, flowerClose),3);



m1=MACD(r1,r2);
s1=Signal(r1,r2,r3);
mycolor=IIf(m1<0 AND m1>s1, colorYellow,IIf(m1>0 AND m1>s1,colorGreen,IIf(m1>0 AND m1<s1,colorCustom12,colorRed)));
if(Show_color)
{
ColorHighliter = myColor;
SetBarFillColor( ColorHighliter );


}

barColor=IIf(C>Green ,colorBrightGreen,IIf(C < RED,colorRed,colorWhite));


PlotOHLC( IIf(flowerOpen<flowerClose, flowerOpen, flowerClose),flowerHigh,flowerLow,IIf(flowerOpen<flowerClose, flowerClose, flowerOpen), "Close", barColor, styleNoTitle | styleCandle);



_SECTION_END();


//**********************************************************************************
// Plot price horizontal line *
//**********************************************************************************/
_SECTION_BEGIN("Price Line");

PriceLineColor=ParamColor("PriceLineColor",ColorRGB(82,82,82));
PriceLevel = ParamField("PriceField", field = 3 );

Daysback = Param("Bars Back",100,10,500,1);
FirstBar = BarCount - DaysBack;
YY = IIf(BarIndex() >= Firstbar,EndValue(PriceLevel),Null);

Plot(YY,"Current Price",PriceLineColor,ParamStyle("LineStyle",styleLine|styleDashed|styleNoTitle|styleNoLabel|styleThick,maskAll));


side = Param("side",1,0,1000,1);

dist = 0;

for( i = 0; i < BarCount; i++ )
{
if(i+side== BarCount) PlotText( "\n " + PriceLevel[ i ], i, YY[ i ]-dist, colorAqua );
}


_SECTION_END();

_SECTION_BEGIN("Breakout Setting");
Buyperiods=Param("Breakout periods best is usually 18",5,1,100,1,1);
Sellperiods=Param("Exit Breakout",5,1,100,1,1);

HaClose =EMA((O+H+L+C)/4,3); // Woodie
//HaClose =(O+H+L+C)/4;
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
HaHigh = Max( H, Max( HaClose, HaOpen ) );
HaLow = Min( L, Min( HaClose, HaOpen ) );
Buy= Cover= C>Ref(HHV(High,Buyperiods),-1);
Sell= Short= C<Ref(LLV(Low,Sellperiods),-1);

/* exrem is one method to remove surplus strade signals. It removes excessive signals of arrow */
Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);

PlotShapes( IIf( Buy, shapeUpArrow, shapeNone ), colorWhite, layer = 0,yposition = HaLow, offset = -40);
//PlotShapes( IIf( Buy, shapeSmallCircle, shapeNone ), colorWhite, layer = 0,yposition = HaLow, offset = -8);

PlotShapes( IIf( Sell, shapeDownArrow, shapeNone ), colorRed, layer = 0, yposition = HaHigh, offset = -20);
//PlotShapes( IIf( Sell, shapeSmallCircle, shapeNone ), colorRed, layer = 0, yposition = HaHigh, offset = 8);
SellPrice = ValueWhen( Sell, C, 1 );

BuyPrice = ValueWhen( Buy, C, 1 );

Long = Flip( Buy, Sell );

Shrt = Flip( Sell, Buy );
dist = 1.5*ATR(20);
for( i = 0; i < BarCount; i++ )
{
if( Buy ) PlotText( "" + C[ i ], i, L[ i ]-dist, colorGreen);
if( Sell ) PlotText( "" + C[ i ], i, H[ i ]+dist, colorRed );
}
//// _SECTION_END();

_SECTION_END();

_SECTION_BEGIN("Pivot Box");
Hi=Param("High_Period",7,1,50,1);
Lo=Param("Low_Period",7,1,50,1);
A1=ExRemSpan(Ref(High,-2)==HHV(High,Hi),3);
A2=ExRemSpan(Ref(Low,-2)==LLV(Low,Lo),3);
A3=Cross(A1,0.9);
A4=Cross(A2,0.9);
TOP=Ref(HaHigh,-BarsSince(A3));


breakoutLine=Param("BrOutLineLength",10,2,30,0.1);
upDaysback1 = breakoutLine;
upFirstBar1 = BarCount - upDaysBack1;
upst2=TOP;

upYYY2=IIf(BarIndex() >= upFirstbar1,EndValue(upSt2),Null);

Plot(upYYY2,"",ParamColor("BreakoutColor", colorOrange) ,ParamStyle("BreakoutLine",styleLine|styleThick|styleStaircase,maskAll));
//Plot(top,"",11,styleDots+styleLine+styleThick);


bot=Ref(HaLow,-BarsSince(A4));
breakDownLine=Param("BrDownLineLength",10,2,30,0.1 );
dnDaysback1 = breakDownLine;
dnFirstBar1 = BarCount - dnDaysBack1;
dnst2=BOT;

dnYYY2=IIf(BarIndex() >= dnFirstbar1,EndValue(dnSt2),Null);


Plot(dnYYY2,"",ParamColor("BreakDownColor", colorBrightGreen) ,ParamStyle("BreakdownLine",styleLine|styleThick|styleStaircase,maskAll));
//Plot(bot,"",6,styleDots+styleLine);
_SECTION_END();

_SECTION_BEGIN("Color_Me_Bad");
a =5; //Param("Average Pds", 5, 1, 10, 1 );
n =8; //Param("Short Pds", 8, 5, 21, 1 );
m =60; //Param("Long Pds", 60, 0, 90, 1 );

Var4 =(Low+High+2*Close)/4;
OP = EMA(Var4,a);
res1 = HHV(OP,n);

res2 =HHV(OP,m);
sup2 =LLV(OP,m);
sup1 =LLV(OP,n);


Linecolor1 = IIf(Op==sup1,ColorRGB(48,0,81),IIf(Op==res1,colorGreen,ColorRGB(80,80,80)));
Linecolor2 = IIf(Op==sup1,ColorRGB(38,0,60),IIf(Op==res1,colorGreen,colorDarkGrey));
Linecolor3 = IIf(Op==sup1,ColorRGB(27,0,70),IIf(Op==res1,colorGreen,ColorRGB(77,70,75)));
_SECTION_END();

/*_SECTION_BEGIN("ATR");
ParmCloud1 = ParamToggle("TrailingCloud", "No|Yes", 1);
Pp1=Param("Ray_Period1",2,1,20,1); // or 4
Pp2=Param("ATR_Period1",3,1,20,1); // or 2

avgClose = EMA((Open+High+Low+Close)/4,3) ;
avgOpen = EMA((Ref(Open,-1) + Ref(avgClose,-1))/2,3);
Temp = Max(High, avgOpen);
avgHigh = EMA(Max(Temp, avgClose),3);
Temp = Min(Low,avgOpen);
avgLow = EMA(Min(Temp, avgClose),3);
Plot(HHV(LLV(avgHigh,Pp1)-ATR(Pp2),4),"",Linecolor1 ,ParamStyle("styleLine 1",styleLine|styleThick|styleNoTitle|styleNoLabel,maskAll));
Plot(HHV(LLV(avgHigh,Pp1)-ATR(Pp2),5),"",Linecolor2 ,ParamStyle("styleLine 2",styleLine|styleThick|styleNoTitle|styleNoLabel,maskAll));
Plot(HHV(LLV(avgHigh,Pp1)-ATR(Pp2),6),"",Linecolor1 ,ParamStyle("styleLine 3",styleLine|styleThick|styleNoTitle|styleNoLabel,maskAll));
Plot(HHV(LLV(avgHigh,Pp1)-ATR(Pp2),7),"",Linecolor1 ,ParamStyle("styleLine 4",styleLine|styleThick|styleNoTitle|styleNoLabel,maskAll));




CS33=HHV(LLV(avgHigh,Pp1)-ATR(Pp2),4);
CR33=HHV(LLV(avgHigh,Pp1)-ATR(Pp2),5);
CT33=HHV(LLV(avgHigh,Pp1)-ATR(Pp2),6);
CM33=HHV(LLV(avgHigh,Pp1)-ATR(Pp2),7);

if(parmCloud1 == 1)
{
PlotOHLC( CS33, CS33, CR33,CR33, "Band1", LineColor1, styleCloud | styleNoLabel|styleNoTitle);
PlotOHLC( CR33, CR33, CT33, CT33, "Band2", LineColor2, styleCloud | styleNoLabel|styleNoTitle);
PlotOHLC( CR33, CR33, CM33, CM33, "Band3", LineColor3, styleCloud | styleNoLabel|styleNoTitle);

}


_SECTION_END();*/

_SECTION_BEGIN("Bands");

SupResB =Param("Sup-Res Short",6,0,100,1);
nn=SupResB;



Bandlinecol=ParamColor("SupResLineColor",ColorRGB(82,82,82));
ParmCloud = ParamToggle("Cloud", "No|Yes", 0);
BoxCloudColor=ParamColor("BoxCloudColor",ColorRGB(27,27,27));


Line2=Param("ResLineLength",100,2,500,0.1);
Daysback1 = Line2;
FirstBar1 = BarCount - DaysBack1;
Hh=HHV(flowerHigh,nn);
LL=LLV(flowerLow,nn);

Res2=Hh;
Sup2=LL;

BandRes=IIf(BarIndex() >= Firstbar1,EndValue(Res2),Null);
BandSup=IIf(BarIndex() >= Firstbar1,EndValue(Sup2),Null);
//Plot(BandRes,"",Bandlinecol,ParamStyle("ShortSupBand",styleLine|styleDashed|stylehidden|styleNoTitle|styleNoLabel|styleThick,maskAll));
//Plot(BandSup,"",Bandlinecol,ParamStyle("ShortResBand",styleLine|styleDashed|stylehidden|styleNoTitle|styleNoLabel|styleThick,maskAll));




CS=BandRes;
CR=BandSup;


/*if(parmCloud == 1)
{
PlotOHLC( CS, CS, CR,CR, "Band",BoxCloudColor, styleCloud | styleNoLabel|styleNoTitle);
}

_SECTION_END();*/



_SECTION_BEGIN("TSKPPIVOT4");
CHiPr = 0;
CLoPr = 9999999;
blsLong = 0;
PrevCOBar = 0;
NumBars = 0;
PrePP = 0;
PrevLowVal = 9999999;
BuySig = 0;
blsShort = 0;
PrevHiVal = 0;
blsNewCO = 0;
BarDif = 0;

KPA900Val = E_TSKPA900(Close);
KPAutoStopVal = E_TSKPAUTOSTOP(High,Low,Close);

// -- Create 0-initialized arrays the size of barcount
aHPivs = H - H;
aLPivs = L - L;
aHiVal = H - H;
aLoVal = L - L;


Ctmpl = E_TSKPCOLORTMPL(Open,High,Low,Close,Volume);
sctotal = 0;
sctotal = sctotal + IIf(tskp_colortmplcnd0 > 0, 1, -1);
sctotal = sctotal + IIf(tskp_colortmplcnd1 > 0, 1, -1);
sctotal = sctotal + IIf(tskp_colortmplcnd2 > 0, 1, -1);
sctotal = sctotal + IIf(tskp_colortmplcnd3 > 0, 1, -1);
sctotal = sctotal + IIf(tskp_colortmplcnd4 > 0, 1, -1);
sctotal = sctotal + IIf(tskp_colortmplcnd5 > 0, 1, -1);
sctotal = sctotal + IIf(tskp_colortmplcnd6 > 0, 1, -1);
sctotal = sctotal + IIf(tskp_colortmplcnd7 > 0, 1, -1);
sctotal = sctotal + IIf(tskp_colortmplcnd8 > 0, 1, -1);


for (curBar=0; curBar < BarCount-1; curBar++)
{

if ( curBar == 0 )
{
CHiPr = flowerHigh[curBar];
CHiBar = curBar;
CLoPr = flowerLow[curBar];
CLoBar = curBar;
blsLong = 0;
blsShort = 0;
blsNewCO = 0;
PrePP = 0;
PrevCOBar = 0;
PrevHiVal =flowerHigh[curBar];
PrevLowVal = flowerLow[curBar];
BuySig = 0;
SellSig = 0;
blsLL = 0;
}

if (flowerHigh[CurBar] >= CHiPr) {
CHiPr = flowerHigh[CurBar];
ChiBar = CurBar;
}

if (flowerLow[CurBar] <= CLoPr) {
CLoPr = flowerLow[CurBar];
CLoBar = CurBar;
}

if ( (KPA900Val[curBar] >= KPAutoStopVal[curbar]) AND (PrePP != -1) AND (blsLong != 1) ){
BarDif = CurBar - PrevCOBar;
if (BarDif >= NumBars) {
blsLong = 1;
blsShort = 0;
blsNewCO = 1;
PrevCOBar = CurBar;
}
}

if ( (KPA900Val[curBar] <= KPAutoStopVal[curbar]) AND (PrePP != 1) AND (blsShort != 1) ){
BarDif = CurBar - PrevCOBar;
if (BarDif >= NumBars) {
blsLong = 0;
blsShort = 1;
blsNewCO = 1;
PrevCOBar = CurBar;
}
}

if ( (blsNewCO == 1) AND (sctotal[CurBar] >= 5) AND (blsLong == 1) ) {
LVal = CurBar - CLoBar;
for (j= CLoBar-1; j <= CLoBar+1; j++)
{
if (j >=0) {
aLPivs[j] = 1;
aLoVal[j] = CLoPr;
}
}
PrePP = -1;
blsNewCO = 0;
CHiPr = flowerHigh[CurBar];
CHiBar = CurBar;
CLoPr = flowerLow[Curbar];
CLoBar = CurBar;
}
else if ((blsNewCO == 1) AND (sctotal[CurBar] <= -5) AND (blsShort == 1) ) {
HVal = CurBar - CHiBar;
for (j= CHiBar-1; j <= CHiBar+1; j++)
{
if (j >=0) {
aHPivs[j] = 1;
aHiVal[j] = CHiPr;
}
}
PrePP = 1;
blsNewCO = 0;
CHiPr = flowerHigh[CurBar];
CHiBar = CurBar;
CLoPr = flowerLow[Curbar];
CLoBar = CurBar;
}
}

PlotShapes(
IIf(aHPivs == 1,shapeSmallCircle,shapeNone),colorYellow ,0, aHiVal+0.05, offset = 5);

PlotShapes(
IIf(aLPivs == 1,shapeSmallCircle,shapeNone), colorPink,0, aLoVal-0.05, Offset = -5);
_SECTION_END();




_SECTION_BEGIN("SupRes_Short");
supresshortcolor=ParamColor("SupResShort",ColorRGB(82,82,82));

//this is for short term support line
TimeFrameSet(inWeekly);
ShortSupLenght=Param( "ShortResistLength", 4, 1, 55 ,1);
ShortSupCond1=HHV(High,ShortSupLenght);
ShortSupCond2=Close<Ref(LLV(Low,4),-1);
ShortSupA=IIf(L>Ref(ShortSupCond2,-1),1,IIf(H<Ref(ShortSupCond1,-1),-1,0));
ShortSupB=ValueWhen(ShortSupA!=0,ShortSupA,1);
ShortSupResult=IIf(ShortSupB==1,ShortSupCond1,ShortSupCond2);
TimeFrameRestore();
FinalShortSup=TimeFrameExpand(ShortSupResult,inWeekly,expandFirst);

//Plot(FinalShortSup ,"ShortResistance",supresshortcolor,styleLine|styleStaircase|styleThick|styleNoRescale|styleNoLabel|styleNoTitle);


//this is for short term resistance line
TimeFrameSet(inWeekly);
ShortResLenght=Param( "ShortSupportLenght", 4, 1, 55 ,1);
ShortResCond1=Close>Ref(HHV(High,4),-1);
ShortResCond2=LLV(Low,ShortResLenght);
ShortResA=IIf(H>Ref(ShortResCond1,-1),1,IIf(L<Ref(ShortResCond2,-1),-1,0));
ShortResB=ValueWhen(ShortResA!=0,ShortResA,1);
ShortResResult=IIf(ShortResB==1,ShortResCond2,ShortResCond1);
TimeFrameRestore();
FinalShortRes=TimeFrameExpand(ShortResResult,inWeekly,expandFirst);
Plot(FinalShortRes ,"ShortSupport",supresshortcolor,styleLine|styleThick|styleStaircase|styleNoRescale|styleNoLabel|styleNoTitle);

CS=FinalShortSup;
CR=FinalShortRes;

Step = (CR-CS)/4;
KC = CS + Step;
KB = KC + Step;
KA = KB + Step;

CloudColor1 = ParamColor("CloudColor1",ColorRGB(128,31,17));
CloudColor2 = ParamColor("CloudColor2",ColorRGB(139,139,0));
CloudColor3 = ParamColor("CloudColor3",ColorRGB(1,70,1));
CloudColor4 = ParamColor("CloudColor4",ColorRGB(41,105,05));

//PlotOHLC( CS, CS, KC,KC, "Band", CloudColor1, styleCloud | styleNoLabel|styleNoTitle|styleNoRescale);
//PlotOHLC( KC, KC, KB,KB, "Band", CloudColor2, styleCloud | styleNoLabel|styleNoTitle|styleNoRescale);
//PlotOHLC( KB, KB, KA,KA, "Band", CloudColor3, styleCloud | styleNoLabel|styleNoTitle|styleNoRescale);
//PlotOHLC( KA, KA, CR,CR, "Band", CloudColor4, styleCloud | styleNoLabel|styleNoTitle|styleNoRescale);





_SECTION_END();



_SECTION_BEGIN("SupRes_Long");

supreslongcolor=ParamColor("SupReslong",ColorRGB(0,0,234));


//this is for long term resistance line
TimeFrameSet(inWeekly);
LongResLength=Param( "ResistanceLength", 30, 1, 55 ,1);
LongResCond1=HHV(H,LongResLength);
LongResCond2=Close<Ref(LLV(Low,4),-1);
LongResA=IIf(L>Ref(LongResCond2,-1),1,IIf(H<Ref(LongResCond1,-1),-1,0));
LongResB=ValueWhen(LongResA!=0,LongResA,1);
LongResResult=IIf(LongResB==1,LongResCond1,LongResCond2);
TimeFrameRestore();
FinalResResult=TimeFrameExpand(LongResResult,inWeekly,expandFirst);

//Plot(FinalResResult ,"Resistance",supreslongcolor,styleLine|styleThick|styleNoRescale|styleNoLabel|styleNoTitle);


//this is for long term support line
TimeFrameSet(inWeekly);
LongSupLenght=Param( "SupportLenght", 30, 1, 55 ,1);
LongSupCond1=Close>Ref(HHV(High,4),-1);
LongSupCond2=LLV(Low,LongSupLenght);
LongSupA=IIf(H>Ref(LongSupCond1,-1),1,IIf(L<Ref(LongSupCond2,-1),-1,0));
LongSupB=ValueWhen(LongSupA!=0,LongSupA,1);
LongSupResult=IIf(LongSupB==1,LongSupCond2,LongSupCond1);
TimeFrameRestore();
FinalSupResult=TimeFrameExpand(LongSupResult,inWeekly,expandFirst);
//Plot(FinalSupResult ,"Support",supreslongcolor,styleLine|styleThick|styleNoRescale|styleNoLabel|styleNoTitle);



CloudResColor=ParamColor("LongColor",ColorRGB(0,0,45));


CS1=FinalResResult;
CR1=FinalSupResult;

//PlotOHLC( CS1, CS1, CR1,CR1, "", CloudResColor, styleCloud |styleStaircase|styleNoRescale| styleNoLabel|styleNoTitle);









_SECTION_BEGIN("Average 2");
//Average_switch = ParamToggle("Candle On/off", "Off|On");
P = HaClose;
Type = ParamList("Type", "Weighted,Lagless-21,Hull-26,Linear
Regression-45,Exponential,Double Exponential,Tripple
Exponential,Wilders,Simple");
Periods = Param("Periods", 100, 2, 200 );
Displacement = Param("Displacement", 1, -50, 50 );
m = 0;

if( Type == "Weighted" ) m= WMA( P, Periods );
if( Type == "Lagless-21" ) m= 2*EMA(P, Periods)-EMA(EMA(P, Periods), Periods);
if( Type == "Hull-26" ) m= WMA(2*(WMA(P, Periods/2))-WMA(P, Periods) ,4 );
if( Type == "Linear Regression-45" ) m= LinearReg( P, Periods );
if( Type == "Exponential" ) m = EMA( P, Periods );
if( Type == "Double Exponential" ) m = DEMA( P, Periods );
if( Type == "Tripple Exponential" ) m = TEMA( P, Periods );
if( Type == "Wilders" ) m = Wilders( P, Periods );
if( Type == "Simple" ) m = MA( P, Periods );

Plot( m, _DEFAULT_NAME(), ParamColor("Color", ColorRGB(70,70,70)),ParamStyle("Style",styleLine |styleThick|stylehidden|styleDots|styleNoTitle ,maskAll),Displacement );

_SECTION_END();







_SECTION_BEGIN("Average 4");
P = HaClose;
Type = ParamList("Type", "Weighted,Lagless-21,Hull-26,Linear
Regression-45,Exponential,Double Exponential,Tripple
Exponential,Wilders,Simple");
Periods = Param("Periods", 500, 2, 800 );
Displacement = Param("Displacement", 1, -50, 50 );
m = 0;

if( Type == "Weighted" ) m= WMA( P, Periods );
if( Type == "Lagless-21" ) m= 2*EMA(P, Periods)-EMA(EMA(P, Periods), Periods);
if( Type == "Hull-26" ) m= WMA(2*(WMA(P, Periods/2))-WMA(P, Periods) ,4 );
if( Type == "Linear Regression-45" ) m= LinearReg( P, Periods );
if( Type == "Exponential" ) m = EMA( P, Periods );
if( Type == "Double Exponential" ) m = DEMA( P, Periods );
if( Type == "Tripple Exponential" ) m = TEMA( P, Periods );

Plot( m, _DEFAULT_NAME(), ParamColor("Color", ColorRGB(190,190,190)),ParamStyle("Style",styleLine |styleThick|stylehidden|styleDots|styleNoTitle ,maskAll),Displacement );
_SECTION_END();


_SECTION_BEGIN("PanDora");
///////////////////////////////////
Title =
EncodeColor(colorWhite)+ Title = Name () + " | "
+EncodeColor(colorYellow) + Date() + " | "

+EncodeColor(colorTurquoise)+ "Open : "+ EncodeColor(colorLightGrey)+ O + " | "
+EncodeColor(colorTurquoise)+ "High : "+ EncodeColor(colorLightGrey)+ H + " | "
+EncodeColor(colorTurquoise)+ "Low : "+ EncodeColor(colorLightGrey)+ L + " | "
+EncodeColor(colorTurquoise)+ "Close : "+ WriteIf(C> Ref(C, -1),EncodeColor(colorBrightGreen),EncodeColor(colorRed))+ C + " | "
+EncodeColor(colorTurquoise)+ "Change : ("+ WriteIf(C> Ref(C, -1),EncodeColor(colorBrightGreen),EncodeColor(colorRed)) + WriteVal(C-Ref(C,-1))+" Rs."
+EncodeColor(colorTurquoise)+ " /"+ WriteIf(C> Ref(C, -1),EncodeColor(colorBrightGreen),EncodeColor(colorRed))+ WriteVal( ROC( C, 1 ))+""+ " % "
+EncodeColor(colorTurquoise)+ ") | Volume : " + WriteIf(V> Ref(V, -1.0),EncodeColor(colorBrightGreen),EncodeColor(colorRed))+ WriteVal(V,1.0)
;

//#include <T3.AFL>;

_SECTION_BEGIN("trending ribbon");

//BT=ParamColor("BT", colorRed );

TimeFrameSet (inDaily);
uptrend=PDI()>MDI()AND Signal()<MACD();
downtrend=MDI()>PDI()AND Signal()>MACD();
UTM3=IIf( uptrend, colorGreen, IIf( downtrend, colorRed, colorLightGrey ));

TimeFrameRestore();

UpA=uptrend;
DownB=downtrend;


Trend1 = WriteIf( UpA,"Up1", "");
Trend2 = WriteIf( DownB,"Down1", "");


RequestTimedRefresh( 0 );
GfxSelectFont( "Tahoma", 12, 100 );
GfxSetBkMode( 1 );
GfxSetTextColor( colorWhite );

if ( Trend1 =="Up1")
{
GfxSelectSolidBrush(ColorRGB(0,70,0) ); //

}
else

if ( Trend2 =="Down1")

{
GfxSelectSolidBrush( ColorRGB(70,0,0)); //

}
else

if ( Trend2 =="")

{
GfxSelectSolidBrush( colorPaleBlue );

}


GfxSelectPen( colorBlack, 0 ); // broader color
//GfxRoundRect( 15,305,135,215, 5, 5 );
GfxCircle( 70,90,36 );
_SECTION_END();







_SECTION_BEGIN("Rays");

//FT=ParamColor("FT", colorRed );

Pp1=3;
Pp2=2;

CS33=HHV(LLV(flowerHigh,Pp1)-ATR(Pp2),4);
CR33=HHV(LLV(flowerHigh,Pp1)-ATR(Pp2),5);

AtrupTrendCond1 = flowerClose> CS33 ;
AtrdnTrendCond1 =CS33>flowerClose ;


ATRup = WriteIf(AtrupTrendCond1,"atrup", "");
ATRdown= WriteIf( AtrdnTrendCond1,"atrdn", "");

if ( ATRup =="atrup")
{
GfxSelectSolidBrush( ColorRGB(0,180,0) );

}
else

if (ATRdown =="atrdn")

{
GfxSelectSolidBrush( ColorRGB(180,0,0));

}

else

if ( ATRdown =="")

{
GfxSelectSolidBrush( colorGrey40 );

}

GfxSelectFont( "Arial", 10, 100 );
GfxSetBkMode( 1 );
GfxSetTextColor( colorBlack );

GfxSelectPen( colorBlack, 1 ); // broader color
GfxCircle( 70,90,30 );

_SECTION_END();


_SECTION_BEGIN("Exit_Beast-3");

//GT=ParamColor("GT", colorRed );

EntrylookbackPeriod=10;
EntryATRperiod=1.9;
EntrySig = C > ( LLV( flowerLow, EntrylookbackPeriod ) + EntryATRperiod * ATR( 10 ) );
ExitSig = C < ( HHV( flowerHigh, EntrylookbackPeriod ) -EntryATRperiod * ATR( 10 ) );


RequestTimedRefresh( 0 );
GfxSelectFont( "Tahoma", 12, 100 );
GfxSetBkMode( 1 );
GfxSetTextColor( colorWhite );

EntryB = WriteIf( EntrySig,"eu", "");
ExitB = WriteIf( ExitSig,"ed", "");

if ( EntryB =="eu")
{
GfxSelectSolidBrush( ColorRGB(0,210,0) ); //

}
else

if ( ExitB =="ed")

{
GfxSelectSolidBrush( ColorRGB(210,0,0)); //

}

else

if ( ExitB =="")

{
GfxSelectSolidBrush( colorGrey40 );

}

GfxSelectFont( "Arial", 10, 100 );
GfxSetBkMode( 1 );
GfxSetTextColor( colorBlack );

GfxSelectPen( colorBlack, 1 ); // broader color
GfxCircle( 70,90,24 );// changing the value of x,y,rad x-70, y-90, rad-24

_SECTION_END();



_SECTION_BEGIN("CCI9-2");

//HT=ParamColor("HT", colorRed );

ccidn=CCI(8) < 0;
cciup=CCI(9) > 0;


ccresult1 = WriteIf( cciup,"cu", "");
ccresult2 = WriteIf( ccidn,"cd", "");




RequestTimedRefresh( 0 );
GfxSelectFont( "Tahoma", 12, 100 );
GfxSetBkMode( 1 );
GfxSetTextColor( colorWhite );

if ( ccresult1 =="cu")
{
GfxSelectSolidBrush( ColorRGB(0,240,0) );

}
else

if ( ccresult2 =="cd")

{
GfxSelectSolidBrush( ColorRGB(240,0,0));

}

else

if ( ccresult2 =="")

{
GfxSelectSolidBrush( colorGrey40 );

}

GfxSelectFont( "Arial", 10, 100 );
GfxSetBkMode( 1 );
GfxSetTextColor( colorBlack );

GfxSelectPen( colorBlack, 1 ); // broader color
GfxCircle( 70,90,18 );




_SECTION_END();




_SECTION_BEGIN("%BB7-1");

//IT=ParamColor("IT", colorRed );
p=7;
x=((C+2*StDev(C,p)-MA(C,p))/(4*StDev(C,p)))*100;
bbdown= x < 40;
bbup= x > 40;

bbresult1 = WriteIf( bbup,"bu", "");
bbresult2 = WriteIf( bbdown,"bd", "");
bbresult3 = WriteIf( C,"bearishrevers", "");



RequestTimedRefresh( 0 );
GfxSelectFont( "Tahoma", 12, 100 );
GfxSetBkMode( 1 );
GfxSetTextColor( colorWhite );

if ( bbresult1 =="bu")
{
GfxSelectSolidBrush( ColorRGB(62,255,62) );

}
else

if ( bbresult2 =="bd")

{
GfxSelectSolidBrush( ColorRGB(255,62,62) );

}

else

if ( bbresult2 =="")

{
GfxSelectSolidBrush( colorGrey40 );

}

GfxSelectFont( "Arial", 10, 100 );
GfxSetBkMode( 1 );
GfxSetTextColor( colorBlack );

GfxSelectPen( colorBlack, 1 ); // broader color
GfxCircle( 70,90,12 );


_SECTION_END();
 

shivangi77

Well-Known Member
Hello,

I am not able to download the file from the place....The link which you gave is not having that file....Can you please give me fresh (working) link..

Thanks.

Bhupesh




Code:
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
SetBarsRequired(sbrAll,sbrAll);
SetBarFillColor(IIf(C>O,ParamColor("Candle Up Color", colorBrightGreen),IIf(C<=O,ParamColor("Candle Down Color", colorRed),colorLightGrey)));
Plot(C,"Price",IIf(C>O,ParamColor("Shadow Up Color", colorBlack),IIf(C<=O,ParamColor("Shadow Down Color", colorBlack),colorLightGrey)),64,0,0,0,0);
SetChartBkColor(ParamColor("Panel Color ",colorLightGrey));
SetChartBkGradientFill(ParamColor("Upper Chart",colorLightGrey),ParamColor("Lower Chart",colorLightGrey));
GraphXSpace=Param("GraphXSpace",20,-10,25,1);

_SECTION_BEGIN("Raghee Horner's EMA's");
EMA1 = EMA(H,34);
EMA2 = EMA(L,34);
EMA3 = EMA(C,34);

Plot( EMA1, "EMA1" ,ParamColor( "Color1", colorRed ), ParamStyle("Style", styleDashed|styleThick) | styleNoRescale );
Plot( EMA2, "EMA2" ,ParamColor( "Color2", colorGreen ), ParamStyle("Style", styleDashed|styleThick) | styleNoRescale );
Plot( EMA3, "EMA3" ,ParamColor( "Color3", colorBlue ), ParamStyle("Style", styleDashed|styleThick) | styleNoRescale );
_SECTION_END();

_SECTION_BEGIN("Supertrend");
procedure calcTrend_proc(ATR_Period,tr,ATR_Multiplier,TrendMode,CalcPrice)
{
global buffer_line_down;
global buffer_line_up;
buffer_line_down = Null;
buffer_line_up = Null;

PHASE_NONE = 0;
PHASE_BUY = 1;
PHASE_SELL = -1;

phase=PHASE_NONE;
band_upper = 0;band_lower = 0;

for(i = ATR_Period + 1; i < BarCount; i++)
{
band_upper = CalcPrice[i] + ATR_Multiplier * tr[i];
band_lower = CalcPrice[i] - ATR_Multiplier * tr[i];

if(phase==PHASE_NONE)
{
buffer_line_up[i] = CalcPrice[i];
buffer_line_down[i] = CalcPrice[i];
}
if(phase!=PHASE_BUY && Close[i]>buffer_line_down[i-1] && !IsEmpty(buffer_line_down[i-1])) 
{
phase = PHASE_BUY;
buffer_line_up[i] = band_lower;
buffer_line_up[i-1] = buffer_line_down[i-1];
}
if(phase!=PHASE_SELL && Close[i]<buffer_line_up[i-1] && !IsEmpty(buffer_line_up[i-1]))
{
phase = PHASE_SELL;
buffer_line_down[i] = band_upper;
buffer_line_down[i-1] = buffer_line_up[i-1];
} 
if(phase==PHASE_BUY && ((TrendMode==0 && !IsEmpty(buffer_line_up[i-2])) || TrendMode==1) )
{
if(band_lower>buffer_line_up[i-1]) 
{
buffer_line_up[i] = band_lower;
}
else 
{
buffer_line_up[i] = buffer_line_up[i-1];
}
}
if(phase==PHASE_SELL && ((TrendMode==0 && !IsEmpty(buffer_line_down[i-2])) || TrendMode==1) )
{
if(band_upper<buffer_line_down[i-1])
{
buffer_line_down[i] = band_upper;
}
else
{
buffer_line_down[i] = buffer_line_down[i-1];
}
}
}
}

TrendMode = ParamToggle("TrendMode","Off|On",1);
ATR_Multiplier = Param("ATR_Multiplier",2,0.1,10,0.1);
ATR_Period = Param( "ATR_Period",5,1,20,1);
tr = ATR(ATR_Period);

CalcPrice = (H+L)/2;
calcTrend_proc(ATR_Period,tr,ATR_Multiplier,TrendMode,CalcPrice);

Plot(buffer_line_up,"\ntu",ColorRGB(28,134,238),styleThick);
Plot(buffer_line_down,"\ntd",ColorRGB(205,51,51),styleThick);

Plot( 2,"",IIf(buffer_line_up,colorGreen,colorBlack),styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
Plot( 4,"",IIf(buffer_line_down,colorRed,colorBlack),styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
_SECTION_END();

TimeFrameSet(inDaily);
DayHigh = LastValue(H);
DayLow = LastValue(L);
TimeFrameRestore();

Title = Date() + ", Op=" + Open + ", Hi=" + High + ", Lo=" + Low + ", LTP=" + Close + ", Change= " + SelectedValue( ROC( C, 1 ) ) + "%" + "\n Today`s High=" + DayHigh + ", Today`s Low=" + DayLow + "  " ;


prev=AMA2(C,1,0);
d=IIf(C>Ref(Max(Max(H,Ref(H,-20)),Max(Ref(H,-10),Ref(H,-15))),-1),Min(Min(L,Ref(L,-20)),Min(Ref(L,-10),Ref(L,-15))),
IIf(C<Ref(Min(Min(L,Ref(L,-20)),Min(Ref(L,-10),Ref(L,-15))),-1),Max(Max(H,Ref(H,-20)),Max(Ref(H,-10),Ref(H,-15))),PREV));
a=Cross(Close,d);
b=Cross(d,Close);
state=IIf(BarsSince(a)<BarsSince(b),1,0);
s=state>Ref(state,-1);
ss=state<Ref(state,-1);
sss=state==Ref(state,-1);
col=IIf(state == 1 ,51,IIf(state ==0,4,1));
Plot(C,"",Col,64);
Buy = s;
Sell = ss;
shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes(shape, IIf(Buy,colorGreen,colorRed), 0, IIf(Buy,Low,High));
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-10);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-20);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-15);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=20);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=30);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-25);
//WriteIf(s,"EXIT all Short positions\nif trading long positions, enter long Now-\nOR at the market price on tomorrow's Open with stop="+EncodeColor(4)+WriteVal(L+.75*ATR(5),1.4)+" ,","");
//WriteIf(ss,"exit all long positions today with a Market On Close (MOC) order\nOR at the market price on tomorrow's Open with stop="+EncodeColor(4)+WriteVal(Ref(H+.75*ATR(5), -1),1.4)+",","");
//WriteIf( sss ,"No trading signals today.","") ;


dist = 2*ATR(10);
dist1 = 5*ATR(10);
for( i = 0; i < BarCount; i++ )
{
if( Buy[i] )
{
PlotText( "\nBuy:" + L[ i ] + "\nT= " + (L[i]*1.005) + "\nSL= " + (L[i]*0.9975), i, L[ i ]-dist[i], colorGreen, colorWhite );
}
if( Sell[i] )
{
PlotText( "Sell:" + H[ i ] + "\nT= " + (H[i]*0.995) + "\nSL= " + (H[i]*1.0025), i, H[ i ]+dist1[i], colorRed, colorWhite );
}
}


Filter = s OR sss OR sss ;
AddColumn(C,"close",1.2);
AddColumn( IIf( s, 66,1 ), "buy", formatChar, 1, bkcolor =IIf (s,colorYellow, colorPink ));
AddColumn( IIf( Ss, 83,1 ), "sell", formatChar, 1, bkcolor =IIf (Ss,colorPink, colorWhite ));
AddColumn( IIf( sss, 87,1 ), "wait", formatChar, 1, bkcolor =IIf (sss,colorYellow, colorRed ));


_SECTION_BEGIN("trend");
uptrend=PDI(20)>MDI(10)AND Signal(29)<MACD(13);
downtrend=MDI(10)>PDI(20)AND Signal(29)>MACD(13);
Plot( 2, /* defines the height of the ribbon in percent of pane width */"ribbon",
IIf( uptrend, colorGreen, IIf( downtrend, colorRed, 0 )), /* choose color */
styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
_SECTION_END();

Buy = s AND a AND uptrend ;
Short = ss AND b AND downtrend ;
Sell = ss AND b AND downtrend ;
Cover = s AND a AND uptrend ;

Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
Cover=ExRem(Cover,Short);
Short=ExRem(Short,Cover);

Filter=Buy OR Sell;
Filter= Cover OR Short;

AddColumn( Buy, "Buy", 1);
AddColumn(Sell, "Sell", 1);
AddColumn(Close,"Close",1.2);
AddColumn(Volume,"Volume",1.0);


// Plot the Buy and Sell arrows.
shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-10);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-20);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-15);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=20);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=30);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-25);
//_SECTION_BEGIN("Background text");
C13=Param("fonts",20,10,30,1 );
C14=Param("left-right",2.1,1.0,5.0,0.1 );
C15=Param("up-down",12,1,20,1 );
Miny = Status("axisminy");
Maxy = Status("axismaxy");
lvb = Status("lastvisiblebar");
fvb = Status("firstvisiblebar");
pxwidth = Status("pxwidth");
pxheight = Status("pxheight");
GfxSetBkMode(transparent=1);
GfxSetOverlayMode(1);
GfxSelectFont("Tahoma", Status("pxheight")/C13 );
GfxSetTextAlign( 6 );
GfxSetTextColor( ColorRGB (217,217,213));
GfxTextOut( Name(), Status("pxwidth")/C14, Status("pxheight")/C15 );
GfxSelectFont("Tahoma", Status("pxheight")/C13*0.5 );
GfxSetTextColor( ColorRGB (103,103,103));
GfxTextOut( "Kailash Pareek", Status("pxwidth")/C14, Status("pxheight")/C15*2.5 );
GfxSelectFont("Tahoma", Status("pxheight")/C13*0.5 );
GfxSetTextColor( ColorRGB (103,103,103));
GfxTextOut( "Kailash Pareek", Status("pxwidth")/C14, Status("pxheight")/C15*4 );
GfxSelectFont("MS Sans Serif", 10, 500, False, False, 0);
 
Hi Shivangi,

I have been following your inputs for sometime now and i greatly admire your contribution to the learning of your fellow traders.
I think somewhere you have posted an afl around the high low entry system. So, if a system breaks a say 20 days high we go long and vice versa, can you please direct me to such an afl?

Thanks
optionspro
 

saivenkat

Well-Known Member
@Ocil, and amibrokerfan,raju bro, and sr114 .Thanks for sharing the refined version of nirvana.. As lexrst said.. the charts that you have given on 30min tf og NF is really really clean.. and this made me to give a try with it..

I just copied and tried to use it with ami.. it is throwing errors. which is apart from the regular errors that arise because of spaces that occur in between..

I am attaching the errors for reference..










Can someone rectify this?

Thanks and regards
 
Last edited:
@Ocil, and amibrokerfan,raju bro, and sr114 .Thanks for sharing the refined version of nirvana.. As lexrst said.. the charts that you have given on 30min tf og NF is really really clean.. and this made me to give a try with it..

I just copied and tried to use it with ami.. it is throwing errors. which is apart from the regular errors that arise because of spaces that occur in between..

I am attaching the errors for reference..










Can someone rectify this?

Thanks and regards
brother plugins missed
try to download below link
mediafire dot com/?znmwud2jdwt

Copy JurikLib.dll and kpami.dll and
paste it in your Amibroker Plugin folder which is by
default C:\Program Files\AmiBroker\Plugins

and try u r new afl
 

saivenkat

Well-Known Member
@Raju bro.. Thanks a million for instant response.. and it worked..now i could beautiful charts on my screen.. Really really happy.. :clap::clap::clap:
 
OK LOTS OF CHILDS PLAY GOING ON..
lets do some real play..

this is real southbreeze!!!
WHO CAN SHARE IT????????????
Dear Amibrokerfans
U entered this forum with a bang asking shivangi about above image
I ask you, do U have this system? As you have posted images of facebook, so if you are so close to southbreeze then u must have na.
Also from where u copied this 2 year old image i know!
U are distributing here freely available nirvana thats already posted on his blog.
If you are so close to MRTQ13 then plz post code for above image.
Lets see how much rare stuff U have?
 
Hello frnds,
Help me out with the Stop loss criteria given below. I want some one to make an afl of it.
Stop loss is based on the percentage only , but it should operate once the call is triggered.
For example: Say our stop loss is 2%
Once the buy is triggered, stop loss should be calculated 2 % from the entry value, as the mkt progress and make a new high close ( from our buying value), our stoploss should move up, i.e calculated 2% on the new high closing value.
Reverse for the shorts side.
 
Status
Not open for further replies.

Similar threads