Code:
// Description: By moneyfroly
// [url]http://www.traderji.com/advanced-trading-strategies/102339-5-minute-trading-system-if-afl-coded-awesome.html[/url]
// Coded By: Mayur Patel | fb.com/Mayursss
_SECTION_BEGIN("Chart Pane");
SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkColor(ParamColor("Outer Panel",ColorRGB(30, 30, 30)));
SetChartBkGradientFill(ParamColor("Upper Chart",colorDarkGrey),ParamColor("LowerChart",colorDarkGrey));
GraphXSpace=10;
SetBarFillColor (IIf(C>O,19,IIf(C<O,24,42)));
Plot(C,"",IIf(C>O,51,IIf(C<O,33,55)),64);
Title = EncodeColor(ColorRGB(127, 179, 213))+ Title = Name() + " " + EncodeColor(ColorRGB(41, 128, 185)) + Date() +
" " + EncodeColor(ColorRGB(127, 179, 213)) + "{{INTERVAL}} " +
EncodeColor(ColorRGB(127, 179, 213))+ " Open = "+ EncodeColor(ColorRGB(41, 128, 185))+ WriteVal(O,1.2) +
EncodeColor(ColorRGB(127, 179, 213))+ " High = "+ EncodeColor(ColorRGB(41, 128, 185)) + WriteVal(H,1.2) +
EncodeColor(ColorRGB(127, 179, 213))+ " Low = "+ EncodeColor(ColorRGB(41, 128, 185))+ WriteVal(L,1.2) +
EncodeColor(ColorRGB(127, 179, 213))+ " Close = "+ EncodeColor(ColorRGB(41, 128, 185))+ WriteVal(C,1.2)+
EncodeColor(ColorRGB(127, 179, 213))+ " Volume = "+ EncodeColor(ColorRGB(41, 128, 185))+ WriteVal(V,1);
Plot(V, "Volume", ColorRGB(27, 79, 114),styleHistogram|styleOwnScale|styleThick, 10);
Plot(Day()!=Ref(Day(),-1),"",ColorRGB(25,33,25),styleHistogram|styleDashed|styleNoLabel|styleOwnScale);
_SECTION_END();
_SECTION_BEGIN("Super Trend");
Factor=Param("Factor",4,1,10,0.1);
Pd=Param("ATR Periods",10,1,100,1);
Up=(H+L)/2+(Factor*ATR(Pd));
Dn=(H+L)/2-(Factor*ATR(Pd));
iATR=ATR(Pd);
TrendUp=TrendDown=Null;
trend[0]=1;
changeOfTrend=0;
flag=flagh=0;
for (i = 1; i <BarCount-1; i++) {
TrendUp[i] = Null;TrendDown[i] = Null; trend[i]=1;
if (Close[i]>Up[i-1]) {
trend[i]=1;
if (trend[i-1] == -1) changeOfTrend = 1;
}
else if (Close[i]<Dn[i-1]) {
trend[i]=-1;
if (trend[i-1] == 1) changeOfTrend = 1;
}
else if (trend[i-1]==1) {
trend[i]=1;
changeOfTrend = 0;
}
else if (trend[i-1]==-1) {
trend[i]=-1;
changeOfTrend = 0;
}
if (trend[i]<0 && trend[i-1]>0) {flag=1;}
else {flag=0;}
if (trend[i]>0 && trend[i-1]<0) {flagh=1;}
else {flagh=0;}
if (trend[i]>0 && Dn[i]<Dn[i-1]){Dn[i]=Dn[i-1];}
if (trend[i]<0 && Up[i]>Up[i-1]){ Up[i]=Up[i-1];}
if (flag==1){ Up[i]=(H[i]+L[i])/2+(Factor*iATR[i]);}
if (flagh==1){ Dn[i]=(H[i]+L[i])/2-(Factor*iATR[i]);}
if (trend[i]==1) {
TrendUp[i]=Dn[i];
if (changeOfTrend == 1) {
TrendUp[i-1] = TrendDown[i-1];
changeOfTrend = 0;
}
}
else if (trend[i]==-1) {
TrendDown[i]=Up[i];
if (changeOfTrend == 1) {
TrendDown[i-1] = TrendUp[i-1];
changeOfTrend = 0;
}
}
}
Plot(TrendUp,"TrendUp",colorGreen);
Plot(TrendDown,"TrendDown",colorRed);
_SECTION_END();
_SECTION_BEGIN("Power Trade");
//Includes
NewDay =Day()!=Ref(Day(),-1);
PH = TimeFrameGetPrice( "H", inDaily, -1 );
PL = TimeFrameGetPrice( "L", inDaily, -1 );
PC = TimeFrameGetPrice( "C", inDaily, -1 );
DayO = TimeFrameGetPrice( "O", inDaily, 0 );
//Signals
IsGapUp= DayO>PC;
IsGapDn= DayO<PC;
PB_1= NewDay AND IsGapUp AND C>PH AND (O==L) ;
PB_2= NewDay AND IsGapUp AND C>PH ;
PB_3= NewDay AND IsGapDn AND C>PH AND (trend==1 AND O<TrendUp);
NormalBuy= trend==1 AND L<=TrendUp AND Min(O,C)>=TrendUp;
PS_1= NewDay AND IsGapDn AND C<PL AND (O==H) ;
PS_2= NewDay AND IsGapDn AND C<PL ;
PS_3= NewDay AND IsGapUp AND C<PL AND (trend==-1 AND O>TrendDown);
NormalShort= trend==-1 AND H>=TrendDown AND Max(O,C)<=TrendDown;
Buy=PB_1 OR PB_2 OR PB_3 OR NormalBuy;
Short= PS_1 OR PS_2 OR PS_3 OR NormalShort;
Cover=Sell=TimeNum()>=152500;
Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
Short= ExRem(Short,Cover);
Cover=ExRem(Cover,Short);
//Shapes
Shape=IIf( PB_1 OR PS_1, shapeDigit1,IIf(PB_2 OR PS_2,shapeDigit2,IIf(PB_3 OR PS_3,shapeDigit3, shapeNone )));
PlotShapes(Shape, IIf(Buy,colorLime,colorOrange ));
PlotShapes(IIf(Buy,shapeUpArrow,IIf(Short,shapeDownArrow, shapeNone )) , IIf(Buy,colorDarkGreen,colorDarkRed ),0, IIf( Buy, Low, High ) );
//Explore
Filter=Buy OR Short;
PowerSig= IIf(PB_1,1,IIf(PS_1,-1,IIf(PB_2,2,IIf(PS_2,-2,IIf(PB_3,3,IIf(PS_3,-3,0))))));
NormalSig= IIf(Buy,1,IIf(Short,-1,0));
AddColumn(PowerSig," Power Signals",1,colorWhite,IIf(PB_1 OR PB_2 OR PB_3,colorDarkGreen,IIf(PS_1 OR PS_2 OR PS_3,colorDarkRed,colorWhite)));
AddColumn(NormalSig," Normal Signals",1,colorWhite,IIf(NormalBuy,colorGreen,IIf(NormalShort,colorRed,colorWhite)));
_SECTION_END();
Last edited by a moderator: