Skip to main content

Renko Chart





_SECTION_BEGIN("www.trendnifty.com");
SetBarsRequired(100000,100000);
//------------------------------------------------------------------+
// Block 1 |
//------------------------------------------------------------------+
VR=ParamToggle("View Renko","Bricks|Lines/Bars",0);
FV=Param("Initial size volatility",5,5,5,5);
MV=Param("Method calculation volatility",0,0,2,1);
PeriodVol=Param("Period calculation volatility",14,2,100,1);
Multiplier=Param("Multiplier volatility",1,0.1,10,0.1);
MR=ParamToggle("Method Renko","floating|fixed",1);
SG=ParamToggle("Show gap","No|Yes",1);
CG=ParamColor("Colour show gap",11);
MaxBS=Param("Maximum size brick",0,0,10,0.1);
MinBS=Param("Minimum size brick",0,0,10,0.1);
RenkoUp=ParamColor("Colour Renko upwards",colorGreen);
RenkoDown=ParamColor("Colour Renko downwards",colorRed);
SB=ParamStyle("View bars",defaultval=styleCandle,mask=maskPrice);
color3=ParamColor("Colour bars",colorBlack);
History=Param("History size",50000,2,BarCount-1,1);
//------------------------------------------------------------------+
// Block 2 |
//------------------------------------------------------------------+
i=Max(BarCount-1-History,PeriodVol+1);
r=j=0;
direction=0;
iGapUp=iGapDown=0;
rOpen[0]=rHigh[0]=rLow[0]=rClose[0]=jUp=jDown=Open[i];
//-------------------------------------------------------------------
switch(MV)
{
case 0: Volatility=FV; break;
case 1: Volatility=ATR(PeriodVol)*Multiplier; break;
case 2: Volatility=StDev(Open,PeriodVol)*Multiplier; break;
}
BrickSize=Volatility[i-1];
//-------------------------------------------------------------------+
// Block 3 |
//-------------------------------------------------------------------+
while(i<=BarCount-1)
{
if(SG==1)
{
if(High[i-1]<Low[i])
{
iGapUp[i]=1;
}
else
{
if(Low[i-1]>High[i])
{
iGapDown[i]=1;
}
}
}
//-------------------------------------------------------------------
if(MR==0)
{
BrickSize=Volatility[i-1];
if(MaxBS>0) {BrickSize=Min(MaxBS,BrickSize);}
if(MinBS>0) {BrickSize=Max(MinBS,BrickSize);}
}
//------------------------------------------------------------------+
// Block 4 |
//------------------------------------------------------------------+
if(direction==0)
{
if(Open[i]-rClose[r]>BrickSize)
{
rClose[r]=rOpen[r]+BrickSize;
rHigh[r]=rClose[r];
direction=1;
//-------------------------------------------------------------------
BrickSize=Volatility[i];
if(MaxBS>0) {BrickSize=Min(MaxBS,BrickSize);}
if(MinBS>0) {BrickSize=Max(MinBS,BrickSize);}
//-------------------------------------------------------------------
if(iGapUp[i]==1|iGapDown[i]==1)
{
color[r]=CG;
}
else
{
color[r]=RenkoUp;
}
continue;
}
//-------------------------------------------------------------------
else
{
if(rClose[r]-Open[i]>BrickSize)
{
rClose[r]=rOpen[r]-BrickSize;
rLow[r]=rClose[r];
direction=2;
//-------------------------------------------------------------------
BrickSize=Volatility[i];
if(MaxBS>0) {BrickSize=Min(MaxBS,BrickSize);}
if(MinBS>0) {BrickSize=Max(MinBS,BrickSize);}
//-------------------------------------------------------------------
if(iGapUp[i]==1|iGapDown[i]==1)
{
color[r]=CG;
}
else
{
color[r]=RenkoDown;
}
continue;
}
}
}
//------------------------------------------------------------------+
// Block 5 |
//------------------------------------------------------------------+
else
{
if(direction==1)
{
if(rOpen[r]-Open[i]>BrickSize)
{
r++;
rOpen[r]=rOpen[r-1];
rHigh[r]=rOpen[r];
rClose[r]=rOpen[r]-BrickSize;
rLow[r]=rClose[r];
direction=2;
//-------------------------------------------------------------------
BrickSize=Volatility[i];
if(MaxBS>0) {BrickSize=Min(MaxBS,BrickSize);}
if(MinBS>0) {BrickSize=Max(MinBS,BrickSize);}
//-------------------------------------------------------------------
if(iGapUp[i]==1|iGapDown[i]==1)
{
color[r]=CG;
}
else
{
color[r]=RenkoDown;
}
continue;
}
//-------------------------------------------------------------------
else
{
while(Open[i]-rClose[r]>BrickSize)
{
r++;
rOpen[r]=rClose[r-1];
rLow[r]=rOpen[r];
rClose[r]=rOpen[r]+BrickSize;
rHigh[r]=rClose[r];
//-------------------------------------------------------------------
BrickSize=Volatility[i];
if(MaxBS>0) {BrickSize=Min(MaxBS,BrickSize);}
if(MinBS>0) {BrickSize=Max(MinBS,BrickSize);}
//-------------------------------------------------------------------
if(iGapUp[i]==1|iGapDown[i]==1)
{
color[r]=CG;
}
else
{
color[r]=RenkoUp;
}
}
}
}
//------------------------------------------------------------------+
// Block 6 |
//------------------------------------------------------------------+
else
{
if(direction==2)
{
if(Open[i]-rOpen[r]>BrickSize)
{
r++;
rOpen[r]=rOpen[r-1];
rLow[r]=rOpen[r];
rClose[r]=rOpen[r]+BrickSize;
rHigh[r]=rClose[r];
direction=1;
//-------------------------------------------------------------------
BrickSize=Volatility[i];
if(MaxBS>0) {BrickSize=Min(MaxBS,BrickSize);}
if(MinBS>0) {BrickSize=Max(MinBS,BrickSize);}
//-------------------------------------------------------------------
if(iGapUp[i]==1|iGapDown[i]==1)
{
color[r]=CG;
}
else
{
color[r]=RenkoUp;
}
continue;
}
//-------------------------------------------------------------------
else
{
while(rClose[r]-Open[i]>BrickSize)
{
r++;
rOpen[r]=rClose[r-1];
rHigh[r]=rOpen[r];
rClose[r]=rOpen[r]-BrickSize;
rLow[r]=rClose[r];
//-------------------------------------------------------------------
BrickSize=Volatility[i];
if(MaxBS>0) {BrickSize=Min(MaxBS,BrickSize);}
if(MinBS>0) {BrickSize=Max(MinBS,BrickSize);}
//-------------------------------------------------------------------
if(iGapUp[i]==1|iGapDown[i]==1)
{
color[r]=CG;
}
else
{
color[r]=RenkoDown;
}
}
}
}
}
}
//------------------------------------------------------------------+
// Block 7 |
//------------------------------------------------------------------+
if(VR==1)
{
jOpen[j]=Open[i];
jHigh[j]=High[i];
jLow[j]=Low[i];
jClose[j]=Close[i];
//-------------------------------------------------------------------
if(direction==1)
{
jUp[j]=rClose[r];
jDown[j]=rOpen[r];
color2[j]=color[r];
}
else
{
if(direction==2)
{
jUp[j]=rOpen[r];
jDown[j]=rClose[r];
color2[j]=color[r];
}
}
j++;
}
i++;
}
//------------------------------------------------------------------+
// Block 8 |
//------------------------------------------------------------------+
if(VR==1)
{
delta=BarCount-j;
jOpen=Ref(jOpen,-delta);
jHigh=Ref(jHigh,-delta);
jLow=Ref(jLow,-delta);
jClose=Ref(jClose,-delta);
jUp=Ref(jUp,-delta);
jDown=Ref(jDown,-delta);
color2=Ref(color2,-delta);
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat(" - Open %g, Hi %g, Lo %g, Close %g (%.1f%%) ", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
PlotOHLC(jOpen,jHigh,jLow,jClose,"SRI",color3,SB);
Plot(jUp,"Up",color2,styleThick);
Plot(jDown,"Down",color2,styleThick);
}
//-------------------------------------------------------------------
else
{
delta=BarCount-1-r;
rOpen=Ref(rOpen,-delta);
rHigh=Ref(rHigh,-delta);
rLow=Ref(rLow,-delta);
rClose=Ref(rClose,-delta);
color=Ref(color,-delta);
PlotOHLC(rOpen,rHigh,rLow,rClose,"SRI",color,styleCandle);
}
_SECTION_END();

_SECTION_BEGIN("EMA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 24, 2, 300, 1, 10 );
Plot( EMA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorWhite ), ParamStyle("Style") );
_SECTION_END();

_SECTION_BEGIN("EMA1");
P = ParamField("Price field",-1);
Periods = Param("Periods", 48.5, 2, 300, 1, 10 );
Plot( EMA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCustom12 ), ParamStyle("Style") );
_SECTION_END();

Comments

Popular posts from this blog

STAN WEINSTEIN'S STRATEGY - Halan Manoj Kumar

// THIS AFL INCORPORATES MOST OF THE CONCEPTS OF STAN WEINSTEINS TRADING METHODOLOGY. // USE ONLY WEEKLY CHART. // THIS AFL DOES NOT GUARANTEE ANY POSITIVE RETURNS. // USE THIS AFL AT YOUR OWN RISK // THIS AFL WAS DEVELOPED BY HALAN MANOJ KUMAR, MSC,CAIIB,FRM,PRM,CMA,ACMA. HOWEVER IN SOME CASES INDIVIDUAL CODE SNIPPETS ARE FROM DIFFERENT SOURCES AND I THANK THOSE DEVELOPERS. // ANY CONCEPTUAL QUERIES OR COMMENTS CAN BE MAILED TO scorpiomanoj73@gmail.com _SECTION_BEGIN("CHART"); SetChartOptions(0,chartShowArrows|chartShowDates); _N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%)", O, H, L, C, SelectedValue( ROC( C, 1 ) ) )); Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); _SECTION_END(); //RELATIVE STRENGTH // IF YOUR NIFTY TRADING SYMBOL IS DIFFERENT, PLEASE USE THAT INSTEAD OF ONE MENTIONED HERE. rsmaPeriod...

10K AFL FREE INTRADAY TRADING.afl

_SECTION_BEGIN("Price1"); SetChartOptions(0,chartShowArrows|chartShowDates); Plot( C, "Close", ParamColor("Color", colorRed ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); _SECTION_END(); //_SECTION_BEGIN("Pivot")     YH = TimeFrameGetPrice("H", inDaily, -1);        // yesterdays high     YL = TimeFrameGetPrice("L", inDaily, -1);        //                low     YC = TimeFrameGetPrice("C", inDaily, -1);        //                close     YO = TimeFrameGetPrice("O", inDaily);            // current day open     //Normal Pivot     PP = (YH + YL + YC) / 3;     R1 = (2 * PP) - YL;     R2 = PP + (YH - YL); ...

Wilders Most Succesful Intraday Intraday

PM1 = Param("MA1",7.5,1,1500,1); PM2 = Param("MA2",11,1,1500,1); M1 = Wilders(Close,PM1); M2 = Wilders(Close,PM2); A = Cross(M1,M2); B = Cross(M2,M1); Hor1=Param(" LEFT/RIGHT",1,1,1660,1); Ver1=Param(" UP DOWN",35,1,830,1); FS1=Param(" Font Size",15,11,100,1); GfxSelectFont("Tahoma", FS1, 200 ); GfxSetBkColor(colorBlack); GfxSetTextColor(colorGold); //GfxTextOut("EMA "+ PM1 + " "+ Prec(M1,2),Hor1,Ver1); GfxSetTextColor(colorGreen); //GfxTextOut("EMA "+ PM2 + " "+ Prec(M2,2),Hor1,Ver1+25); Plot(M1," EMA: "+pm1,ParamColor("FAST EMA COLOR",colorBrightGreen)); Plot(M2," EMA: "+pm2,ParamColor("SLOW EMA COLOR",colorRed)); PlotShapes(IIf(A,shapeUpArrow,shapeNone),colorBrightGreen,0,L,Offset= -30); PlotShapes(IIf(B,shapeDownArrow,shapeNone),colorRed,0,H,Offset = -30); Filter = (A == 1) OR (B == 1); AddColumn(A,"BUY/SELL",1,IIf(A,colorGreen,c...