My afl collection

Status
Not open for further replies.
Nishant Trading System





Code:
_SECTION_BEGIN("INIT");

SetChartOptions(0,chartShowArrows|chartShowDates);
fraction= IIf(StrRight(Name(),3) == "", 3.2, 3.2);
tchoice=Param("Title Selection ",2,1,2,1);
ZigLevel = Param("ZigLevel", 2, 1, 25 );
numbars = LastValue(Cum(Status("barvisible")));
hts = Param ("Text Shift", -33.5,-50,50,0.10);
dec = (Param("Decimals",2,0,7,1)/10)+1;
bi = BarIndex();
Lbi = LastValue(BarIndex());
sbi = SelectedValue(bi); 
ScanLookBack = Param("Scan Lookback", 1, 1, 25 );

_SECTION_END();

_SECTION_BEGIN("Functions");

function Lastthursday() {
Daysinmonth=IIf(Month()==1 OR Month()==3 OR Month()==5 OR Month()==7 OR Month()==8 OR Month()==10 OR Month()==12,31,30);
Daysinmonthfeb=IIf(Year()%4 == 0 AND Year()%100!=0,29,28);
Daysinmonthfinal=IIf(Month()==2,Daysinmonthfeb,Daysinmonth);
returnvalue=IIf(Daysinmonthfinal-Day()<7 AND DayOfWeek()==4,1,0);
return returnvalue;
}

_SECTION_END();

_SECTION_BEGIN("Magnified Market Price");
FS=Param("Font Size",28,11,100,1);
GfxSelectFont("Arial", FS, 700, italic = False, underline = False, True );
GfxSetBkMode( colorBlack );
GfxSetTextColor( ParamColor("Color",colorGreen) );
Hor=Param("Horizontal Position",750,1,1200,1);
Ver=Param("Vertical Position",1,1,1,1);
GfxTextOut(""+C,Hor , Ver );
YC=TimeFrameGetPrice("C",inDaily,-1);
DD=Prec(C-YC,2);
xx=Prec((DD/YC)*100,2);
GfxSelectFont("Arial", 12, 700, italic = False, underline = False, True );
GfxSetBkMode( colorWhite );
GfxSetTextColor(ParamColor("Color",colorViolet) );
GfxTextOut(""+DD+" ("+xx+"%)", Hor+5, Ver+45 );
_SECTION_END();


_SECTION_BEGIN("Price"); 
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " +WriteVal( V, 1.0 ) +" {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )) )); 
Plot( C, _DEFAULT_NAME(), colorBlack , styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
_SECTION_END();


_SECTION_BEGIN("Auto trend line Trendline");

percent = 0.01 * 1; /* Adjust this percent as necessary, */
firstpointL = 2;
firstpointH = 2;

y0=LastValue(Trough(L,percent,firstpointL)); 
y1=LastValue(Trough(Ref(L,-1),percent,1));

for( i = 1; i < BarCount AND y0 >= y1; i++ ){
firstpointL++;
y0=LastValue(Trough(L,percent,firstpointL)); 
}

x0=BarCount - 1 - LastValue(TroughBars(L,percent,firstpointL)); 
x1=BarCount - 1 - LastValue(TroughBars(Ref(L,-1),percent,1)); 
LineL = LineArray( x0, y0, x1, y1, 1 );
//Plot( LineL, "Support", colorGreen,styleLine | styleDots | styleNoTitle | styleNoRescale);
yt0=LastValue(Peak(H,percent,firstpointH)); 
yt1=LastValue(Peak(Ref(H,-1),percent,1));

for(i = 1; i < BarCount AND yt0 <= yt1; i++ ) {
firstpointH++;
yt0=LastValue(Peak(H,percent,firstpointH)); 
}
xt0=BarCount - 1 - LastValue(PeakBars(H,percent,firstpointH)); 
xt1=BarCount - 1 - LastValue(PeakBars(Ref(H,-1),percent,1));
LineH = LineArray( xt0, yt0, xt1, yt1, 1 );
//Plot( LineH, "Resistance", colorBrown,styleLine | styleDots | styleNoTitle | styleNoRescale);
ATBuy = Cross(C,LineH);
ATShort = Cross(LineL,C);
//PlotShapes(ATBuy * shapeUpTriangle , colorBlue,0,L);
//PlotShapes(ATShort * shapeDownTriangle , colorRed,0,H);
_SECTION_END();


_SECTION_BEGIN("NW");
k = Param("K", 1.5, 1, 5, 0.1);
Per = Param("ATR", 14, 1, 30, 0.50);
j=Close;
f=ATR(Per );
rfsctor = WMA(H-L, Per);
revers = k * rfsctor;
Trend = 1;
NW[0] = 0;
for(i = 1; i < BarCount; i++) {
if(Trend[i-1] == 1) {
if(j[i] < NW[i-1]) {
Trend[i] = -1;
NW[i] = j[i] + Revers[i];
}
else {
Trend[i] = 1;
if((j[i] - Revers[i]) > NW[i-1]) {
NW[i] = j[i] - Revers[i];
}
else {
NW[i] = NW[i-1];
}
}
}
if(Trend[i-1] == -1) {
if(j[i] > NW[i-1]) {
Trend[i] = 1;
NW[i] = j[i] - Revers[i];
}
else {
Trend[i] = -1;
if((j[i] + Revers[i]) < NW[i-1]) {
NW[i] = j[i] + Revers[i];
}
else {
NW[i] = NW[i-1];
}
}
}
}

Plot(NW, "", IIf(Trend == 1, 27, 4), styleStaircase | styleNoRescale);
NMBuy = NMCover = Cross(j,nw);
NMSell = NMShort = Cross(nw,j);
baratnwbuy = LastValue(ValueWhen((NMBuy ) ,BarIndex())) ;
baratnwshort = LastValue(ValueWhen((NMShort ) ,BarIndex())) ;

shape = NMBuy * shapeSmallUpTriangle+ NMSell * shapeSmallDownTriangle;
PlotShapes( shape, IIf( NMBuy, colorBlue, colorRed ), 0, IIf( NMBuy, L, H));

_SECTION_END();



_SECTION_BEGIN("NAME");

GfxSetOverlayMode(0);
GfxSelectFont("Arial", Status("pxheight")/28 );
GfxSetTextAlign( 6 );// center alignment
GfxSetTextColor( ColorHSB( 42, 42, 42 ) );
GfxSetBkMode(0); // transparent
GfxTextOut( Name(), Status("pxwidth")/2, Status("pxheight")/12 );
GfxSelectFont("Tahoma", Status("pxheight")/30 );
Title = EncodeColor(colorBlue)+""+EncodeColor(colorBlack)+Title ;
_SECTION_END();

GraphXSpace = 10 ;

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

ParamColor("BgBottom", colorLightGrey),ParamColor("titleblock",colorYellow));
_SECTION_END();






Hi shivagi,
again many thanks to you and khushiji, for providing the best AFLs.

I request you, if you can put the buy,sell,short,cover variable in this system (nishant Trading System). It would be benefit us to backtest it.

thanks again
 

shivangi77

Well-Known Member
Peak System(ATR based)




works well to short, go for blue signals !


Code:
_SECTION_BEGIN("Chaloke.com Peak");
PctVlt=(ATR(14)/C)*100;//PercentVolatility 
 
PK=IIf(PctVlt<0.5,Peak(Close,0.5,1), 
IIf( PctVlt>=0.5 AND PctVlt< 1.0 ,Peak(Close,0.70,1), 
IIf( PctVlt>=1.0 AND PctVlt< 1.5 ,Peak(Close,0.90,1), 
IIf( PctVlt>=1.5 AND PctVlt< 2.0 ,Peak(Close,1.10,1), 
IIf( PctVlt>=2.0 AND PctVlt< 2.5 ,Peak(Close,1.30,1), 
IIf( PctVlt>=2.5 AND PctVlt< 3.0 ,Peak(Close,1.50,1), 
IIf( PctVlt>=3.0 AND PctVlt< 3.5 ,Peak(Close,1.70,1), 
IIf( PctVlt>=3.5 AND PctVlt< 4.0 ,Peak(Close,2.00,1), 
Peak(Close,2.20,1) )))))))); 
 
TGH=IIf(PctVlt<0.5,Trough(Close,0.5,1), 
IIf( PctVlt>=0.5 AND PctVlt< 1.0 ,Trough(Close,0.75,1), 
IIf( PctVlt>=1.0 AND PctVlt< 1.5 ,Trough(Close,1.00,1), 
IIf( PctVlt>=1.5 AND PctVlt< 2.0 ,Trough(Close,1.25,1), 
IIf( PctVlt>=2.0 AND PctVlt< 2.5 ,Trough(Close,1.50,1), 
IIf( PctVlt>=2.5 AND PctVlt< 3.0 ,Trough(Close,1.75,1), 
IIf( PctVlt>=3.0 AND PctVlt< 3.5 ,Trough(Close,2.00,1), 
IIf( PctVlt>=3.5 AND PctVlt< 4.0 ,Trough(Close,2.25,1), 
Trough(Close,2.50,1) )))))))); 
 
Sens=IIf(PctVlt<0.5,0.5, 
IIf( PctVlt>=0.5 AND PctVlt< 1.0 ,0.75, 
IIf( PctVlt>=1.0 AND PctVlt< 1.5 ,1.00, 
IIf( PctVlt>=1.5 AND PctVlt< 2.0 ,1.25, 
IIf( PctVlt>=2.0 AND PctVlt< 2.5 ,1.50, 
IIf( PctVlt>=2.5 AND PctVlt< 3.0 ,1.75, 
IIf( PctVlt>=3.0 AND PctVlt< 3.5 ,2.00, 
IIf( PctVlt>=3.5 AND PctVlt< 4.0 ,2.25, 
2.50 )))))))); 
 
 
Color=IIf(BarsSince(Cross(C,Ref(PK,-1)))<BarsSince(Cross(Ref(TGH,-1),C)),colorBrightGreen,colorRed); 
 
Plot(C,"Chaloke.com Peak-Trough",Color,styleCandle); 
PlotShapes( Cross(C,Ref(PK,-1))*shapeUpArrow,colorYellow,0,L); 
PlotShapes( Cross(Ref(TGH,-1),C)*shapeDownArrow,colorPink,0,H); 
PlotShapes( Cross(70,RSI(14))*shapeDownArrow,colorWhite,0,H,Offset=-28 ); 
 
///// Trailing Stop Module ///// 
 
P6=Param("Trailing Stop Risk",2.5,2,3.5,0.1); 
P7=Param("Trailing Stop LookBack",14,5,25,1); 
P8=Param("Trailing Stop PrevLow Switch",0,0,1,1); 
PrevLow=IIf(P8==1, Ref(C,-TroughBars(C,5,1)) ,Null); 
Plot(PrevLow,"",colorRed); 
 
//Position sizing// 
MyTotalPort = Param("MyTotalPort",1000000,10000,10000000,100000); 
AcceptableRisk = Param("AcceptableRisk",0.5,0.1,3,0.1); 
BarsFromStart = BarsSince(Cross(C,Ref(PK,-1))AND Ref(Color,-1)==colorRed) ; 
InitialStopLoss =Ref( H - P6*ATR(P7),-BarsFromStart); 
PositionSizing = 0.01*AcceptableRisk*MyTotalPort/( C - InitialStopLoss ); 
 
Plot(IIf( HHV(H - P6*ATR(P7),BarsFromStart+1) <C ,HHV(H - P6*ATR(P7),BarsFromStart+1),Null) ,"",colorBlue,1); 
PlotShapes(shapeDownArrow*Cross(Ref(HHV(H - P6*ATR(P7),BarsFromStart+1),-1),C),colorBlue,0,H,Offset=-43); 
Title=Name()+" "+Date()+" "+EncodeColor(colorYellow)+"Chaloke.com Peak-Trough System"+" ( Sens ="+Sens+")"+EncodeColor(colorBrown)+" Vol="+NumToStr(Volume ,1.2)+" "+EncodeColor(10)+"Position Sizing ( " +AcceptableRisk+ "% Risk ) = " + WriteIf(color==colorBrightGreen,NumToStr(PositionSizing ,1.0),"0")+ 
EncodeColor(colorBlue)+"\nO="+O+EncodeColor(colorPink)+" Pk-Tgh Exit"+EncodeColor(colorBlue)+" ATR Trailing Exit"+EncodeColor(colorWhite)+" RSI Exit"+EncodeColor(colorBlack)+" ADX = "+ADX()+EncodeColor(colorBlue)+"\nH="+H+"\nL="+L+"\nClose="+ C+""+"\nchange= "+NumToStr((Ref(C,-1)-Close) ,1.2) + 
" "; 
GraphXSpace=3; 
 
Buy=Cross(C,Ref(PK,-1)); 
Sell=Cross(Ref(TGH,-1),C);
_SECTION_END();
 

shivangi77

Well-Known Member
Candle Identification
(very less help to me, but still if somebody needs)





Code:
_SECTION_BEGIN("Candle Identification");
Plot(C,"",1,64);
O1 = Ref(O,-1);O2 = Ref(O,-2);
H1 = Ref(H,-1);H2 = Ref(H,-2);
L1 = Ref(L,-1);L2 = Ref(L,-2);
C1 = Ref(C,-1);C2 = Ref(C,-2);
function CandlePattern(P)
   {
   global PatternName;
   if(P == 0) { PatternName = "NearDoji"; Pv = (abs(O-C)<= ((H-L)*0.1)); }
   else if(P == 1) { PatternName = "BlackCandle"; Pv = (O>C); }
   else if(P == 2) { PatternName = "LongBlackCandle"; Pv = (O>C AND (O-C)/(.001+H-L)>.6); }
   else if(P == 3) { PatternName = "SmallBlackCandle"; Pv = ((O>C) AND ((H-L)>(3*(O-C)))); }
   else if(P == 4) { PatternName = "WhiteCandle"; Pv = (C>O); }
   else if(P == 5) { PatternName = "LongWhiteCandle"; Pv = ((C>O) AND ((C-O)/(.001+H-L)>.6)); }
   else if(P == 6) { PatternName = "SmallWhiteCandle"; Pv = ((C>O) AND ((H-L)>(3*(C-O)))); }
   else if(P == 7) { PatternName = "BlackMarubozu"; Pv = (O>C AND H==O AND C==L); }
   else if(P == 8) { PatternName = "WhiteMarubozu"; Pv = (C>O AND H==C AND O==L); }
   else if(P == 9) { PatternName = "BlackClosingMarubozu"; Pv = (O>C AND C==L); }
   else if(P == 10) { PatternName = "WhiteClosingMarubozu"; Pv = (C>O AND C==H); }
   else if(P == 11) { PatternName = "BlackOpeningMarubozu";Pv = (O>C AND O==H); }
   else if(P == 12) { PatternName = "WhiteOpeningMarubozu"; Pv = (C>O AND O==L); }
   else if(P == 13) { PatternName = "HangingMan"; Pv = (((H-L)>4*(O-C)) AND ((C-L)/(.001+H-L)>= 0.75) AND ((O-L)/(.001+H-L)>= 0.75)); }
   else if(P == 14) { PatternName = "Hammer"; Pv = (((H-L)>3*(O-C)) AND ((C-L)/(.001+H-L)>0.6) AND ((O-L)/(.001+H-L)>0.6)); }
   else if(P == 15) { PatternName = "InvertedHammer"; Pv = (((H-L)>3*(O-C)) AND ((H-C)/(.001+H-L)>0.6) AND ((H-O)/(.001+H-L)>0.6)); }
   else if(P == 16) { PatternName = "ShootingStar"; Pv = (((H-L)>4*(O-C)) AND ((H-C)/(.001+H-L)>= 0.75) AND ((H-O)/(.001+H-L)>= 0.75)); }
   else if(P == 17) { PatternName = "BlackSpinningTop"; Pv = ((O>C) AND ((H-L)>(3*(O-C))) AND (((H-O)/(.001+H-L))<.4) AND (((C-L)/(.001+H-L))<.4)); }
   else if(P == 18) { PatternName = "WhiteSpinningTop"; Pv = ((C>O) AND ((H-L)>(3*(C-O))) AND (((H-C)/(.001+H-L))<.4) AND (((O-L)/(.001+H-L))<.4)); }
   else if(P == 19) { PatternName = "BearishAbandonedBaby"; Pv = ((C1 == O1)AND (C2>O2) AND (O>C) AND (L1>H2) AND (L1>H)); }
   else if(P == 20) { PatternName = "BearishEveningDojiStar"; Pv = ((C2>O2)AND ((C2-O2)/(.001+H2-L2)>.6) AND (C2<O1) AND (C1>O1) AND ((H1-L1)>(3*(C1-O1))) AND (O>C) AND (O<O1)); }
   else if(P == 21) { PatternName = "DarkCloudCover"; Pv = (C1>O1 AND ((C1+O1)/2)>C AND O>C AND O>C1 AND C>O1 AND (O-C)/(.001+(H-L)>0.6)); }
   else if(P == 22) { PatternName = "BearishEngulfing"; Pv = (((C1>O1) AND (O>C)) AND ((H>H1)AND(L1>L)));}//(O>= C1) AND (O1>= C) AND ((O-C)>(C1-O1))); }
   else if(P == 23) { PatternName = "ThreeOutsideDownPattern"; Pv = ((C2>O2)AND (O1>C1) AND (O1>= C2) AND (O2>= C1) AND ((O1-C1)>(C2-O2)) AND (O>C) AND (C<C1)); }
   else if(P == 24) { PatternName = "BullishAbandonedBaby"; Pv = ((C1 == O1)AND (O2>C2) AND (C>O) AND (L2>H1) AND (L>H1)); }
   else if(P == 25) { PatternName = "BullishMorningDojiStar"; Pv = ((O2>C2)AND ((O2-C2)/(.001+H2-L2)>.6) AND (C2>O1) AND (O1>C1) AND ((H1-L1)>(3*(C1-O1))) AND (C>O) AND (O>O1)); }
   else if(P == 26) { PatternName = "BullishEngulfing"; Pv = (((O1>C1) AND (C>O)) AND ((H>H1)AND(L1>L)));}//(C>= O1) AND (C1>= O) AND ((C-O)>(O1-C1))); }
   else if(P == 27) { PatternName = "ThreeOutsideUpPattern"; Pv = ((O2>C2)AND (C1>O1) AND (C1>= O2) AND (C2>= O1) AND ((C1-O1)>(O2-C2)) AND (C>O) AND (C>C1)); }
   else if(P == 28) { PatternName = "BullishHarami"; Pv = ((O1>C1) AND (O<C)AND (O>C1) AND (L<L1) AND (H1>H)AND(O>C1)AND (C<O1));}//((C-O)<(O1-C1))); }
   else if(P == 29) { PatternName = "ThreeInsideUpPattern"; Pv = ((O2>C2)AND (C1>O1) AND (C1<= O2) AND (C2<= O1) AND ((C1-O1)<(O2-C2)) AND (C>O) AND (C>C1) AND (O>O1)); }
   else if(P == 30) { PatternName = "PiercingLine"; Pv = ((C1<O1) AND (((O1+C1)/2)<C) AND (O<C) AND (O<C1) AND (C<O1) AND ((C-O)/(.001+(H-L))>0.6)); }
   else if(P == 31) { PatternName = "BearishHarami"; Pv = ((C1>O1) AND (O>C)AND (H<H1)AND(L<L1));}//(O<= C1) AND (O1<= C) AND ((O-C)<(C1-O1))); }
   else if(P == 32) { PatternName = "ThreeInsideDownPattern"; Pv = ((C2>O2)AND (O1>C1) AND (O1<= C2) AND (O2<= C1) AND ((O1-C1)<(C2-O2)) AND (O>C) AND (C<C1) AND (O<O1)); }
   else if(P == 33) { PatternName = "ThreeWhiteSoldiers"; Pv = (C>O*1.01)AND (C1>O1*1.01) AND (C2>O2*1.01) AND (C>C1) AND (C1>C2) AND (O<C1) AND (O>O1) AND (O1<C2) AND (O1>O2) AND (((H-C)/(H-L))<.2) AND (((H1-C1)/(H1-L1))<.2) AND (((H2-C2)/(H2-L2))<.2); }
   else if(P == 34) { PatternName = "DarkCloudCover"; Pv = (C1>O1*1.01) AND (O>C) AND (O>H1) AND (C>O1) AND (((C1+O1)/2)>C) AND (C>O1) AND (MA(C,13)-Ref(MA(C,13),-4)>0); }
   else if(P == 35) { PatternName = "ThreeBlackCrows"; Pv = (O>C*1.01) AND (O1>C1*1.01) AND (O2>C2*1.01) AND (C<C1) AND (C1<C2) AND (O>C1) AND (O<O1)AND (O1>C2) AND (O1<O2) AND (((C-L)/(H-L))<.2) AND (((C1-L1)/(H1-L1))<.2)AND (((C2-L2)/(H2-L2))<.2); }
   else if(P == 36) { PatternName = "doji"; Pv = (O == C); }
   else if(P == 37) { PatternName = "GapUp"; Pv = GapUp(); }
   else if(P == 38) { PatternName = "GapDown"; Pv = GapDown(); }
   else if(P == 39) { PatternName = "BigGapUp"; Pv = L>1.01*H1; }
   else if(P == 40) { PatternName = "BigGapDown"; Pv = H<0.99*L1; }
   else if(P == 41) { PatternName = "HugeGapUp"; Pv = L>1.02*H1; }
   else if(P == 42) { PatternName = "HugeGapDown"; Pv = H<0.98*L1; }
   else if(P == 43) { PatternName = "DoubleGapUp"; Pv = GapUp() AND Ref(GapUp(),-1); }
   else if(P == 44) { PatternName = "DoubleGapDown"; Pv = GapDown() AND Ref(GapDown(),-1); }
    else if(P == 45) { PatternName = "BullishDragonFlyDoji"; Pv = ((O==C)AND(C==H)); }
    else if(P == 46) { PatternName = "BearishGraveStoneDoji"; Pv = ((O==C)AND(C==L)); }
 
   return Pv;
   }
 
PatternNameList = "";
for(Cp=0; Cp<=46; Cp++)
    {
    VarSet("Pattern"+NumToStr(Cp,1.0),CandlePattern(cP));
    PatternNameList = PatternNameList + PatternName + ","; 
    }
 
BI = BarIndex();
SelectedBar = SelectedValue(BI) -BI[0];
//Selectedbar = Status("lastvisiblebar")-1;
PStr="";
for(Cp=0; Cp<=46; Cp++)
    {
    Temp = VarGet("Pattern"+NumToStr(Cp,1.0));
    if(temp[SelectedBar]) PStr = PStr+" " + NumToStr(Cp,1.0) + "-" + StrExtract(PatternNameList,Cp)+",";
    }
Title = "Candle Demostration" + " " + "-" + PStr;
pname="";
for(Cp=0;Cp<=46;Cp++)
{   
    tmp = VarGet("Pattern"+NumToStr(Cp,1.0));
    if(tmp[SelectedBar])
    {
        VarSet("Pattern"+NumToStr(Cp,1.0),CandlePattern(Cp));
        //PatternNameList = PatternNameList + PatternName + ",";
     
        //pname = StrExtract(PatternNameList,Cp);
        pname = PatternName;
        //printf(pname);
 
        if(pname == "NearDoji")
            printf("\n"+StrToUpper(pname)+"-\nhas Low Reliability - Doji needs to be interpreted in terms of a preceding trend OR preceding candlesticks.")+
            printf("The appearance of a Doji after an advance OR a long white candlestick signals the fact that the buying pressure is getting weaker.")+
            printf("The appearance of a Doji after a decline OR a long black candlestick signals the fact that the selling pressure is diminishing.")+
            printf("Essentially Doji gives the message that the forces of supply AND demand are becoming more evenly matched AND consequently a change in trend may be near.")+
            printf("However Doji alone is NOT enough to identify a reversal AND further confirmation by following signals may be warranted.");
        else if(pname == "BlackMarubozu")
            printf("\n"+StrToUpper(pname)+"-\nhas Low Reliability - It may show continuation of the downtrend OR a final Sell off attempt before the bulls regain control.")+
            printf("A Black Marubozu may be the initial phase of a bearish continuation pattern but it may also Signal a bullish reversal depending on the preceding Day's candlesticks.")+
            printf("The Black Marubozu is a single candlestick pattern with Low reliability. It reflects only one Days trading with a potential to Signal both continuation AND reversal.")+
            printf("It must be used with other candlesticks for the confirmation of a trend.");
        else if(pname == "WhiteMarubozu")
            printf("\n"+StrToUpper(pname)+"-\nhas Low Reliability - This shows that the buyers controlled the price action from the first trade to the last trade.")+
            printf("A White Marubozu can possibly be the first part of a bullish continuation pattern but it may also be interpreted as a bearish reversal candlestick pattern depending on the preceding Day's candlesticks.")+
            printf("The White Marubozu is a single candlestick pattern AND consequently it has Low reliability.It reflects only one Day's trading AND it may show the continuation of the trend but also may indicate reversal.")+
            printf("It needs to be used with other candlesticks for a better AND healthier judgment about the Status of the trend.");
        else if(pname == "WhiteClosingMarubozu")
            printf("\n"+StrToUpper(pname)+"-\n has Low Reliability - It is characterized by a long white body with a shadow on the open and but no shadow on the closing end of the body.")+
            printf("White Closing Marubozu can possibly be the first part of a bullish continuation pattern or it may also be interpreted as a bearish reversal candlestick pattern depending on the preceding day's candlesticks.")+
            printf("It only reflects one day's trading and it may show the continuation of the trend but it may also indicate reversal.It needs to be used with other candlesticks for a better and healthier judgment about the status of the trend.");
        else if(pname == "BlackClosingMarubozu")
            printf("\n"+StrToUpper(pname)+"-\nhas Low Reliability - It is a Day of the bears.With the bears in full force; it may show either the continuation of a downtrend OR a final Sell off attempt just before the bulls regain control.")+
            printf("A Black Closing Marubozu can be either the initial phase of a bearish continuation pattern OR it may Signal a bullish reversal depending on the preceding Day's candlesticks.")+
            printf("The Black Opening Marubozu is a single candlestick pattern with Low reliability.It only reflects one Day's trading AND may be pointing either continuation OR reversal.")+
            printf(" Hence it must be considered with other candlesticks to better judge the direction of the trend.");
        else if(pname == "BlackOpeningMarubozu")    
            printf("\n"+StrToUpper(pname)+"-\nhas Low Reliability - It shows continuation of the downtrend OR a final Sell off attempt before the bulls regain control.")+
            printf("A Black Marubozu may be the initial phase of a bearish continuation pattern but it may also Signal a bullish reversal depending on the preceding Day's candlesticks.")+
            printf("The Black Marubozu is a single candlestick pattern with Low reliability. It reflects only one Days trading with a potential to Signal both continuation AND reversal.")+
            printf("It must be used with other candlesticks for the confirmation of a trend.");
        else if(pname == "WhiteOpeningMarubozu")
            printf("\n"+StrToUpper(pname)+"-\nhas Low Reliability - It is a typical bull Day AND strength of the bulls is enough to cause some concern among the bears.")+
            printf("A White Opening Marubozu, on the other end, does NOT show as much bullish strength as in the case of White Marubozu.")+
            printf("It may be the first part of a bullish continuation pattern but it may also be interpreted as a bearish reversal pattern depending on the preceding Day's")+
            printf("candlesticks.In the case of downtrend a White Opening Marubozu is called as a Bullish Belt Hold Pattern.It needs to be used with other candlesticks for a")+
            printf(" better AND healthier judgment about the Status of the trend.");
        else if(pname == "HangingMan")
            printf("\n"+StrToUpper(pname)+"-\nhas Low Reliability - The hanging man is a bearish reversal pattern.It signals a market top OR a resistance level.Since it is seen after an advance,")+
            printf("a Bearish Hanging Man Pattern signals that selling pressure is starting to increase.The Low of the long lower shadow indicates that the sellers pushed prices")+
            printf(" lower during the session.This selling pressure after a rally is a serious warning Signal.Ideally the lower shadow of the Bearish Hanging Man Pattern must be")+
            printf(" two OR three times the height of the real body.However a long lower shadow may NOT have to be twice the height of the real body in the real life conditions in")+
            printf(" order to Signal a reversal.The pattern is more perfect if the lower shadow is longer.The Bearish Dragonfly Doji Pattern is a more bearish Signal than the")+
            printf(" Bearish Hanging Man Pattern AND it is also more reliable than the Bearish Hanging Man Pattern.if a Bearish Hanging Man Pattern is characterized by a black")+
            printf(" real body,it shows that the Close was NOT able to get back to the opening price level,which has potentially bearish implications.We need a confirmation of the")+
            printf(" reversal on the next Day for a more definite proof about the reversal of the uptrend.This confirmation may be in the form of a black candlestick,")+
            printf("a large gap down OR a lower Close on the next trading Day.");
        else if(pname == "Hammer")
            printf("\n"+StrToUpper(pname)+"-\nhas Low Reliability - The overall direction of the market is bearish, characterized by a downtrend. Then the market opens with a sharp Sell off")+
            printf(" implying the continuation of the downtrend.However,prices suddenly turn upwards,the Sell-off is quickly abated AND bullish sentiment continues during the Day")+
            printf(" with a closing price at OR near to its High for the Day which causes the long lower shadow.Apparently the market fails to continue in the selling side.")+
            printf("if the hammer is characterized by a Close above the Open thus causing a white body,the situation looks even better for the bulls.The Bullish Dragonfly Doji")+
            printf(" pattern is generally considered more bullish than the Bullish Hammer Pattern AND a higher reliability is ascribed to this Doji than the Bullish Hammer Pattern.")+
            printf("The reliability of Bullish Hammer Pattern is Low. It requires confirmation of the implied trend reversal by a white candlestick,a large gap up OR a higher Close")+
            printf(" on the next trading Day.");
        else if(pname == "InvertedHammer")
            printf("\n"+StrToUpper(pname)+"-\nhas Low Reliability - Bullish Inverted Hammer Pattern occurs in a bearish background.In a Day of inverted hammer,market opens at OR near its Low.")+
            printf("Then prices change direction AND we see a rally.However the bulls cannot succeed to sustain the rally during the rest of the Day AND prices finally Close either")+
            printf(" at OR near the Low of the Day.It may NOT be clear why this type of price action is interpreted as a potential reversal Signal.The answer has to do with what")+
            printf(" happens over the next Day.If the next Day opens above the real body of the inverted hammer,it means that those who shorted at the opening OR closing of the")+
            printf(" inverted hammer Day are losing money.The longer the market holds above the inverted hammers real body,the more likely these shorts will attempt to Cover their")+
            printf(" positions.This may ignite a rally as a result of covered Short positions,which may then inspire the bottom pickers to take long positions.Bullish verification")+
            printf(" on the Day following the inverted hammer is required.This verification can be in the form of the next Day opening above the inverted hammers real body.")+
            printf("The larger the gap the stronger the confirmation will be.A white candlestick with higher prices can also be another form of confirmation.");
        else if(pname == "ShootingStar")
            printf("\n"+StrToUpper(pname)+"-\nhas Low Reliability - 1-Market is characterized by uptrend.2-We see a white candlestick in the first Day.3-Prices then Open with a gap creating a")+
            printf(" small real body at the lower end of the trading range on the Second Day.4-Upper shadow of the pattern on the Second Day is usually at least twice as long as")+
            printf(" the real body.5-However; Second Day pattern has no (OR Close to none) lower shadow.Bearish Shooting Star Pattern is usually NOT a major reversal Signal as is")+
            printf(" the evening star.The color of the real body is NOT important.An ideal shooting star has a real body which gaps away from the prior real body.Nonetheless this")+
            printf(" gap is NOT always necessary.A confirmation on the third Day is required to be sure that the uptrend has reversed.The confirmation may be in the form of a black")+
            printf(" candlestick, a large gap down OR a lower Close on the next trading Day.");
        else if(pname == "BlackSpinningTop")
            printf("\n"+StrToUpper(pname)+"-\nhas Low Reliability - The market moves higher AND then sharply lower OR vice versa.It then closes below the opening price creating a black body.")+
            printf("This represents complete indecision between the bulls AND the bears.The actual length of the shadows is NOT important.The small body relative to the shadows is")+
            printf(" what makes the spinning top.If a Black Spinning Top is observed after a long rally OR long white candlestick,this implies weakness among the bulls AND it is a")+
            printf(" warning about a potential change OR interruption in trend.If a Black Spinning Top is observed after a long decline OR a long black candlestick this implies")+
            printf(" weakness among the bears AND it is a warning about a potential change OR interruption in trend.Like most other single candlestick patterns,the Black Spinning")+
            printf(" Top has Low reliability.It reflects only one Day's trading AND can be interpreted both as a continuation AND a reversal pattern.This pattern must be used with")+
            printf(" other candlesticks for a better AND healthier confirmation of a trend.");
        else if(pname == "WhiteSpinningTop")
            printf("\n"+StrToUpper(pname)+"-\nhas Low Reliability - This represents complete indecision between the bulls AND the bears.The actual length of the shadows is NOT important.")+
            printf("The small body relative to the shadows is what makes the spinning top.If a White Spinning Top is observed after a long rally OR a long white candlestick,")+
            printf(" this implies weakness among the bulls AND it is a warning about a potential change OR interruption in trend.If a White Spinning Top is observed after a long")+
            printf(" decline OR a long black candlestick this implies weakness among the bears AND it is a warning about a potential change OR interruption in trend.")+
            printf("This candlestick needs to be used with other candlesticks for a healthier confirmation of a trend.");
        else if(pname == "BearishAbandonedBaby")
            printf("\n"+StrToUpper(pname)+"-\nhas High Relaiability - Most of the three-Day star patterns have similar scenarios.In an uptrend,the market seems still strong displaying a long")+
            printf(" white candlestick AND opening with a gap on the Second Day.The trading in Second Day is within a small range AND its closing price is equal OR very near to")+
            printf(" its opening price.Now there is a sign of sale-off potential with reversal of positions.The trend reversal is confirmed by the black candlestick on the third Day.")+
            printf("Downward gap also supports the reversal.The Bearish Abandoned Baby Pattern is quite rare.The reliability of this pattern is very High,but still a confirmation")+
            printf(" in the form of a black candlestick with a lower Close OR a gap-down is suggested.");
        else if(pname == "BearishEveningDojiStar")
            printf("\n"+StrToUpper(pname)+"-\nhas High Reliability - The first white body,while the market is in an uptrend,shows the continuing bullish nature of the market.")+
            printf("Then a Doji appears showing the diminishing power of the longs.The strong black real body on the third Day proves that bears have taken over.")+
            printf("An ideal Bearish Evening Doji Star Pattern has a gap before AND after the middle real body.The Second gap is rare,but lack of it does NOT take away from")+
            printf(" the power of this formation.The Doji may be more than one, two OR even three.jis gaps are NOT important.The reliability of this pattern is very High,")+
            printf("but still a confirmation in the form of a black candlestick with a lower Close OR a gap-down is suggested.");
        else if(pname == "DarkCloudCover")
            printf("\n"+StrToUpper(pname)+"-\nhas High Reliability - Market goes up with an uptrend.Then we see a strong white candlestick followed by a gap suggesting that bulls retain the")+
            printf(" control.However,the rally does NOT continue.Market suddenly closes at OR near the lows of the Day so the Second Day body moving well into the prior Days real")+
            printf(" body.If the black real bodys Close penetrates deeper into the prior white real body,the chance for a top increases.There are some Japanese technicians who")+
            printf(" require more than a 50% penetration of the black Days Close into the white real body. if the black candlestick does NOT Close below the halfway point of the")+
            printf(" white candlestick then it is better to wait for confirmation following the dark cloud Cover;AND even if it does,a confirmation may still be necessary.")+
            printf("This confirmation may be in the form of a black candlestick,a large gap down OR a lower Close on the next trading Day.");   
        else if(pname == "BearishEngulfing")
            printf("\n"+StrToUpper(pname)+"-\nhas Medium Reliability - Relative sizes of the first AND Second days are important.If the first Day of the Bearish Engulfing Pattern is a very small")+
            printf(" real body (it may even be almost a doji OR is a doji) but the Second Day has a very long real body,this shows the dissipation of the prior uptrends force")+
            printf(" AND an increase in bearish force.A fast move makes the market overextended AND vulnerable to profit taking.A Bearish Engulfing Pattern appearing after such")+
            printf(" a move is more likely to be an important bearish reversal indicator.A bearish reversal is more possible if there is heavy Volume on the Second real body OR")+
            printf(" if the Second Day of the Bearish Engulfing Pattern engulfs more than one real body.A confirmation in the third Day is required to be sure that the uptrend")+
            printf(" has reversed. The confirmation may be in the form of a black candlestick, a large gap down OR a lower Close on the third Day.");
        else if(pname == "ThreeOutsideDownPattern")
            printf("\n"+StrToUpper(pname)+"-\nhas High Reliability - It is another Name for the Confirmed Bearish Engulfing Pattern.The third Day confirms the bearish trend reversal.")+
            printf("The first two days forms a Bearish Engulfing Pattern, AND the third Day confirms the reversal suggested by the Bearish Engulfing Pattern since it is a black")+
            printf(" candlestick closing with a new Low for the three days.The reliability of this pattern is very High, but still a confirmation in the form of a black candlestick")+
            printf(" with a lower Close OR a gap-down is suggested.");
        else if(pname == "BullishAbandonedBaby")    
            printf("\n"+StrToUpper(pname)+"-\nhas High Reliability - 1-Market is characterized by downtrend.2-We usually see a long black candlestick in the first Day.3-Then a Doji appears on")+
            printf(" the Second Day whose shadows gap below the previous Day's lower shadow AND gaps in the direction of the previous downtrend.4-Then we see a white candlestick")+
            printf(" on the third Day with a gap in the opposite direction with no overlapping shadows.In a falling market, the market shows bearish strength first with a long black")+
            printf(" candlestick AND opens with a gap on the Second Day. The Second Day trading is within a small range AND Second Day closes at OR very near its Open. This Now")+
            printf(" suggests the potential for a rally showing that positions are changed. The Signal of trend reversal is given by the white third Day AND by well-defined upward gap")+
            printf("The Bullish Abandoned Baby Pattern is quite rare.The reliability of this pattern is very High, but still a confirmation in the form of a white candlestick with")+
            printf(" a higher Close OR a gap-up is suggested.");
        else if(pname == "BullishMorningDojiStar")
            printf("\n"+StrToUpper(pname)+"-\nhas High Reliability - Black real body while market is falling down may suggest that the bears are in command. Then a Doji appears showing the")+
            printf(" diminishing capacity of sellers to drive the market lower.Confirmation of bull ascendancy is the third Days strong white real body.An ideal Bullish Morning")+
            printf(" Doji Star Pattern must have a gap before AND after the middle lines real body.The Second gap is rare,but lack of it does NOT take away from the power of this")+
            printf(" formation.Black real body while market is falling down may suggest that the bears are in command.Then a Doji appears showing the diminishing capacity of sellers")+
            printf(" to drive the market lower. Confirmation of bull ascendancy is the third Days strong white real body.An ideal Bullish Morning Doji Star Pattern must have a gap")+
            printf(" before AND after the middle lines real body.The Second gap is rare,but lack of it does NOT take away from the power of this formation.");
        else if(pname == "BullishEngulfing")
            printf("\n"+StrToUpper(pname)+"\nhas Medium Reliability - while the market sentiment is bearish;we see some subsided selling reflected by the Short,black real body of the first Day.")+
            printf("Next Day shows bull strength with a closing price at OR above the previous Days Open.It means that the downtrend is Now losing momentum AND the bulls started")+
            printf(" to take the lead.The relative size of the bodies in the first AND Second days is important.If the first Day of the Bullish Engulfing Pattern is characterized")+
            printf(" by a very small real body (it may even be a doji OR nearly a doji) but the Second Day is characterized by a very long real body,this strongly indicates that the")+
            printf(" bearish power is diminishing AND the disparity of white versus black body is indicative of the emerging bull power.There is higher probability of a bullish")+
            printf(" reversal if there is heavy Volume on the Second real body OR if the Second Day of the Bullish Engulfing Pattern engulfs more than one real body")+
            printf("(which essentially means we see two OR more small black bodies preceding the long white body).The reversal of downtrend needs further confirmation on the third")+
            printf(" Day.This confirmation may be in the form of a white candlestick, a large gap up OR a higher Close on the third Day.");
        else if(pname == "ThreeOutsideUpPattern")
            printf("\n"+StrToUpper(pname)+"\nhas High Reliability - 1-Market is characterized by downtrend.2-We see a Bullish Engulfing Pattern in the first two days.3-The third Day is a white")+
            printf(" candlestick with a higher Close than the Second Day.The first two days of this three-Day pattern is simply a Bullish Engulfing Pattern AND the third Day confirms")+
            printf(" the reversal suggested by the Bullish Engulfing Pattern since it is a white candlestick closing with a new High for the last three days.The reliability of this")+
            printf(" pattern is very High,but still a confirmation in the form of a white candlestick with a higher Close OR a gap-up is suggested.");
        else if(pname == "BullishHarami")
            printf("\n"+StrToUpper(pname)+"\nhas Low Reliability - The Bullish Harami Pattern is a sign of disparity about the markets health.While the market is characterized by downtrend")+
            printf(" AND bearish mood;there is heavy selling reflected by a long,black real body however it is followed by a small white body in the next Day.This may Signal a")+
            printf(" trend reversal since the Second Days small real body shows that the bearish power is diminishing.The decisive fact about this pattern is that the Second")+
            printf(" candlestick has a Minute real body relative to the prior candlestick.Furthermore this small body is completely Inside the larger one.The Bullish Harami Pattern")+
            printf(" does NOT necessarily imply that a rally will follow.Market usually enters into a congestion phase following the Bullish Harami.We may need a third Day")+
            printf(" confirmation to be sure that the downtrend has really reversed.This confirmation of the trend reversal may be signaled by a white candlestick,a large gap up")+
            printf(" OR by a higher Close on the third Day.");
        else if(pname == "ThreeInsideUpPattern")
            printf("\n"+StrToUpper(pname)+"-\nhas High Reliability - It is another Name for the Confirmed Bullish Harami Pattern.The first two days of this pattern is simply the Bullish Harami")+
            printf(" Pattern AND the third Day confirms the reversal suggested by the Bullish Harami Pattern,since it is a white candlestick closing with a new High for the last")+
            printf(" three days.The reliability of this pattern is very High,but still a confirmation in the form of a white candlestick with a higher Close OR a gap-up is suggested.");
        else if(pname == "PiercingLine")
            printf("\n"+StrToUpper(pname)+"-\nhas High Reliability - The market moves down in a downtrend.The first black real body reinforces this view.The next Day the market opens lower via")+
            printf(" a gap.Everything Now goes,as bears want it.However suddenly the market surges toward the Close, leading the prices to Close sharply above the previous Day Close.")+
            printf("Now the bears are losing their confidence AND reevaluating their Short positions.The potential buyers start thinking that new lows may NOT Hold AND perhaps it")+
            printf(" is time to take long positions.In the Bullish Piercing Pattern,the greater the degree of penetration into the black real body,the more likely it will be a")+
            printf(" bottom reversal.An ideal piercing pattern will have a real white body that pushes more than half way into the prior sessions black real body.A confirmation of")+
            printf(" the trend reversal by a white candlestick,a large gap up OR by a higher Close on the next trading Day is suggested.");
        else if(pname == "BearishHarami")
            printf("\n"+StrToUpper(pname)+"-\nhas Low Reliability - The Bearish Harami Pattern is a sign of a disparity about the markets health.Bull market continues further confirmed by the")+
            printf(" long white real bodys vitality but then we see the small black real body which shows some uncertainty.This shows the bulls upward drive has weakened AND Now")+
            printf(" a trend reversal is possible.It is important that the Second Day black candlestick has a Minute real body relative to the prior candlestick AND that this small")+
            printf(" body is Inside the larger one.The Bearish Harami Pattern does NOT necessarily mean a market reversal.It rather predicts that the market may NOT continue with")+
            printf(" its previous uptrend.There are however some instances in which the Bearish Harami Pattern can warn of a significant trend change - especially at market tops.")+
            printf("A confirmation of the reversal on the third Day is required to be sure that the uptrend has reversed.This confirmation may be in the form of a black candlestick,")+
            printf("a large gap down OR a lower Close on the next trading Day-the third Day.");
        else if(pname == "ThreeInsideDownPattern")
            printf("\n"+StrToUpper(pname)+"-\nhas High Reliability - The first two days of this three-Day pattern is a Bearish Harami Pattern AND the third Day confirms the reversal suggested")+
            printf(" by Bearish Harami Pattern since it is a black candlestick closing with a new Low for the three days.The reliability of this pattern is very High,but still a")+
            printf(" confirmation in the form of a black candlestick with a lower Close OR a gap-down is suggested.");
        else if(pname == "ThreeWhiteSoldiers")
            printf("\n"+StrToUpper(pname)+"-\nhas High Reliability - The Bullish Three White Soldiers Pattern appears in a context where the market stayed at a Low price for too long.")+
            printf("The market is still falling down AND it is Now approaching a bottom OR already at bottom.Then we see a decisive attempt upward shown by the long white")+
            printf(" candlestick.Rally continues in the next two days characterized by higher closes. Bears are Now forced to Cover Short positions.The opening prices of the Second")+
            printf(" AND third days can be anywhere within the previous Day's body.However,it is better to see the opening prices above the middle of the previous Day's body.")+
            printf("if the white candlesticks are very extended,one should be cautious about an overbought market.The reliability of this pattern is very High,but still a")+
            printf(" confirmation in the form of a white candlestick with a higher Close OR a gap-up is suggested.");
        else if(pname == "DarkCloudCover")
            printf("\n"+StrToUpper(pname)+"-\nhas High Reliability - It is a two-candlestick pattern signaling a top reversal after an uptrend OR at times,at the top of a congestion band.")+
            printf("We see a strong white real body in the first Day.The Second Day opens strongly above the previous Day High (it is above the top of the upper shadow).")+
            printf("However,market closes near the Low of the Day AND well within the prior Days white body at the end of the Day.If the black real bodys Close penetrates deeper")+
            printf(" into the prior white real body, the chance for a top increases. There are some Japanese technicians who require more than a 50% penetration of the black Days")+
            printf(" Close into the white real body.If the black candlestick does NOT Close below the halfway point of the white candlestick then it is better to wait for")+
            printf(" confirmation following the dark cloud Cover; AND even if it does,a confirmation may still be necessary.This confirmation may be in the form of a black")+
            printf(" candlestick, a large gap down OR a lower Close on the next trading Day.");
        else if(pname == "ThreeBlackCrows")
            printf("\n"+StrToUpper(pname)+"-\nhas High Reliability - It is indicative of a strong reversal during an uptrend.It consists of three long black candlesticks,which look like a stair")+
            printf(" stepping downward.The opening price of each Day is higher than the previous Day's closing price suggesting a move to a new Short term Low.The market has been")+
            printf(" at a High price for too long AND the market may be approaching a top OR is already at the top.A decisive downward move is reflected by the first black")+
            printf(" candlestick.The next two days show further decline in prices due to profit taking.Bullish mood of the market cannot be sustained anymore.The opening prices of")+
            printf(" the Second AND third days can be anywhere within the previous Day's body. However,it is better to see the opening prices below the middle of the previous")+
            printf(" Day's body.If the black candlesticks are very extended,one should be cautious about an oversold market.The reliability of this pattern is very High,but still")+
            printf(" a confirmation in the form of a black candlestick with a lower Close OR a gap-down is suggested.");
        else if(pname == "doji")
            printf("\n"+StrToUpper(pname)+"- \nThere are four types of doji candlesticks - common,long-legged,dragonfly AND gravestone.All dojis are marked by the fact that prices Open AND")+
            printf(" Close at the same level.If prices finish very Close to the same level (so that no body OR a very small real body is visible),then that candle can also be read")+
            printf(" as a doji.A doji represents a supply/demand equilibrium - a tug-of-war where neither the bulls nor bears are winning.In the case of an uptrend,the bulls have")+
            printf(" by definition won previous battles because prices have recently moved higher.Now, the outcome of the latest skirmish is in doubt. Meanwhile,after a long")+
            printf(" downtrend,the opposite is True.The bears have been victorious in previous battles, forcing prices down.In this case, the bulls have found courage to Buy AND")+
            printf(" the tide may be ready to turn.A common doji has a relatively small trading range, AND it reflects indecision on the market of market participants.")+
            printf("When assessing a doji candlestick,always take careful notice of when it occurs.If the security you're examining is still in the early stages of an uptrend OR")+
            printf(" downtrend,then it is unlikely that the doji will mark a top. Similarly,if the doji occurs in the middle of a Bollinger band, then it is likely to signify a")+
            printf(" pause rather than an outright trend reversal.As significant as the pattern is, one should NOT trade on the doji alone. Always wait for the next candlestick to")+
            printf(" confirm your suspicions before taking action.That does NOT necessarily mean,however, that you need to wait the entire next period.If a doji is seen after a")+
            printf(" sustained uptrend,then a large gap down immediately following the doji should normally provide a safe shorting opportunity.The best entry time for a Short")+
            printf(" trade would be early in the following session. Similarly,if a strong downdraft occurs at the beginning of a week after a weekly doji,trading action should be")+
            printf(" taken.After a long uptrend,the appearance of a doji candlestick can be an ominous warning sign that the trend has peaked OR is Close to peaking.Dojis should NOT")+
            printf(" be assessed mechanically.However,after a strong trend in either direction,they can often mark major turning points.Always recognize the doji when it occurs,")+
            printf("AND be prepared to take appropriate action.");
        else if(pname=="BullishDragonFlyDoji")
            printf("\n"+StrToUpper(pname)+"- \nAlthough dojis do indicate some indecision,in some instances,a doji may be more bullish OR bearish depending on the price action.")+
            printf("A dragonfly doji is one of those cases.It is fairly bullish in nature due to the price action that is behind this pattern.")+
            printf("The low of a dragonfly doji day is considered a near-term support level,because its clear that buyers came in at that level AND turned the trend from down to up.")+
            printf("The length of a wick from the high to low doesnt have to be any specific distance to qualify as a dragonfly.However,the wick length can signify the amount")+ 
            printf(" of bullish significance a dragonfly doji has for future price action.Put simply,the longer the wick,the more bullish the pattern.");
        else if(pname=="BearishGraveStoneDoji")
            printf("\n"+StrToUpper(pname)+"- \nThe open and close are both equal to the low of the day,the result is the most bearish of doji: the gravestone doji.")+
            printf("The price activity that creates a gravestone doji begins and ends at the low of a Day.The progression for the Day includes the following:")+
            printf("1-A security opens AND trades up during the Day,as the bulls dominate the activity.2-Higher prices attract sellers,AND the selling becomes strong enough to")+
            printf("overwhelm the bulls.3-As the bears take over,the price is moved back down to the Open,which was also the Low of the Day.");
    }
     
 
}
 
_SECTION_END();
 

chilgu

Active Member
Hi shivagi,
again many thanks to you and khushiji, for providing the best AFLs.

I request you, if you can put the buy,sell,short,cover variable in this system (nishant Trading System). It would be benefit us to backtest it.

thanks again
Paste these lines:-

Buy=Cover=Cross(j,nw);
Sell=Short=Cross(nw,j);

SetTradeDelays( 1, 1, 1, 1 );

Filter=Buy OR Sell ;

SetOption("NoDefaultColumns", True);
AddTextColumn(Name(), "Symbol", 77, colorDefault, colorDefault, 120);
AddColumn(DateTime(), "Trigger Date", formatDateTime);
AddColumn(IIf(Buy, 66, 83), "Signal", formatChar, colorYellow, IIf(Buy, colorGreen, colorRed));

AddColumn(C, "C. M. P.", 6.2);
 
Paste these lines:-

Buy=Cover=Cross(j,nw);
Sell=Short=Cross(nw,j);

SetTradeDelays( 1, 1, 1, 1 );

Filter=Buy OR Sell ;

SetOption("NoDefaultColumns", True);
AddTextColumn(Name(), "Symbol", 77, colorDefault, colorDefault, 120);
AddColumn(DateTime(), "Trigger Date", formatDateTime);
AddColumn(IIf(Buy, 66, 83), "Signal", formatChar, colorYellow, IIf(Buy, colorGreen, colorRed));

AddColumn(C, "C. M. P.", 6.2);
Thank you bro
Should i paste this at the end of the afl?
 

shivangi77

Well-Known Member
Pride System






Code:
SetChartOptions(0,chartShowArrows|chartShowDates);

SetChartBkColor(ParamColor("Outer panel",colorBlack)); // color of outer border

SetChartBkGradientFill( ParamColor("Inner panelupper",colorDarkGreen), ParamColor("Inner panel lower",colorTan));

Plot(C,"Price",IIf(O>C,32,34),64);// bary - swiece

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] )

    {

        // PlotText( "\nBuy:" + L[ i ] + "\nT= " + (L[i]*1.005) + "\nSL= " + (L[i]*0.9975), i, L[ i ]-dist[i], colorGreen, colorWhite );

      

        // Signal Display Panel //

 

        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);

        // END of Signal Display Panel //

    }

    if( Sell[i] )

    {

        // PlotText( "Sell:" + H[ i ] + "\nT= " + (H[i]*0.995) + "\nSL= " + (H[i]*1.0025), i, H[ i ]+dist1[i], colorRed, colorWhite );

      

        // Signal Display Panel //

        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);

        // END of Signal Display Panel //

    }

 

}

 

 

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;

//Short = Sell;

//Cover = Buy;

Buy = ExRem(Buy,Sell);

Sell = ExRem(Sell,Buy);

//Short = ExRem(Short, Cover);

//Cover = ExRem(Cover, Short);

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

 

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

// Classify each bar...

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

 

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);

 

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

// direction and title

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

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

//

// Basic patterns...

//

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

 

upThrustBar = downClose AND H > Ref(H,-1) AND (C == L) AND downClose AND (NOT narrowRange);

noDemandBar = narrowRange AND LowVolume AND upBar AND (NOT upClose);

//noDemandBar = narrowRange AND LowVolume AND upBar AND (V < Ref(V,-1)) AND (V < Ref(V,-2));

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;//OR moderateVol+upBar;

//rallyEnd = (Ref(highVolume,-1) AND Ref(upBar,-1) AND wideRange AND downBar) OR

// (narrowRange AND highVolume AND H > Ref(HHV(H, 250), -1));

 

 

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

//

// Strength and Weakness

//

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

 

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));

 

/* green volume: up-day and up-close*/

gv = IIf(VType == green, V, 0);

/* yellow volume: up-day but down-close */

yv = IIf(VType == yellow, V, 0);

/* red volume: down-day and down-close */

rv = IIf(VType == red, V, 0);

/* blue volume: down-day but up-close */

bv = IIf(VType == blue, V, 0);

 

uv = gv + bv; uv1 = Ref(uv, -1); /* up volume */

dv = rv + yv; dv1 = Ref(dv, -1); /* down volume */

 

/* create moving average period parameters */

VolPer = Param("Adjust Vol. MA per.", 34, 1, 255, 1);

ConvPer = Param("Adjust Conv. MA per.", 9, 1, 255, 1);

 

/* create triple exponential moving avearges of separate up and down volume

moving averages */

MAuv = TEMA(uv, VolPer ); mauv1 = Ref(mauv, -1);

MAdv = TEMA(dv, VolPer ); madv1 = Ref(madv, -1);

MAtv = TEMA(V, VolPer );//total volume

 

/* Switch for Horizontal lines indicating current level of positive and

negative volume for ease in comparing to past highs/lows - toggle via

parmameter window */

OscillatorOnly = Param("Show Oscillator Only", 0, 0, 1, 1);

CompareBullVolume = Param("Show Bull Level", 1, 0, 1, 1);

if(CompareBullvolume AND !OscillatorOnly){

//Plot(SelectedValue(MAuv), "", colorGreen, styleLine);

}

 

CompareBearVolume = Param("Show Bear Level", 1, 0, 1, 1);

if(CompareBearVolume AND !OscillatorOnly){

//Plot(SelectedValue(MAdv), "", colorRed, styleLine);

}

 

/* Volume Segment Switches - toggle via parameter window */

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);

 

/* plot volume lines and histograms if toggled on: */

bearToFront = Param("Show Bear Vol in Front", 0, 0, 1, 1);

if(bearToFront AND !OscillatorOnly){

//Plot(MAdv, "", colorRed, styleHistogram|styleNoLabel);

}

if(bullvolume AND !OscillatorOnly){

//Plot(MAuv, "Average Bull Volume", colorGreen, styleHistogram|styleNoLabel);

}

if(bearvolume AND !OscillatorOnly){

//Plot(MAdv, "Average Bear Volume", colorRed, styleHistogram|styleNoLabel);

}

if(totalVolume AND !OscillatorOnly){

//Plot(MAtv, "Total Volume", colorWhite, styleHistogram|styleNoLabel);

//Plot(MAtv, "", colorWhite, styleLine);

}

if(bullvolume AND !OscillatorOnly){

//Plot(MAuv, "", colorGreen, styleLine);

}

if(bearvolume AND !OscillatorOnly){

//Plot(MAdv, "", colorRed, styleLine);

}

 

/* better visibility of zero line: */

//Plot(0, "", colorBlue, 1);

 

/* Rise/Fall Convergence variables:  */

Converge = (TEMA(MAuv - MAdv, ConvPer));

Converge1 = Ref(Converge, -1);

ConvergeUp = Converge > Converge1;

ConvergeOver = Converge > 0;

rising = ConvergeUp AND ConvergeOver;

falling = !ConvergeUp AND ConvergeOver;

 

/* Rise/Fall Convergence Oscillator Switch  - toggle via parameter window - (provides a better view of resulting combination of battling bull/bear volume forces) */

convergenceOscillator = Param("Show Oscillator", 0, 0, 1, 1);

if(convergenceOscillator OR OscillatorOnly){

//Plot(Converge, "Bull/Bear Volume Convergence/Divergence", colorViolet,1|styleLeftAxisScale|styleNoLabel|styleThick);

//Plot(0,"", colorYellow, 1|styleLeftAxisScale|styleNoLabel);

}

 

/********************************************************

 Convergence Rise/Fall Shadows:

 

 (provides a more easily visible display of rising and falling  bull/bear

volume convergence) - toggle via parameter window

 

-posiitive Volume exceeding negative Volume: Light shadow

-negative volume exceeding positive volume: dark shadow

-if you use standard gray background - best shadows are:

-my greys: 14 = (216, 216, 216); 15 = (168, 168, 168));

-best substitute? using AB color constants?

-light: colorpalegreen; dark: colorRose;?

-(depends on your color scheme - customize to your tastes)

**********************************************************/

 

/* uncomment if you use my custom color greys: */

riseFallColor = IIf(rising, 14,15); //my custom shadow greys

 

/* comment out if you use my custom color gray shadows: */

/* riseFallColor = IIf(rising, colorPaleGreen,colorRose); */

 

/* Rise/Fall Convergence Plot Switch - toggle via parameter window */

riseFallShadows = Param("Show RiseFallShadows", 0, 0, 1, 1);

if(riseFallShadows){

//Plot(IIf(rising OR falling, 1, 0), "", riseFallColor,styleHistogram|styleArea|styleOwnScale|styleNoLabel);

}

_SECTION_END();

 

_SECTION_BEGIN("GANN Levels");

/*

For Stocks/Index/Commodities "order" need to be 0.1 to 0.5 For Nifty 0.15

 

For Forex "order" should be 0.001 ( except JPY pairs ), for JPY pairs it need to be 0.01

*/

 

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); // BUY Zone

bAbove = round(bAboveI);                      

 

sBelowI=(sqrt(Op)-level1)*(sqrt(Op)-level1);  // SELL Zone

sBelow = round(sBelowI);

 

Sstop= bAbove ;

Bstop= sBelow ;

 

// Resistance Levels (or Targets for Buy trade)

 

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));

 

// Support Levels (or Targets for Short trade)

 

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);

 

// GANN levels based on MKT opening price ( please change this time according to exchnage opening time )

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");

 

//  help requested for adding an exploration for End of Day breakouts

/*  coded by NW Trader 1-29-10 with exploration, chart signals and chart options

    toggle parameter to select between C or H & L for the breakout crossings

    toggle parameter added to remove extra trade signals

    Volume at price added

*/

 

//  ============== Standard Chart Code ============================

CodeName = "Joy's Breakouts";

SetFormulaName("Joy's Breakouts");

 

//   ---------------  Controls for Chart Display  ----------------------------------

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;

 

// ================= Joy's original code (with Lookback and Shift default set to his specs) =================

 

H0 = H;

L0 = L;

C0 = C;

O0 = O;

 

Lookback = Param("LookBack", 10, 10, 50, 1); // Default for interday commodity currency trading

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);

 

// ======================= Exploration and Signal Code =================

 

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); // THIS WILL REMOVE EXESS SIGNALS ON A CHART OR IN AN EXPLORATION

}

 

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) {

//====================================Start of Linear Regression Code==================================================================================

 

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);

 

//=============================== Math Formula ========================================================================================================

 

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 ) );

 

//==================Plot the Linear Regression Line ====================================================================================================

 

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);// A slope higher than 0.05 radians will turn green, less than -0.05 will turn red and anything in between will be white.

 

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);

}

 

//==========================  Plot 1st SD Channel ======================================================================================================

 

SDP = Param("Standard Deviation", 1.5, 0, 6, 0.1);

SD = SDP/2;

 

width = LastValue( Ref(SD*StDev(p, Daysback),-shift) ); //Set width of inside chanels here.

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 ); //Inside Regression Lines

Plot( SDL , "Lower Lin Reg", colorWhite,SDStyle ); //Inside Regression Lines

 

//==========================  Plot 2d SD Channel ========================================================================================================

 

SDP2 = Param("2d Standard Deviation", 2.0, 0, 6, 0.1);

SD2 = SDP2/2;

 

width2 = LastValue( Ref(SD2*StDev(p, Daysback),-shift) ); //Set width of outside chanels here.

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 ); //OutSide Regression Lines

Plot( SDL2 , "Lower Lin Reg", colorWhite,SDStyle2 ); //OutSide Regression Lines

 

Trend = IIf(LRLine > Ref(LRLine,-1),colorGreen,colorRed);//Changes LR line to green if sloping up and red if sloping down.

 

Plot( LRLine , "LinReg", Trend, LRSTYLE );

 

//============================ End Indicator Code ========================================================================================================

}

_SECTION_END();
 
Status
Not open for further replies.

Similar threads