Monday, 25 August 2014
Pride System AFL For Amibroker
SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkColor(ParamColor("Outer panel",colorBlack));
SetChartBkGradientFill( ParamColor("Inner panelupper",colorDarkGreen), ParamColor("Inner panel lower",colorTan));
Plot(C,"Price",IIf(O>C,32,34),64);
SetBarFillColor(IIf(O>C,24,19));
_SECTION_BEGIN("MID MA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 100, 2, 400, 1 );
Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style", styleLine | styleNoLabel ) | styleNoRescale );
_SECTION_END();
_SECTION_BEGIN("Long MA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 200, 2, 400, 1 );
Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style", styleLine | styleNoLabel ) | styleNoRescale );
_SECTION_END();
_SECTION_BEGIN("BBands");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 100, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorLightGrey );
Style = ParamStyle("Style", styleLine | styleNoLabel ) | styleNoRescale;;
Plot( bbt = BBandTop( P, Periods, Width ), "BBTop" + _PARAM_VALUES(), Color, Style );
Plot( bbb = BBandBot( P, Periods, Width ), "BBBot" + _PARAM_VALUES(), Color, Style );
PlotOHLC( bbt, bbt, bbb, bbb, "", ColorBlend( Color, colorDarkGrey, 0.9 ), styleNoLabel | styleCloud | styleNoRescale, Null, Null, Null, -1 );
_SECTION_END();
_SECTION_BEGIN("Magnified Price");
FS=Param("Font Size",15,11,100,1);
GfxSelectFont("Times New Roman", FS, 700, True );
GfxSetBkMode( colorWhite );
GfxSetTextColor( ParamColor("Color",colorYellow) );
Hor=Param("Horizontal Position",500,1,1200,1);
Ver=Param("Vertical Position",1,1,830,1);
GfxTextOut(""+C, Hor , Ver );
YC=TimeFrameGetPrice("C",inDaily,-1);
DD=Prec(C-YC,2);
xx=Prec((DD/YC)*100,2);
GfxSelectFont("Times New Roman", 11, 700, True );
GfxSetBkMode( colorWhite );
GfxSetTextColor(ParamColor("Color",colorYellow) );
GfxTextOut(""+DD+" ("+xx+"%)", Hor , Ver+20 );
_SECTION_END();
_SECTION_BEGIN("5DMA - Stop & Reverse");
FS=Param("Font Size",15,11,100,1);
GfxSelectFont("Times New Roman", FS, 700, True );
GfxSetBkMode( colorWhite );
GfxSetTextColor( ParamColor("Color",colorYellow) );
Hor=Param("Horizontal Position",700,1,1200,1);
Ver=Param("Vertical Position",1,1,830,1);
TC=TimeFrameGetPrice("C",inDaily,0);
YYC=TimeFrameGetPrice("C",inDaily,-1);
DFYC=TimeFrameGetPrice("C",inDaily,-2);
DFYC1=TimeFrameGetPrice("C",inDaily,-3);
DFYC2=TimeFrameGetPrice("C",inDaily,-4);
SAR1=Prec((TC+YYC+DFYC+DFYC1+DFYC2)/5,5);
GfxTextOut("SAR="+SAR1, Hor , Ver );
SaaR = ParamToggle("SAR","Show|Hide",1);
if(SaaR==1)
{
Plot (SAR1,"",colorYellow,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
}
_SECTION_END();
_SECTION_BEGIN("Pride System");
periods = Param( "Periods", 8, 1, 200, 1 );
Ksmooth = Param( "%K avg", 4, 1, 200, 1 );
Dsmooth = Param( "%D avg", 3, 1, 200, 1 );
TimeFrameSet(in1Minute * 30);
k30 = StochK( periods , Ksmooth);
d30 = StochD( periods , Ksmooth, DSmooth );
TimeFrameRestore();
K = TimeFrameExpand(k30, in1Minute * 30);
D = TimeFrameExpand(d30, in1Minute * 30);
Hi = IIf(k > d, k, d);
Lo = IIf(k < d, k, d);
periods1 = Param( "Periods1", 8, 1, 200, 1 );
Ksmooth1 = Param( "%K avg", 4, 1, 200, 1 );
Dsmooth1 = Param( "%D avg", 3, 1, 200, 1 );
U = StochK( periods1 , Ksmooth1);
T = StochD( periods1 , Ksmooth1, DSmooth1 );
x = EMA(Close,5);
y = EMA(Close,13);
Buy=((K > D) AND (U > T) AND (U < 75 AND T < 75) AND (x>=y));
Sell=Cross(T,U) OR (T>=U);
Longa = Flip(Buy,Sell);
shrta = Flip(Sell,Buy);
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
Filter = Buy OR Sell;
AddTextColumn(FullName(),"Name");
AddColumn( Buy, "BUY" );
AddColumn( Sell, "SELL" );
t1= Flip(Buy,Sell);
t2= Flip(Sell,Buy);
BPrice=ValueWhen(t1 AND Ref(t1,-1)==0,C,1);
SPrice=ValueWhen(t2 AND Ref(t2,-1)==0,C,1);
Short=((D > K) AND (T > U) AND (U > 25 AND T > 25) AND (y>=x));
Cover=Cross(U,T) OR (T<=U);
Short = ExRem(Short,Cover);
Cover = ExRem(Cover,Short);
PlotShapes(IIf(Short, shapeHollowSmallCircle, shapeNone),colorYellow, 0,H, Offset=30);
PlotShapes(IIf(Cover, shapeHollowSmallSquare, shapeNone),colorBrightGreen, 0,L, Offset=-30);
GraphXSpace = 5;
AlertIf( Short, "SOUND C:\\Windows\\Media\\Ringin.wav", "Audio alert", 2 );
AlertIf( Cover, "SOUND C:\\Windows\\Media\\Ringin.wav", "Audio alert", 2 );
dist = 2*ATR(10);
dist1 = 3*ATR(10);
for( i = 0; i < BarCount; i++ )
{
if( Buy[i] )
{
BuyStop2 = L[i]*0.9975;
BuyTP1 = L[i]*1.005;
GfxSetOverlayMode( mode = 0 );
GfxSelectPen( colorBlue, 3 );
GfxSelectSolidBrush( colorWhite );
GfxRoundRect( 05, 210, 185, 265, 15, 15 );
GfxSetBkMode(1);
GfxSelectFont( "Arial", 10, 700, False );
GfxSetTextColor( colorDarkBlue );
GfxSetTextAlign(0);
GfxTextOut( WriteIf(L[ i ], "Buy Above: "+L[ i ],""), 30, 215);
GfxTextOut( WriteIf(BuyTP1, "Buy Target: "+(BuyTP1),""), 30, 230);
GfxTextOut( WriteIf(BuyStop2, "Long SL: "+(BuyStop2),""), 30, 245);
}
if( Sell[i] )
{
SellStop2 = H[i]*1.0025;
SellTP1 = H[i]*0.995;
GfxSetOverlayMode( mode = 0 );
GfxSelectPen( colorRed, 3 );
GfxSelectSolidBrush( colorPink );
GfxRoundRect( 05, 210, 185, 265, 15, 15 );
GfxSetBkMode(1);
GfxSelectFont( "Arial", 10, 700, False );
GfxSetTextColor( colorYellow );
GfxSetTextAlign(0);
GfxTextOut( WriteIf(H[ i ], "Sell Below: "+H[ i ],""), 30, 215);
GfxTextOut( WriteIf(SellTP1, "Short Target: "+(SellTP1),""), 30, 230);
GfxTextOut( WriteIf(SellStop2, "Short SL: "+(SellStop2),""), 30, 245);
}
}
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=10);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=20);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-15);
AlertIf( Buy, "SOUND C:\\Windows\\Media\\Ringin.wav", "Audio alert", 2 );
AlertIf( Sell, "SOUND C:\\Windows\\Media\\Ringin.wav", "Audio alert", 2 );
_SECTION_END();
_SECTION_BEGIN("Signal Panel");
no=10;
res=HHV(H,no);
sup=LLV(L,no);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
s5d=IIf(avn==1,sup,res);
showsl = ParamToggle("Stop Loss Line", "Show|Hide", 0);
if (showsl == 1)
{Plot(s5d,"Stop Loss",colorCustom14,styleDots);}
exitlong = Cross(s5d, H);
PlotShapes(exitlong * shapeNone, colorBlack,0,H,-10);
exitshort = Cross(L, s5d);
PlotShapes(exitshort * shapeNone, colorBlack,0,L,-15);
Buy = exitshort;
Sell = exitlong;
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
AlertIf( Buy, "", "BUY @ " + C, 1 );
AlertIf( Sell, "", "SELL @ " + C, 2 );
for(i=BarCount-1;i>1;i--)
{
if(Buy[i] == 1)
{
entry = C[i];
sig = "BUY";
sl = s5d[i];
tar1 = entry + (entry * .0050);
tar2 = entry + (entry * .0092);
tar3 = entry + (entry * .0179);
bars = i;
i = 0;
}
if(Sell[i] == 1)
{
sig = "SELL";
entry = C[i];
sl = s5d[i];
tar1 = entry - (entry * .0050);
tar2 = entry - (entry * .0112);
tar3 = entry - (entry * .0212);
bars = i;
i = 0;
}
}
Offset = 20;
Clr = IIf(sig == "BUY", colorLime, colorRed);
ssl = IIf(bars == BarCount-1, s5d[BarCount-1], Ref(s5d, -1));
sl = ssl[BarCount-1];
Plot(LineArray(bars-Offset, tar1, BarCount, tar1,1), "", Clr, styleLine|styleDots, Null, Null, Offset);
Plot(LineArray(bars-Offset, tar2, BarCount, tar2,1), "", Clr, styleLine|styleDots, Null, Null, Offset);
Plot(LineArray(bars-Offset, tar3, BarCount, tar3,1), "", Clr, styleLine|styleDots, Null, Null, Offset);
Plot(LineArray(bars-Offset, sl, BarCount, sl,1), "", colorDarkRed, styleLine|styleLine, Null, Null, Offset);
Plot(LineArray(bars-Offset, entry, BarCount, entry,1), "", colorGreen, styleLine|styleLine, Null, Null, Offset);
for (i=bars; i <BarCount;i++)
{
PlotText(""+sig+"@"+entry, BarCount+1,entry,Null,colorBlue);
PlotText("T1@"+tar1,BarCount+3,tar1,Null,Clr);PlotText("T2@"+tar2,BarCount+3,tar2,Null,Clr);PlotText ("T3@"+tar3,BarCount+3,tar3,Null,Clr);
}
_SECTION_BEGIN("VSA by Mr.Karthik");
DTL=Param("Linear regression period",60,10,100,10);
wbf=Param("WRB factor",1.5,1.3,2.5,.1);
nbf=Param("NRB factor",0.7,0.3,0.9,0.1);
TL=LinRegSlope(MA(C, DTL),2);
Vlp=Param("Volume lookback period",30,20,300,10);
Vrg=MA(V,Vlp);
St = StDev(Vrg,Vlp);
Vp3 = Vrg + 3*st;
Vp2 = Vrg + 2*st;;
Vp1 = Vrg + 1*st;;
Vn1 = Vrg -1*st;
Vn2 = Vrg -2*st;
rg=(H-L);
arg=Wilders(rg,30);
wrb=rg>(wbf*arg);
nrb=rg<(nbf*arg);
Vl=V<Ref(V,-1) AND V<Ref(V,-2);
upbar=C>Ref(C,-1);
dnbar=C<Ref(C,-1);
Vh=V>Ref(V,-1) AND Ref(V,-1)>Ref(V,-2);
Cloc=C-L;
x=rg/Cloc;
x1=IIf(Cloc==0,arg,x);
Vb=V>Vrg OR V>Ref(V,-1);
ucls=x1<2;
dcls=x1>2;
mcls=x1<2.2 AND x1>1.8 ;
Vlcls=x1>4;
Vhcls=x1<1.35;
j=MA(C,5);
TLL=LinRegSlope(j,40) ;
Tlm=LinRegSlope(j,15) ;
tls=LinRegSlope(j,5);
mp=(H+L)/2;
Pp1=Param("NumberOfDays",30,1,200,1);
Pp2=Param("VolOfDays",15,1,200,1);
numDays = Pp1;
dwWideSpread = 1.8;
dwNarrowSpread = 0.8;
dwSpreadMiddle = 0.5;
dwHighClose = 0.7;
dwLowClose = 0.3;
volNumDays = Pp2;
dwUltraHighVol = 2;
dwVeryHighVol = 1.75; // was 1.8
dwHighVol = 1.75; // was 1.8
dwmoderateVol = 1.10; // was 1.8
dwLowVol = 0.75; // was 0.8
upBar = C > Ref(C,-1);
downBar = C < Ref(C,-1);
spread = H-L;
avgRange = Sum(spread, numDays) / numDays;
wideRange = spread >= (dwWideSpread * avgRange);
narrowRange = spread <= (dwNarrowSpread * avgRange);
testHighClose = L + (spread * dwHighClose);
testLowClose = L + (spread * dwLowClose);
testCloseMiddle = L + (spread * dwSpreadMiddle);
upClose = C > testHighClose;
downClose = C < testLowClose;
middleClose = C >= testLowClose AND C <= testHighClose;
avgVolume = EMA(V, volNumDays);
highVolume = V > (avgVolume * dwHighVol);
moderateVol= V > (avgVolume * dwmoderateVol);
veryHighVolume = V > (avgVolume * dwVeryHighVol);
ultraHighVolume = V > (avgVolume * dwUltraHighVol);
LowVolume = V < (avgVolume * dwLowVol);
upThrustBar = downClose AND H > Ref(H,-1) AND (C == L) AND downClose AND (NOT narrowRange);
noDemandBar = narrowRange AND LowVolume AND upBar AND (NOT upClose);
noSupplyBar = narrowRange AND LowVolume AND downBar AND (V < Ref(V,-1)) AND (V < Ref(V,-2));
absorption = Ref(downbar, -1) AND Ref(highVolume, -1) AND upBar;
support = Ref(downBar,-1) AND (NOT Ref(downClose,-1)) AND Ref(highVolume,-1) AND upBar;
stoppingVolume = Ref(downBar,-1) AND Ref(highVolume,-1) AND C > testCloseMiddle AND (NOT downBar);
bullishsign=moderateVol+UpThrustBar;
weakness = upThrustBar OR noDemandBar OR (narrowRange AND (H > Ref(H,-1)) AND highVolume) OR (Ref(highVolume,-1) AND Ref(upBar,-1) AND downBar AND (H < Ref(H,-1)));
C1 = Ref(C, -1);
uc = C > C1; dc = C <= C1;
ud = C > O; dd = C <= O;
green = 1; blue = 2; yellow = 3; red = 4; white = 5;
VType = IIf(ud, IIf(uc, green, yellow), IIf(dd,IIf(dc, red, blue), white));
gv = IIf(VType == green, V, 0);
yv = IIf(VType == yellow, V, 0);
rv = IIf(VType == red, V, 0);
bv = IIf(VType == blue, V, 0);
uv = gv + bv; uv1 = Ref(uv, -1);
dv = rv + yv; dv1 = Ref(dv, -1);
VolPer = Param("Adjust Vol. MA per.", 34, 1, 255, 1);
ConvPer = Param("Adjust Conv. MA per.", 9, 1, 255, 1);
MAuv = TEMA(uv, VolPer ); mauv1 = Ref(mauv, -1);
MAdv = TEMA(dv, VolPer ); madv1 = Ref(madv, -1);
MAtv = TEMA(V, VolPer );
OscillatorOnly = Param("Show Oscillator Only", 0, 0, 1, 1);
CompareBullVolume = Param("Show Bull Level", 1, 0, 1, 1);
if(CompareBullvolume AND !OscillatorOnly){
}
CompareBearVolume = Param("Show Bear Level", 1, 0, 1, 1);
if(CompareBearVolume AND !OscillatorOnly){
}
bullvolume = Param("Show Bull Volume", 1, 0, 1, 1);
bearvolume = Param("Show Bear Volume", 1, 0, 1, 1);
totalvolume = Param("Show Total Volume", 1, 0, 1, 1);
bearToFront = Param("Show Bear Vol in Front", 0, 0, 1, 1);
if(bearToFront AND !OscillatorOnly){
}
if(bullvolume AND !OscillatorOnly){
}
if(bearvolume AND !OscillatorOnly){
}
if(totalVolume AND !OscillatorOnly){
}
if(bullvolume AND !OscillatorOnly){
}
if(bearvolume AND !OscillatorOnly){
}
Converge = (TEMA(MAuv - MAdv, ConvPer));
Converge1 = Ref(Converge, -1);
ConvergeUp = Converge > Converge1;
ConvergeOver = Converge > 0;
rising = ConvergeUp AND ConvergeOver;
falling = !ConvergeUp AND ConvergeOver;
convergenceOscillator = Param("Show Oscillator", 0, 0, 1, 1);
if(convergenceOscillator OR OscillatorOnly){
}
riseFallColor = IIf(rising, 14,15);
riseFallShadows = Param("Show RiseFallShadows", 0, 0, 1, 1);
if(riseFallShadows){
}
_SECTION_END();
_SECTION_BEGIN("GANN Levels");
Op=TimeFrameGetPrice("O",inDaily,0);
order=Param("Order",0.15,0.001,0.1,sincr = 0);
level1 = 1.25;
level2 = 2.50;
level3 = 3.33;
level4 = 5;
level5 = 6.66;
level6 = 7.5;
level7 = 10;
level1 = level1 * order;
level2 = level2 * order;
level3 = level3 * order;
level4 = level4 * order;
level5 = level5 * order;
level6 = level6 * order;
level7 = level7 * order;
bAboveI=(sqrt(Op)+level1)*(sqrt(Op)+level1);
bAbove = round(bAboveI);
sBelowI=(sqrt(Op)-level1)*(sqrt(Op)-level1);
sBelow = round(sBelowI);
Sstop= bAbove ;
Bstop= sBelow ;
BTgt1 = round((sqrt(Op)+level2)*(sqrt(Op)+level2));
BTgt2 = round((sqrt(Op)+level3)*(sqrt(Op)+level3));
BTgt3 = round((sqrt(Op)+level4)*(sqrt(Op)+level4));
BTgt4 = round((sqrt(Op)+level5)*(sqrt(Op)+level5));
BTgt5 = round((sqrt(Op)+level6)*(sqrt(Op)+level6));
BTgt6 = round((sqrt(Op)+level7)*(sqrt(Op)+level7));
STgt1 = round((sqrt(Op)-level2)*(sqrt(Op)-level2));
STgt2 = round((sqrt(Op)-level3)*(sqrt(Op)-level3));
STgt3 = round((sqrt(Op)-level4)*(sqrt(Op)-level4));
STgt4 = round((sqrt(Op)-level5)*(sqrt(Op)-level5));
STgt5 = round((sqrt(Op)-level6)*(sqrt(Op)-level6));
STgt6 = round((sqrt(Op)-level7)*(sqrt(Op)-level7));
GfxSetBkMode( 1 );
GfxSelectFont("Arial", 9, 900 );
GfxSetTextColor( colorYellow );
GfxSelectPen( colorBlack, 1, 0) ;
GfxSelectSolidBrush( colorBlue );
BTgtext = "Buy Targets : " + NumToStr(btgt1,1.2,False) + " - " + NumToStr(btgt2,1.2,False) + " - " + NumToStr(btgt3,1.2,False)+ " - " + NumToStr(btgt4,1.2,False) + " - " + NumToStr(btgt5,1.2,False) + " - " + NumToStr(btgt6,1.2,False);
STgtext = "Short Targets : " + NumToStr(stgt1,1.2,False) + " - " + NumToStr(stgt2,1.2,False) + " - " + NumToStr(stgt3,1.2,False)+ " - " + NumToStr(stgt4,1.2,False) + " - " + NumToStr(stgt5,1.2,False) + " - " + NumToStr(stgt6,1.2,False);
GfxTextOut("Buy Above : " + WriteIf(TimeNum()>092900, NumToStr(bAbove,1.2,False) + " SL : " + NumToStr(sBelow,1.2,False),"Waiting for Signal"), 10, 270);
GfxTextOut(WriteIf(TimeNum()>092900,BTgtext,""), 10, 285);
GfxSetBkMode( 1 );
GfxSelectFont("Arial", 9, 900 );
GfxSetTextColor( colorBlack );
GfxSelectPen( colorBlack, 1, 0) ;
GfxSelectSolidBrush( colorBlue );
GfxTextOut("Short Below : " + WriteIf(TimeNum()>092900, NumToStr(sBelow,1.2,False) + " SL : " + NumToStr(bAbove,1.2,False),"Waiting for Signal"), 10, 305);
GfxTextOut(WriteIf(TimeNum()>092900,STgtext,""), 10, 320);
BuySignal = (Cross(H,babove)OR Cross(C,babove) OR (H>babove AND L<=babove)) AND Op<babove ;
ShortSignal = (Cross(Sbelow,L) OR Cross(Sbelow,C) OR (H>=sbelow AND L<sbelow))AND Op>sbelow ;
BuySignal = ExRem(BuySignal,ShortSignal);
ShortSignal = ExRem(ShortSignal,BuySignal);
ShortProfitStop= (STgt1 AND L<=Stgt1 AND C>Stgt1) OR (STgt2 AND L<=Stgt2 AND C>Stgt2) OR (STgt3 AND L<=Stgt3 AND C>Stgt3) OR (STgt4 AND L<=Stgt4 AND C>Stgt4) OR (STgt5 AND L<=Stgt5 AND C>Stgt5) OR (STgt6 AND L<=Stgt6 AND C>Stgt6);
BuyProfitStop= (Btgt1 AND H>=btgt1 AND C<Btgt1) OR (Btgt2 AND H>=Btgt2 AND C<btgt2) OR (Btgt3 AND H>=Btgt3 AND C<btgt3) OR (Btgt4 AND H>=Btgt4 AND C<btgt4) OR (Btgt5 AND H>=Btgt5 AND C<btgt5) OR (Btgt6 AND H>=Btgt6 AND C<btgt6);
SetOption("MaxOpenPositions", 1 );
SetPositionSize(100,spsShares);
AlertIf( Buy, "", "BUY @ " + C, 1 );
AlertIf( Sell, "", "SELL @ " + C, 2 );
numbars = LastValue(Cum(Status("barvisible")));
hts = -33.5;
gl = ParamToggle("GANN Levels","Show|Hide",0);
if(gl==1) {
Plot(sstop,"BUY Zone",colorDarkGreen,styleDots|styleNoLine|styleNoRescale|styleNoTitle );
Plot(bstop,"SELL Zone",colorDarkRed,styleDots|styleNoLine|styleNoRescale|styleNoTitle );
Plot(BTgt1,"BUY TGT1",colorOrange,styleDots|styleNoLine|styleNoRescale|styleNoTitle );
Plot(BTgt2,"BUY TGT2",colorOrange,styleDots|styleNoLine|styleNoRescale|styleNoTitle );
Plot(BTgt3,"BUY TGT3",colorOrange,styleDots|styleNoLine|styleNoRescale|styleNoTitle );
Plot(BTgt4,"BUY TGT4",colorOrange,styleDots|styleNoLine|styleNoRescale|styleNoTitle );
Plot(BTgt5,"BUY TGT5",colorOrange,styleDots|styleNoLine|styleNoRescale|styleNoTitle );
Plot(BTgt6,"BUY TGT6",colorOrange,styleDots|styleNoLine|styleNoRescale|styleNoTitle );
Plot(STgt1,"SELL TGT1",colorLime,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(STgt2,"SELL TGT1",colorLime,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(STgt3,"SELL TGT1",colorLime,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(STgt4,"SELL TGT1",colorLime,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(STgt5,"SELL TGT1",colorLime,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(STgt6,"SELL TGT1",colorLime,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
PlotText(" BUY Zone" , LastValue(BarIndex())-(numbars/Hts), LastValue(sstop,1), colorDarkGreen);
PlotText(" SELL Zone" , LastValue(BarIndex())-(numbars/Hts), LastValue(bstop,1), colorDarkRed);
PlotText(" BUY TGT1" , LastValue(BarIndex())-(numbars/Hts), LastValue(BTgt1,1), colorOrange);
PlotText(" BUY TGT2" , LastValue(BarIndex())-(numbars/Hts), LastValue(BTgt2,1), colorOrange);
PlotText(" BUY TGT3" , LastValue(BarIndex())-(numbars/Hts), LastValue(BTgt3,1), colorOrange);
PlotText(" BUY TGT4" , LastValue(BarIndex())-(numbars/Hts), LastValue(BTgt4,1), colorOrange);
PlotText(" BUY TGT5" , LastValue(BarIndex())-(numbars/Hts), LastValue(BTgt5,1), colorOrange);
PlotText(" BUY TGT6" , LastValue(BarIndex())-(numbars/Hts), LastValue(BTgt6,1), colorOrange);
PlotText(" SELL TGT1" , LastValue(BarIndex())-(numbars/Hts), LastValue(STgt1,1), colorLime);
PlotText(" SELL TGT2" , LastValue(BarIndex())-(numbars/Hts), LastValue(STgt2,1), colorLime);
PlotText(" SELL TGT3" , LastValue(BarIndex())-(numbars/Hts), LastValue(STgt3,1), colorLime);
PlotText(" SELL TGT4" , LastValue(BarIndex())-(numbars/Hts), LastValue(STgt4,1), colorLime);
PlotText(" SELL TGT5" , LastValue(BarIndex())-(numbars/Hts), LastValue(STgt5,1), colorLime);
PlotText(" SELL TGT6" , LastValue(BarIndex())-(numbars/Hts), LastValue(STgt6,1), colorLime);
}
_SECTION_END();
_SECTION_BEGIN("Ribbon");
no=Param( "Swing", 10, 1, 55 );
res=HHV(H,no);
sup=LLV(L,no);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
tsl=IIf(avn==1,sup,res);
Plot( 2, "Ribbon",IIf(C>tsl,colorBlue,colorRed),styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
_SECTION_END();
_SECTION_BEGIN("BREAK OUTS");
CodeName = "Joy's Breakouts";
SetFormulaName("Joy's Breakouts");
SetChartOptions(0,chartShowArrows | chartShowDates | chartWrapTitle);
if (ParamToggle("Tooltip shows", "All Values|Only Prices"))
{
ToolTip = StrFormat("Open: %g\nHigh: %g\nLow: %g\nClose: %g (%.1f%%) \nVolume: " + NumToStr(V, 1), O, H, L, C, SelectedValue(ROC(C, 1)));
}
space = Param("Space on Chart", 20, - 15, 50, 1);
GraphXSpace = space;
H0 = H;
L0 = L;
C0 = C;
O0 = O;
Lookback = Param("LookBack", 10, 10, 50, 1);
shift = Param("Shift", 5, 1, 50, 1);
x0 = LastValue(Cum(1));
x1 = x0 - shift;
H = Ref(H, - shift + 1);
L = Ref(L, - shift + 1);
H1 = LastValue(Ref(HHV(H, Lookback), - 1));
L1 = LastValue(Ref(LLV(L, Lookback), - 1));
Plot(H1, "H1", colorYellow);
Plot(L1, "L1", colorYellow);
H = H0;
L = L0;
C = C0;
O = O0;
up = Cross(H, H1)AND Cum(1) > x1;
dn = Cross(L1, L)AND Cum(1) > x1;
Plot(C, "Close", IIf(Cum(1) > x1 - Lookback AND Cum(1) <= x1, colorBlue, IIf(Up, colorBrightGreen, IIf(Dn, colorRed, IIf(C > O, colorGreen, colorRed)))), 64);
PlotShapes(shapeDownArrow *(Cum(1) == x1 + 1), colorBlue);
TRIGGER = ParamToggle("Trigger ", "CLOSE|HIGH OR LOW");
XH1 = Cross(C, H1);
XL1 = Cross(L1, C);
XH2 = Cross(H, H1);
XL2 = Cross(L1, L);
if (TRIGGER == 0)
{
Buy = XH1;
Sell = XL1;
}
else
{
Buy = XH2;
Sell = XL2;
}
TradeDisplay = ParamToggle("Remove Extra Trades?", "No|Yes");
if(TradeDisplay != 0){
Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);
}
Filter = Buy OR Sell;
Action = WriteIf(Buy, "BUY", WriteIf(Sell, "SELL", " "));
AddTextColumn(IndustryID(1), "Industry Sector ", 30.0, colorGold, colorYellow);
AddColumn(C, "Last ", 2.2, colorWhite, colorGold);
AddTextColumn(Action, "Action", 8.0, IIf(XH1, colorDarkGreen, colorDarkRed), colorWhite);
AddColumn(IIf(XH1, H1, L1), "BREAKOUT LEVEL", 3.2, colorYellow, IIf(XH1, colorDarkGreen, colorDarkRed));
_SECTION_END();
_SECTION_BEGIN("Volume At Price");
PlotVAPOverlay(Param("Lines", 1000, 100, 1000, 10), Param("Width", 15, 1, 100, 1), ParamColor("Color", colorGold), ParamToggle("Side", "Left|Right", 1) | 4 *ParamToggle("Z-order", "On top|Behind", 1));
_SECTION_END();
_SECTION_BEGIN("Title");
dec = (Param("Decimals",2,0,7,1)/10)+1;
TimeFrameSet(inDaily);
DayH = LastValue(H);
DayL = LastValue(L);
TimeFrameRestore();
if( Status("action") == actionIndicator )
(Title = EncodeColor(colorYellow)+ "Pride System" + " " + EncodeColor(55)+ Name() + " " + EncodeColor(32) + Date() + " " + EncodeColor(5) + "{{INTERVAL}} " + EncodeColor(55)+ " Volume = "+ EncodeColor(52)+ WriteVal(V,1) + "\n" +
EncodeColor(55)+ "Open = "+ EncodeColor(52)+ WriteVal(O,dec) +
EncodeColor(55)+ " High = "+ EncodeColor(5) + WriteVal(H,dec) +
EncodeColor(55)+ " Low = "+ EncodeColor(32)+ WriteVal(L,dec) +
EncodeColor(55)+ " Close = "+ EncodeColor(52)+ WriteVal(C,dec) + "\n" +
EncodeColor(55)+ "Today`s High= " + EncodeColor(colorBlue) + DayH + EncodeColor(55)+ " Today`s Low= " + EncodeColor(colorBlue) + DayL +"\n"+
EncodeColor(colorPink)+"----------------------------------------"
+"\n"+EncodeColor(07)+"Volume: "+WriteIf(V>Vp2,EncodeColor(colorLime)+"Very High",WriteIf(V>Vp1,EncodeColor(colorLime)+" High",WriteIf(V>Vrg,EncodeColor(colorLime)+"Above Average",
WriteIf(V<Vrg AND V>Vn1,EncodeColor(colorRed)+"Less than Average",WriteIf(V<Vn1,EncodeColor(colorRed)+"Low","")))))
+"\n"+EncodeColor(colorYellow)+"Spread: "+WriteIf(rg >(arg*2),EncodeColor(colorLime)+" Wide",WriteIf(rg>arg,EncodeColor(colorLime)+" Above Average",EncodeColor(colorRed)+" Narrow"))
+"\n"+(EncodeColor(colorYellow)+"Close: ")+WriteIf(Vhcls,EncodeColor(colorLime)+"Very High",WriteIf(ucls,EncodeColor(colorLime)+"High",WriteIf(mcls,EncodeColor(colorYellow)+"Mid",
WriteIf(dcls,EncodeColor(colorRed)+"Down","Very Low"))))
+"\n"+EncodeColor(colorYellow) + "Zone : " +WriteIf(rising , EncodeColor(colorBrightGreen) + "Accumulation",WriteIf(falling , EncodeColor(colorCustom12) + "Distirbution",EncodeColor(colorAqua) + "Flat")) + " "
+"\n"+
EncodeColor(colorYellow) + "Status : " +
WriteIf(Weakness , EncodeColor(colorRed) + "Weak",
WriteIf(stoppingVolume , EncodeColor(colorCustom12) + "StoppingVol",
WriteIf(noSupplyBar , EncodeColor(colorLightOrange) + "NoSupply",
WriteIf(support , EncodeColor(colorLightBlue) + "SupportVol",
WriteIf(noDemandBar , EncodeColor(colorPink) + "NoDemand",
WriteIf(absorption, EncodeColor(colorSkyblue) + "Absorption",
WriteIf(upThrustBar, EncodeColor(colorBlue) + "Upthrust",
WriteIf(bullishsign, EncodeColor(colorPaleGreen) + "STRONG",
EncodeColor(colorTan) + "Neutral")))))))) + " "
+"\n"+EncodeColor(colorPink)+"----------------------------------------"+"\n"+
EncodeColor(colorLime)+WriteIf (Buy , "GO LONG / Reverse Signal at "+C+" ","")+
EncodeColor(colorRed)+WriteIf (Sell , "EXIT LONG / Reverse Signal at "+C+" ","")+"\n"+
EncodeColor(colorWhite)+WriteIf(Sell , "Total Profit/Loss for the Last Trade Rs."+(C-BPrice)+"","")+
WriteIf(Buy , "Total Profit/Loss for the Last trade Rs."+(SPrice-C)+"","")+"\n"+
WriteIf(Longa AND NOT Buy, "Trade : Long - Entry price Rs."+(BPrice),"")+
WriteIf(shrta AND NOT Sell, "Trade : Short - Entry price Rs."+(SPrice),"")+"\n"+
WriteIf(Longa AND NOT Buy, "Current Profit/Loss Rs."+(C-BPrice)+"","")+
WriteIf(shrta AND NOT Sell, "Current Profit/Loss Rs."+(SPrice-C)+"",""));
_SECTION_END();
_SECTION_BEGIN("Linear Regression");
Lrc = ParamToggle("Linear Regression Channel","Show|Hide",0);
if(Lrc==1) {
P = ParamField("Price field",-1);
Length = 150;
Daysback = Param("Period for Liner Regression Line",Length,1,240,1);
shift = Param("Look back period",0,0,240,1);
x = Cum(1);
lastx = LastValue( x ) - shift;
aa = LastValue( Ref(LinRegIntercept( p, Daysback), -shift) );
bb = LastValue( Ref(LinRegSlope( p, Daysback ), -shift) );
y = Aa + bb * ( x - (Lastx - DaysBack +1 ) );
LRColor = ParamColor("LR Color", colorCycle );
LRStyle = ParamStyle("LR Style");
LRLine = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y, Null );
LRStyle = ParamStyle("LR Style");
Angle = Param("Angle", 0.05, 0, 1.5, 0.01);
LRLine = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y, Null );
Pi = 3.14159265 * atan(1); // Pi
SlopeAngle = atan(bb)*(180/Pi);
LineUp = SlopeAngle > Angle;
LineDn = SlopeAngle < - Angle;
if(LineUp)
{
Plot(LRLine, "Lin. Reg. Line Up", IIf(LineUp, colorBrightGreen, colorWhite), LRStyle);
}
else
{
Plot(LRLine, "Lin. Reg. Line Down", IIf(LineDn, colorDarkRed, colorWhite), LRStyle);
}
SDP = Param("Standard Deviation", 1.5, 0, 6, 0.1);
SD = SDP/2;
width = LastValue( Ref(SD*StDev(p, Daysback),-shift) );
SDU = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y+width , Null ) ;
SDL = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y-width , Null ) ;
SDColor = ParamColor("SD Color", colorCycle );
SDStyle = ParamStyle("SD Style");
Plot( SDU , "\nUpper Lin Reg", colorWhite,SDStyle );
Plot( SDL , "Lower Lin Reg", colorWhite,SDStyle );
SDP2 = Param("2d Standard Deviation", 2.0, 0, 6, 0.1);
SD2 = SDP2/2;
width2 = LastValue( Ref(SD2*StDev(p, Daysback),-shift) );
SDU2 = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y+width2 , Null ) ;
SDL2 = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y-width2 , Null ) ;
SDColor2 = ParamColor("2 SD Color", colorCycle );
SDStyle2 = ParamStyle("2 SD Style");
Plot( SDU2 , "Upper Lin Reg", colorWhite,SDStyle2 );
Plot( SDL2 , "Lower Lin Reg", colorWhite,SDStyle2 );
Trend = IIf(LRLine > Ref(LRLine,-1),colorGreen,colorRed);
Plot( LRLine , "LinReg", Trend, LRSTYLE );
}
_SECTION_END();
Subscribe to:
Post Comments (Atom)
Thank you for a wonderful system. Its awesome, gonna try with live session in commodity, if any tips pls. With best wishes and Happy profits day ahead.
ReplyDelete