// Downloaded From https://www.WiseStockTrader.com /*Body Colors*/ whiteBody=C>=O; blackBody=O>C; /*Body Size*/ smallBodyMaximum=0.0025;//less than 0.25% LargeBodyMinimum=0.01;//greater than 1.0% smallBody=(O>=C*(1-smallBodyMaximum) AND whiteBody) OR (C>=O*(1-smallBodyMaximum) AND blackBody); largeBody=(C>=O*(1+largeBodyMinimum) AND whiteBody) OR C<=O*(1-largeBodyMinimum) AND blackBody; mediumBody=NOT LargeBody AND NOT smallBody; identicalBodies=abs(abs(Ref(O,-1)-Ref(C,-1))-abs(O-C)) < abs(O-C)*smallBodyMaximum; realBodySize=abs(O-C); /*Shadows*/ smallUpperShadow=(whiteBody AND H<=C*(1+smallBodyMaximum)) OR (blackBody AND H<=O*(1+smallBodyMaximum)); smallLowerShadow=(whiteBody AND L>=O*(1-smallBodyMaximum)) OR (blackBody AND L>=C*(1-smallBodyMaximum)); largeUpperShadow=(whiteBody AND H>=C*(1+largeBodyMinimum)) OR (blackBody AND H>=O*(1+largeBodyMinimum)); largeLowerShadow=(whiteBody AND L<=O*(1-largeBodyMinimum)) OR (blackBody AND L<=C*(1-largeBodyMinimum)); /*Gaps*/ upGap= IIf(Ref(blackBody,-1)AND whiteBody AND O>Ref(O,-1),1, IIf(Ref(blackbody,-1) AND blackBody AND C>Ref(O,-1),1, IIf(Ref(whiteBody,-1) AND whiteBody AND O>Ref(C,-1),1, IIf(Ref(whiteBody,-1) AND blackBody AND C>Ref(C,-1),1,0)))); downGap=IIf(Ref(blackBody,-1)AND whiteBody AND C2*realBodySize) OR (whiteBody AND abs(H-C)>2*realBodySize)); Hammer=smallUpperShadow AND NOT doji AND ((blackBody AND abs(C-L)>2*realBodySize) OR (whiteBody AND abs(L-O)>2*realBodySize)); tweezerTop=abs(H-Ref(H,-1))<=H*0.0025; tweezerBottom=abs(L-Ref(L,-1))<=L*0.0025; engulfing= IIf(blackBody AND Ref(blackbody,-1) AND CRef(O,-1),1, IIf(blackBody AND Ref(whiteBody,-1) AND O>Ref(C,-1) AND CRef(C,-1) AND ORef(O,-1)AND ORef(C,-1),1, IIf(blackBody AND Ref(whiteBody,-1) AND C>Ref(O,-1) AND ORef(O,-1),1, IIf(whiteBody AND Ref(blackBody,-1) AND O>Ref(C,-1) AND CRef(O, -3) AND CRef(C,-2)AND Ref(blackbody,-1)AND blackBody AND engulfing; /*Doji Star Bullish*/ dojiStarBullish=(dojiStar AND (MLT OR MLY))OR (doji AND (C=Ref( C, -1) AND CRef(C,-1)*0.9975 AND C< Ref(C,-1)*1.0025; /*Morning Doji Star*/ morningDojiStar= Ref(LargeBody,-2) AND Ref(blackBody,-2) AND Ref(doji,-1) AND Ref(O,-1)Ref(C,-2) AND MLY; /* Morning Star*/ morningStar =Ref(largeBody,-2) AND Ref(blackBody,-2)//Large black candle AND Ref(downGap,-1)//Gap down yesterday AND whiteBody AND LargeBody AND C>Ref(C,-2)//Large white candle today AND MLY; //Yesterday was the low /* Piercing Line*/ piercingLine= Ref(largeBody,-1) AND Ref(blackBody,-1)AND O=(Ref(O,-1)+Ref(C,-1))/2 AND C=Ref(C,-2) AND O>=Ref(C,-1) AND abs(C-Ref(C,-2))<=C*0.0025; /*Three Inside Up harami confirming*/ threeInsideUp =Ref(Haramibullish,-1) AND whiteBody AND largeBody AND C>Ref(C,-1); /* Three Outside Up Engulfing confirmation*/ threeOutsideUp =Ref(engulfingBullish,-1) AND whiteBody AND C>Ref(C,-1); /* Three Stars in the South*///Rewrite??? threeStarsInTheSouth= Ref(LargeBody,-2) AND Ref(blackBody,-2) AND Ref(largelowerShadow,-2) AND Ref(blackBody,-1) AND Ref(largeLowerShadow,-1) AND Ref(L,-1)>Ref(L,-2) AND blackBody AND smallUpperShadow AND smallLowerShadow AND L>Ref(L,-1) AND HRef(C,-2) AND whiteBody AND CRef(O,-4) AND NOT Ref(LargeBody,-1) AND Ref(C,-1)Ref(C,-4); /*RisingThreeMethods*/ risingThreeMethods=Ref(LargeBody,-4) AND Ref(whiteBody,-4) AND NOT Ref(LargeBody,-3) AND NOT Ref(LargeBody,-2)AND NOT Ref(LargeBody,-1) AND Ref(C,-3)Ref(C,-4); /* Seperating Lines Bullish*/ separatingLinesBullish=Ref(blackBody,-1) AND whiteBody AND LargeBody AND smallLowerShadow AND MHT AND abs(O-Ref(O,-1))<=O*0.0025; /*Side by Side White Lines*/ sideBySideWhiteLines=NOT Ref(smallBody,-2) AND Ref(whiteBody,-2) AND Ref(upGap,-1) AND Ref(whitebody,-1)AND whiteBody AND identicalBodies AND abs(O-Ref(O,-1))Ref(C,-1) AND Ref(C,-1)>Ref(C,-2) AND Ref(O,-1)>Ref(O,-2) AND Ref(O,-1)Ref(O,-1) AND Ref(smallUpperShadow,-2) AND Ref(smallUpperShadow,-1) AND smallUppershadow AND LLV(L,12)==Ref(L,-2); /*Upside Gap Three Methods not very good*/ upsideGapThreeMethods=Ref(Largebody,-2) AND Ref(whiteBody,-2) AND Ref(LargeBody,-1) AND Ref(whiteBody,-1) AND Ref(upGap,-1) AND blackBody AND O>Ref(O,-1) AND CRef(O,-2) AND MHY; /*Three Line Strike not good signals*/ threeLineStrike=NOT Ref(smallBody,-3) AND NOT Ref(smallBody,-2) AND NOT Ref(smallBody,-1) AND Ref(whiteBody,-3) AND Ref(whiteBody,-2) AND Ref(whiteBody,-1) AND Ref(C,-1)>Ref(C,-2) AND Ref(C,-2)>Ref(C,-3) AND blackBody AND O>Ref(C,-1) AND CRef(O,-1) AND CRef(C,-2) AND identicalBodies AND ORef(O,-2) AND Ref(O,-1)Ref(C,-2) AND C>Ref(C,-1) AND ORef(O,-1) AND Ref(LargeUpperShadow,-1) AND LargeUpperShadow AND C-ORef(O,-3) AND CRef(H,-1) AND C>Ref(O,-1) AND C<(Ref(O,-1)+Ref(C,-1))/2 AND MHT; /*Deliberation Bearish: needs confirmation*/ deliberationBearish=Ref(LargeBody,-2) AND Ref(whiteBody,-2) AND Ref(LargeBody,-1) AND Ref(whiteBody,-1) AND Ref(C,-1)>Ref(C,-2) AND smallbody AND upGap; /*CounterAttackBearish*/ CounterAttackBearish=MHT AND LargeBody AND blackbody AND Ref(largeBody,-1) AND Ref(whiteBody,-1) AND CRef(C,-1)*0.9975;; /*Doji Star Bearish*/ dojiStarBearish=(dojiStar AND (MHT OR MHY))OR (doji AND (C>Ref(C,-1) OR O>Ref(C,-1))AND Ref(whiteBody,-1) AND Ref(LargeBody,-1)); /*Engulfing Bearish*/ engulfingBearish=engulfing AND largeBody AND blackBody AND (Ref(whitebody,-1) OR Ref(Doji,-1))AND (MHT OR MHY); /*Evening Doji Star check formula???*/ eveningDojiStar=Ref(LargeBody,-2) AND Ref(whiteBody,-2) AND Ref(dojiStar,-1) AND Ref(GapUp(),-1) AND (MHY OR MHT); /*Evening Star*/ eveningStar=Ref(LargeBody,-2) AND Ref(whiteBody,-2) AND Ref(upGap,-1) AND NOT Ref(largeBody,-1) AND blackBody AND NOT smallBody AND (MHT OR MHY); /*Hammer Bearish*/ HammerBearish=Hammer AND HHV(H,8)==H; /*hangingMan*/ HangingMan=NOT largeBody AND smallUpperShadow AND LargeLowerShadow AND MHT; /*dragonfly Doji Bearish*/ dragonflyDojiBearish=doji AND smallUpperShadow AND LargeLowerShadow AND MHT; /*Harami Bearish-*/ HaramiBearish=harami AND Ref(Largebody,-1) AND Ref(whiteBody,-1)AND blackBody AND (MHY OR MHT); /*HaramiCross Bearish*/ HaramiCrossBearish=harami AND doji AND Ref(whiteBody,-1) AND Ref(Largebody,-1); /*Identical three black crows*/ idendicalThreeBlackCrows=Ref(blackBody,-2) AND Ref(blackBody,-1) AND blackBody AND abs(Ref(C,-2)-Ref(O,-1))Ref(C,-1)AND CRef(O,-2) AND MHY;//Third day /*Upside Gap Two Crows*/ upsideGapTwoCrows= Ref(whiteBody,-2) AND Ref(LargeBody,-2)// first day AND Ref(upGap,-1) AND Ref(blackBody,-1) // 2nd day AND blackbody AND O>Ref(O,-1) AND CRef(C,-2); /*Doji Star Bearish needs confirmation dojiStarBearish=Ref(LargeBody,-1) AND Ref(whiteBody,-1) // first day AND doji AND upGap AND MHT;*/ /* Downside Gap Three Methods*/ downsideGapThreeMethods= Ref(LargeBody,-2) AND Ref(blackBody,-2) AND Ref(downGap,-2) //first day AND Ref(LargeBody,-1) AND Ref(blackBody,-1)//2nd day AND whitebody AND ORef(C,-2) AND LLV(L,8)==Ref(L,-1); /*Downside Tasuki Gap*/ downsideTasukiGap= Ref(blackBody,-2)//first day AND Ref(blackbody,-1) AND Ref(downgap,-1) //2nd day AND whiteBody AND ORef(C,-1) AND C>Ref(O,-1) AND CRef(C,-2) AND Ref(C,-2)>Ref(C,-3) AND LargeBody AND blackBody AND O>Ref(C,-4) AND O=Ref(C,-1); /*On Neck Bearish not good*/ OnNeckBearish=Ref(LargeBody,-1) AND Ref(blackBody,-1) AND whiteBody AND O=Ref(L,-1)*0.9975; /*separating Lines Bearish*/ separatingLinesBearish=Ref(LargeBody,-1) AND Ref(whiteBody,-1) AND blackBody AND O>Ref(O,-1)*0.9975 AND O<=Ref(O,-1)*1.0025; /*Side By Side White Lines Bearish*/ sideBySideWhiteLinesBearish=NOT Ref(smallBody,-2) AND Ref(blackBody,-2) AND Ref(whiteBody,-1) AND whiteBody AND Ref(downGap,-1) AND identicalBodies AND abs(C-Ref(C,-1)Ref(O,-3); /*Thrusting Bearish*/ thrustingBearish=Ref(blackBody,-1) AND Ref(LargeBody,-1) AND LargeBody AND whitebody AND ORef(C,-1); /*Tweezer Top*/ tweezerTop= (abs(H-Ref(H,-1))/H<0.0025 OR abs(H-Ref(H,-2))/H<0.0025) AND (MHT OR MHY); /* *********************************************** Buy Rules **************************************************/ Buy= abandonedBabybullish OR beltHoldBullish OR breakAwayBullish OR ConcealingBabySwallow OR engulfingBullish OR hammerBullish OR dragonflyDoji OR dojiStarBullish OR haramiBullish OR HaramiCross OR homingPigeon OR invertedHammer OR meetingLinesbullish OR morningDojiStar OR morningStar OR piercingLine OR stickSandwich OR threeInsideUp OR threeOutsideUp OR threeStarsInTheSouth OR triStarBullish OR threeriverBottom OR MAtHoldBullish OR risingThreeMethods OR separatingLinesBullish OR sideBySideWhiteLines OR threeWhiteSoldiers OR upsideGapThreeMethods OR threeLineStrike OR tweezerBottom OR upsideTasukiGap; /************************************ Sell Rules *************************************/ Sell= AbandonedBabyBearish OR advanceBlockBearish OR beltHoldBearish OR breakAwayBearish OR darkCloudCover OR deliberationBearish OR CounterAttackBearish OR engulfingBearish OR eveningDojiStar OR eveningStar OR HangingMan OR dragonflyDojiBearish OR HammerBearish OR HaramiBearish OR HaramiCrossBearish OR idendicalThreeBlackCrows OR kickingBearish OR MeetingLinesBearish OR shootingStarGap OR gravestoneDoji OR threeInsideDownBearish OR threeoutsideDownBearish OR triStarBearish OR twoCrows OR upsideGapTwoCrows OR dojiStarBearish OR downsideGapThreeMethods OR downsideTasukiGap OR fallingThreeMethods OR inNeckBearish OR OnNeckBearish OR separatingLinesBearish OR sideBySideWhiteLinesBearish OR threeBlackCrows OR threeLineStrike OR thrustingBearish OR tweezerTop; /*************************************** Commentary *************************************** Bullish Candles ****************************************/ WriteIf(abandonedBabybullish,"Abandoned Baby Bullish. A reversal pattern.\nLiWick reliability : High.",""); WriteIf(beltHoldBullish,"Belt Hold Bullish. A reversal pattern.\nNison:The larger the candlestick, the more significant it is.\nLitWick Reliability: Low.",""); WriteIf(breakAwayBullish,"Break Away Bullish. A reversal pattern.\nLitWick reliability: moderate.",""); WriteIf(ConcealingBabySwallow,"Concealing Baby Swallow. A reversal pattern.\n LitWick reliability: high.",""); WriteIf(dojiStarBullish,"Bullish doji Star. A reversal pattern.\nNison: Needs confirmation. Better at calling tops.\nLitWick reliability: moderate.",""); WriteIf(engulfingBullish,"Bullish Engulfing. a reversal pattern.\nNison: Factors increasing the pattern's effectiveness are\n1) The first day has a small real body and the second day has a large real body.\n2) Pattern appears after protracted or very fast move.\n3) Heavy volume on second real body.\n4) The second day engulfs more than one real body.\nLitWick reliability: moderate",""); WriteIf(hammerBullish,"Bullish Hammer. A reversal pattern.\nNison: The longer the lower shadow, the smaller the upper shadow, and the smaller the real body, the more significant the pattern.White real body more bullish than black body.\nLitWick reliability: low.",""); WriteIf(dragonflyDoji,"Dragonfly Doji. LitWick reliability: moderate.",""); WriteIf(haramiBullish, "Harami Bullish. A reversal pattern.\nNison: Less significant. Pattern needs confirmation.\nLitWick reliability: low.",""); WriteIf(HaramiCross,"Harami Cross. A reversal pattern.\nNison: Better indicator than Harami. Better at calling tops than bottoms.\nLitWick reliability: low.",""); WriteIf(homingPigeon,"Homing Pigeon. A reversal pattern.\nLitWick reliability: moderate.",""); WriteIf(invertedHammer,"Inverted Hammer. A reversal pattern.\nNison:Needs bullish verification.\nLitWick reliability: low.",""); WriteIf(meetingLinesbullish,"Meeting Lines bullish. A reversal pattern.\nLitWick reliability: moderate.",""); WriteIf(morningDojiStar,"Morning Doji Star. A reversal pattern.\nImportant reversal signal.\nLitWick reliability: high.",""); WriteIf(morningStar,"Morning Star. A reversal pattern.\nNison: The stronger the white third body the better.\nLitWick reliability: high.",""); WriteIf(piercingLine,"Piercing Line. A reversal pattern.\nNison: A stron reversal pattern.\nLitWick reliability: moderate.",""); WriteIf(stickSandwich,"Stick Sandwich. A reversal pattern.\nLitWick reliability: moderate.",""); WriteIf(threeInsideUp,"3 Inside Up. A reversal pattern.\nLitWick reliability: high.",""); WriteIf(threeOutsideUp,"3 Outside Up. A reversal pattern.\nLitWick reliability: high.",""); WriteIf(threeStarsInTheSouth,"3 Stars in the South. A reversal pattern.\nLitWick reliability: moderate.",""); WriteIf(triStarBullish,"Tri-Star Bullish. A reversal pattern.\nNison: Significant reversal pattern.\nLitWick reliability: moderate.",""); WriteIf(threeriverBottom,"3 River Bottom. A reversal pattern.\nNison: Selling pressure drying up.\nLit Wick reliability: moderate.",""); WriteIf(MAtHoldBullish,"Mat Hold Bullish. A continuation pattern.\nNison: May have 2-4 black candles.\nLitWick reliability: high. ",""); WriteIf(risingThreeMethods,"Rising Three Methods. A continuation pattern>\nNison: Has more significance if volume of white candle sticks is greater than on black candlesticks.\nLitWick reliability: high.",""); WriteIf(separatingLinesBullish,"Separating Lines Bullish. A continuation pattern.\nNison: \nLitWick reliability: low.",""); WriteIf(sideBySideWhiteLines,"Side by Side White Lines. A continuation pattern.\nNison: If occurring during a downtrend may only be short covering.\nLitWick reliability: high.",""); WriteIf(threeWhiteSoldiers,"3 White Soldiers. A continuation pattern.\nNison: Positive, but be aware of negative similar stalled pattern and advance block pattern.\nLitWick reliability: high.",""); WriteIf(upsideGapThreeMethods,"Upside Gap 3 Methods. A continuation pattern.\nLitWick reliability: moderate.",""); WriteIf(threeLineStrike,"3 Line Strike. A continuation pattern.\nLitWick reliability: low.",""); WriteIf(tweezerBottom,"Tweezer Bottom.a reversal pattern. With other reversal candles it could indicate a support level.\nNison: Needs confirmation.",""); WriteIf(upsideTasukiGap,"Upside Tasuki Gap. A continuation pattern.\nNison: the real bodies of the two candlesticks in the gap should be about the same size.\nLitWick reliability: moderate.",""); /*************************************** Bearish Candles ********************************************/ WriteIf(AbandonedBabyBearish,"Abandoned Baby Bearish. A reversal pattern.\nNison: Extremely rare.\nLitWick reliability: high.",""); WriteIf(advanceBlockBearish,"Advancing Block Bearish. A reversal pattern.\nNison: Rally is in trouble. Signs of weakening could be progressively smaller white read bodies or relatibvely long upper shadows on the last two white candlesticks.Not necessarily a reversal pattern.\nLitWick Reliability: moderate.",""); WriteIf(beltHoldBearish,"Belt Hold Bearish. A reversal pattern.\nNison: The longer the height of the belt-hold candle the more significant the pattern.\nLitWick reliability: low.",""); WriteIf(breakAwayBearish,"Break Away Bearish. A reversal pattern.\nLitWick reliability: moderate.",""); WriteIf(darkCloudCover,"Dark Cloud Cover. A reversal pattern.\nNison: Factors indicating the importance of this signal are/n1)The greater the penetration of the first candle by the second.\n2)Both candles are marabozus.\n3)The second body opens above a major resistance level.\n4)High volume on the second day.\nLitWick Reliability: high.",""); WriteIf(deliberationBearish,"Deliberation Bearish. A reversal pattern.\nNison: Not a reversal pattern, but a sign the rally is weakening.\nLitWick reliability: moderate.",""); WriteIf(CounterAttackBearish,"Counter Attack Bearish.\nNison: A potential