Don't like ads? PRO users don't see any ads ;-)
Guest

Comments on Candles

By: shivangi on Jun 30th, 2012  |  syntax: C++  |  size: 31.51 KB  |  hits: 229  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. _SECTION_BEGIN("Candlestick Commentary Modified");
  2. //------------------------------------------------------------------------------
  3. //
  4. //  Formula Name:    Candlestick Commentary Modified
  5. //  Author/Uploader: AbdulKareem
  6. //  E-mail:          
  7. //  Date/Time Added: 2006-11-15 09:45:56
  8. //  Origin:          
  9. //  Keywords:        
  10. //  Level:           basic
  11. //  Flags:           commentary
  12. //  Formula URL:     http://www.amibroker.com/library/formula.php?id=760
  13. //  Details URL:     http://www.amibroker.com/library/detail.php?id=760
  14. //
  15. //------------------------------------------------------------------------------
  16. //
  17. //  A small changes to the formula to clarify the result displayed.
  18. //
  19. //------------------------------------------------------------------------------
  20.  
  21. /*******************************************************
  22. Modified by Abdulkareem Alghamdi
  23. Candlestick Commentary
  24. Load this file into the Commentary Option of the Analysis tab. Green arrows indicate bullish candles.
  25. Red arrows indicate bearish candles. Scroll down the commentary for comments.
  26. This is a work in progress. Thanks to all on this forum whose code I may have incorporated into this file. Comments are from Steve Nison "Japanese Candlestick Charting Techniques" and the LitWick web site.
  27. **********************************************************/
  28. SetChartOptions(0,chartShowArrows|chartShowDates);
  29. _N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
  30. Plot( C, "Close", ParamColor("Color", colorWhite ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
  31.  
  32.  
  33.  
  34.  
  35. /*Body Colors*/
  36. whiteBody=C>=O;
  37. blackBody=O>C;
  38.  
  39. /*Body Size*/
  40. smallBodyMaximum=0.0025;//less than 0.25%
  41. LargeBodyMinimum=0.01;//greater than 1.0%
  42. smallBody=(O>=C*(1-smallBodyMaximum) AND whiteBody)
  43.          OR (C>=O*(1-smallBodyMaximum) AND blackBody);
  44. largeBody=(C>=O*(1+largeBodyMinimum) AND whiteBody)
  45.          OR C<=O*(1-largeBodyMinimum) AND blackBody;
  46. mediumBody=NOT LargeBody AND NOT smallBody;
  47. identicalBodies=abs(abs(Ref(O,-1)-Ref(C,-1))-abs(O-C)) <
  48.           abs(O-C)*smallBodyMaximum;
  49. realBodySize=abs(O-C);
  50.  
  51.  
  52. /*Shadows*/
  53. smallUpperShadow=(whiteBody AND H<=C*(1+smallBodyMaximum))
  54.                OR (blackBody AND H<=O*(1+smallBodyMaximum));
  55. smallLowerShadow=(whiteBody AND L>=O*(1-smallBodyMaximum))
  56.                OR (blackBody AND L>=C*(1-smallBodyMaximum));
  57. largeUpperShadow=(whiteBody AND H>=C*(1+largeBodyMinimum))
  58.                OR (blackBody AND H>=O*(1+largeBodyMinimum));
  59. largeLowerShadow=(whiteBody AND L<=O*(1-largeBodyMinimum))
  60.               OR (blackBody AND L<=C*(1-largeBodyMinimum));
  61.  
  62. /*Gaps*/
  63. upGap=  IIf(Ref(blackBody,-1)AND whiteBody AND O>Ref(O,-1),1,
  64.         IIf(Ref(blackbody,-1) AND blackBody AND C>Ref(O,-1),1,
  65.         IIf(Ref(whiteBody,-1) AND whiteBody AND O>Ref(C,-1),1,
  66.         IIf(Ref(whiteBody,-1) AND blackBody AND C>Ref(C,-1),1,0))));
  67.  
  68. downGap=IIf(Ref(blackBody,-1)AND whiteBody AND C<Ref(C,-1),1,
  69.         IIf(Ref(blackbody,-1) AND blackBody AND O<Ref(C,-1),1,
  70.         IIf(Ref(whiteBody,-1) AND whiteBody AND C<Ref(O,-1),1,
  71.         IIf(Ref(whiteBody,-1) AND blackBody AND O<Ref(O,-1),1,0))));
  72.  
  73.  
  74. /*Candle Definitions*/
  75. spinningTop=mediumBody;
  76. doji=CdDoji(threshold=0.05);/*abs(C-O) <= (C*smallBodyMaximum) OR
  77. (abs(O-C)<=((H-L)*0.1));*/
  78. dojiStar=doji AND (upgap OR downgap)AND Ref(LargeBody,-1);
  79. marabuzu=LargeBody AND smallUpperShadow AND smallLowerShadow;
  80.  
  81. shootingStar=/*(NOT largeBody AND smallLowerShadow AND LargeUpperShadow) OR*/
  82.     smallLowerShadow AND NOT doji AND
  83.    ((blackBody AND abs(O-H)>2*realBodySize) OR
  84.    (whiteBody AND abs(H-C)>2*realBodySize));
  85.  
  86. Hammer=smallUpperShadow AND NOT doji AND
  87.    ((blackBody AND abs(C-L)>2*realBodySize) OR
  88.    (whiteBody AND abs(L-O)>2*realBodySize));
  89.  
  90. tweezerTop=abs(H-Ref(H,-1))<=H*0.0025;
  91. tweezerBottom=abs(L-Ref(L,-1))<=L*0.0025;
  92. engulfing=
  93.    IIf(blackBody AND Ref(blackbody,-1) AND C<Ref(C,-1) AND O>Ref(O,-1),1,
  94.    IIf(blackBody AND Ref(whiteBody,-1) AND O>Ref(C,-1) AND C<Ref(O,-1),1,
  95.    IIf(whitebody AND Ref(whitebody,-1) AND C>Ref(C,-1) AND O<Ref(O,-1),1,
  96.    IIf(whiteBody AND Ref(blackBody,-1) AND C>Ref(O,-1)AND O<Ref(C,-1),1,0))));
  97. Harami=
  98.    IIf(blackbody AND Ref(blackBody,-1) AND O<Ref(O,-1) AND C>Ref(C,-1),1,
  99.    IIf(blackBody AND Ref(whiteBody,-1) AND C>Ref(O,-1) AND O<Ref(C,-1),1,
  100.    IIf(whiteBody AND Ref(whiteBody,-1) AND C<Ref(C,-1) AND O>Ref(O,-1),1,
  101.    IIf(whiteBody AND Ref(blackBody,-1) AND O>Ref(C,-1) AND C<Ref(O,-1),1,0))));
  102.  
  103.  
  104. /*Maximum High Today - (MHT)
  105. Today is the maximum High in the last 5 days*/
  106. MHT=  HHV(H,5)==H;
  107.  
  108. /*Maximum High Yesterday - (MHY)
  109. Yesterday is the maximum High in the last 5 days*/
  110. MHY=   HHV(H,5)==Ref ( H, -1);
  111.  
  112. /*Minimum Low Today - (MLT)
  113. Today is the minimum Low in the last 5 days*/
  114. MLT=   LLV(L,5)==L;
  115.  
  116. /*Minimum Low Yesterday - (MLY)
  117. Yesterday is the minimum Low in the last 5 days*/
  118. MLY=   LLV(L,5)==Ref(L,-1);
  119.  
  120. /*DOJI definitions*/
  121.  
  122. /*Doji Today - (DT)*/
  123. DT = abs(C-O) <= (C*smallBodyMaximum) OR
  124. (abs(O-C)<=((H-L)*0.1));
  125.  
  126. /* Doji Yesterday - (DY)*/
  127. DY = abs(Ref ( C, -1)-Ref(O,-1)) <= Ref ( C, -1) *smallBodyMaximum OR
  128. abs (Ref ( O, -1)-Ref(C,-1)) <= (Ref ( H, -1 ) - Ref ( L, -1 ) )*0.1;
  129.  
  130. /**************************************************
  131.              BULLISH CANDLESTICKS
  132. *************************************************** */
  133.  
  134. /* Abandoned Baby Bullish*/
  135. abandonedBabybullish =Ref(largeBody,-2) AND Ref(blackBody,-2)//Large black candle
  136.              AND Ref(GapDown(),-1)  
  137.              AND whiteBody AND LargeBody AND GapUp();//Large white candle
  138.  
  139. /* Belt Hold*///Bad formula
  140. beltHoldBullish = largeBody AND smallLowerShadow AND whiteBody AND MLT;
  141.  
  142.  
  143. /*BreakAway Bullish*/
  144. breakAwayBullish=Ref(Largebody,-4) AND Ref(blackBody,-4)
  145.               AND Ref(blackBody,-3) AND Ref(O,-3)<Ref(C,-4)
  146.               AND Ref(smallbody,-2) AND Ref(C,-2)<Ref(C,-3)
  147.               AND Ref(C,-1)<Ref(C,-2)
  148.               AND LargeBody AND whiteBody AND C>Ref(O, -3)
  149.               AND C<Ref(C,-4);
  150.  
  151. /*Concealing Baby Swallow only one trade */
  152. ConcealingBabySwallow=Ref(marabuzu,-3) AND Ref(blackbody,-3) AND
  153.                       Ref(MArabuzu,-2) AND Ref(blackBody,-2) AND
  154.                       Ref(blackBody,-1) AND Ref(downGap,-1) AND
  155.                       Ref(H,-1)>Ref(C,-2)AND Ref(blackbody,-1)AND
  156.                       blackBody AND engulfing;
  157.  
  158. /*Doji Star Bullish*/
  159. dojiStarBullish=(dojiStar AND (MLT OR MLY))OR
  160.    (doji AND (C<Ref(C,-1) OR O<Ref(C,-1))AND Ref(blackBody,-1)
  161.     AND Ref(LargeBody,-1));
  162.  
  163. /*Engulfing Bullish*/  
  164. engulfingBullish =
  165.     engulfing AND largeBody AND whiteBody AND
  166.     (Ref(blackbody,-1) OR Ref(Doji,-1)) AND MLT;
  167.  
  168. /*Hammer Bullish*/
  169. hammerBullish=Hammer AND (MLT OR MLY);
  170.  
  171. /*Dragonfly Doji Bullish*/
  172. dragonflyDoji=smallBody AND LargeLowerShadow AND smallUpperShadow AND MLT;
  173.  
  174. /* Harami Bullish*/
  175. haramiBullish = harami AND Ref (LargeBody,-1) AND Ref(blackBody,-1) AND
  176.                 NOT LargeBody AND whiteBody;
  177.  
  178. /*Harami Cross*/
  179. HaramiCross=harami AND Ref(LargeBody,-1) AND Ref(blackBody,-1) AND doji;
  180.        
  181. /* Homing Pigeon*/
  182. homingPigeon =  Ref(largeBody,-1) AND Ref(blackBody,-1) AND
  183.                 H<= Ref ( O, -1 ) AND L>=Ref( C, -1) AND C<O AND MLY;
  184.  
  185. /*Inverted Hammer*/
  186. invertedHammer=shootingStar AND (MLT OR MLY);
  187.  
  188. /* Meeting LinesBullish*/
  189. meetingLinesbullish= Ref(LargeBody,-1) AND Ref(blackBody,-1) AND
  190.                      LargeBody AND whiteBody AND
  191.                      C>Ref(C,-1)*0.9975 AND C< Ref(C,-1)*1.0025;
  192.  
  193. /*Morning Doji Star*/
  194. morningDojiStar= Ref(LargeBody,-2) AND Ref(blackBody,-2) AND
  195.                  Ref(doji,-1) AND Ref(O,-1)<Ref(C,-2) AND
  196.                  whiteBody AND C>Ref(C,-2) AND MLY;
  197.  
  198. /* Morning Star*/
  199. morningStar =Ref(largeBody,-2) AND Ref(blackBody,-2)//Large black candle
  200.              AND Ref(downGap,-1)//Gap down yesterday
  201.              AND whiteBody AND LargeBody AND C>Ref(C,-2)//Large white candle today
  202.              AND MLY; //Yesterday was the low
  203.  
  204. /* Piercing Line*/
  205. piercingLine= Ref(largeBody,-1) AND Ref(blackBody,-1)AND
  206.                O<Ref(L,-1) AND C>=(Ref(O,-1)+Ref(C,-1))/2 AND C<Ref(O,-1) AND MLT;
  207.  
  208. /* Stick Sandwich*/
  209. stickSandwich=Ref(largeBody,-2) AND Ref(blackbody,-2) AND
  210.               Ref(largeBody,-1) AND Ref(whiteBody,-1) AND
  211.               Ref(O,-1)>=Ref(C,-2) AND O>=Ref(C,-1) AND
  212.               abs(C-Ref(C,-2))<=C*0.0025;
  213.  
  214. /*Three Inside Up harami confirming*/
  215. threeInsideUp =Ref(Haramibullish,-1) AND whiteBody AND
  216.     largeBody AND C>Ref(C,-1);
  217.  
  218.  
  219. /* Three Outside Up Engulfing confirmation*/
  220. threeOutsideUp =Ref(engulfingBullish,-1) AND whiteBody AND C>Ref(C,-1);
  221.  
  222. /* Three Stars in the South*///Rewrite???
  223. threeStarsInTheSouth=
  224.    Ref(LargeBody,-2) AND Ref(blackBody,-2) AND Ref(largelowerShadow,-2)
  225.    AND Ref(blackBody,-1) AND Ref(largeLowerShadow,-1) AND
  226.    Ref(L,-1)>Ref(L,-2) AND blackBody AND smallUpperShadow AND
  227.    smallLowerShadow AND L>Ref(L,-1) AND H<Ref(H,-1);
  228.  
  229. /* Tri-Star Bullish*/
  230. triStarBullish=Ref(doji,-2) AND Ref(doji,-1) AND doji AND MLY AND
  231.    Ref(downgap,-1) AND upGap;
  232.  
  233. /* Three River Bottom Bad formula*/
  234. threeriverBottom=Ref(largeBody,-2) AND Ref(blackBody,-2) AND
  235.                  Ref(blackbody,-1) AND Ref(Largelowershadow,-1) AND
  236.                  Ref(O,-1)<Ref(O,-2) AND Ref(C,-1)>Ref(C,-2) AND
  237.                  whiteBody AND C<Ref(C,-1) AND MLY;  
  238.                    
  239. /* Mat Hold Bullish*/
  240. MAtHoldBullish=Ref(LargeBody,-4) AND Ref(whiteBody,-4)//1st day
  241.    AND Ref(blackBody,-3) AND Ref(upGap,-3) AND NOT Ref(LargeBody,-3)
  242.    AND NOT Ref(LargeBody,-2) AND Ref(C,-2)<Ref(C,-3) AND Ref (O,-2)<Ref(O,-3) AND
  243.    Ref(C,-2)>Ref(O,-4) AND NOT Ref(LargeBody,-1) AND Ref(C,-1)<Ref(C,-2)
  244.    AND LargeBody AND whiteBody AND C>Ref(C,-4);
  245.  
  246. /*RisingThreeMethods*/
  247. risingThreeMethods=Ref(LargeBody,-4) AND Ref(whiteBody,-4) AND NOT
  248.   Ref(LargeBody,-3) AND NOT Ref(LargeBody,-2)AND NOT Ref(LargeBody,-1) AND
  249.   Ref(C,-3)<Ref(C,-4) AND Ref(C,-2)<Ref(C,-3) AND Ref(C,-1)<Ref(C,-2) AND
  250.   LargeBody AND whitebody AND C>Ref(C,-4);
  251.  
  252. /* Seperating Lines Bullish*/
  253. separatingLinesBullish=Ref(blackBody,-1) AND whiteBody AND LargeBody AND
  254. smallLowerShadow AND MHT AND abs(O-Ref(O,-1))<=O*0.0025;
  255.  
  256. /*Side by Side White Lines*/
  257. sideBySideWhiteLines=NOT Ref(smallBody,-2) AND Ref(whiteBody,-2)
  258.    AND Ref(upGap,-1) AND Ref(whitebody,-1)AND whiteBody AND
  259.    identicalBodies AND abs(O-Ref(O,-1))<O*0.0025;
  260.  
  261.  
  262. /*Three White Soldiers*/
  263. threeWhiteSoldiers=NOT Ref(smallbody,-2) AND Ref(whiteBody,-2) AND NOT
  264.    Ref(smallBody,-1) AND Ref(whiteBody,-1) AND NOT
  265.    smallBody AND whiteBody AND C>Ref(C,-1) AND Ref(C,-1)>Ref(C,-2) AND
  266.    Ref(O,-1)>Ref(O,-2) AND Ref(O,-1)<Ref(C,-2) AND O<Ref(C,-1) AND
  267.    O>Ref(O,-1) AND Ref(smallUpperShadow,-2) AND
  268.    Ref(smallUpperShadow,-1) AND smallUppershadow AND LLV(L,12)==Ref(L,-2);
  269.  
  270. /*Upside Gap Three Methods not very good*/
  271. upsideGapThreeMethods=Ref(Largebody,-2) AND Ref(whiteBody,-2) AND
  272.    Ref(LargeBody,-1) AND Ref(whiteBody,-1) AND Ref(upGap,-1) AND
  273.    blackBody AND O>Ref(O,-1) AND C<Ref(C,-2)AND C>Ref(O,-2) AND
  274.   MHY;
  275.  
  276. /*Three Line Strike not good signals*/
  277. threeLineStrike=NOT Ref(smallBody,-3) AND NOT Ref(smallBody,-2) AND
  278.    NOT Ref(smallBody,-1) AND Ref(whiteBody,-3) AND Ref(whiteBody,-2) AND
  279.    Ref(whiteBody,-1) AND Ref(C,-1)>Ref(C,-2) AND Ref(C,-2)>Ref(C,-3) AND
  280.    blackBody AND O>Ref(C,-1) AND C<Ref(O,-3);
  281.  
  282. /*Tweezer Bottom*/
  283. tweezerBottom= (abs(L-Ref(L,-1))/L<0.0025 OR
  284.                abs(L-Ref(L,-2))/L<0.0025)
  285.                AND (MLT OR MLY);
  286.  
  287. /*Upside Tasuki Gap*/
  288. upsideTasukiGap=Ref(largeBody,-2) AND Ref(largeBody,1) AND
  289.    Ref(whiteBody,-2) AND Ref(whiteBody,-1) AND Ref(upGap,-1) AND
  290.    blackBody AND O>Ref(O,-1) AND C<Ref(O,-1) AND C>Ref(C,-2) AND
  291.    identicalBodies AND O<Ref(C,-1);
  292.    //AND HHV(H,5)==Ref(H,-1); Do not use this line
  293.  
  294.  
  295. /*****************************************
  296.             BEARISH CANDLESTICKS
  297. ******************************************/
  298.  
  299. /*Abandoned Baby Bearish*/
  300. AbandonedBabyBearish=Ref(LargeBody,-2) AND Ref(whiteBody,-2) AND
  301.    Ref(smallBody,-1) AND Ref(GapUp(),-1) AND GapDown() AND
  302.    NOT smallBody AND blackBody AND MHY;
  303.  
  304. /*Advance Block Bearish*/
  305. AdvanceBlockBearish=Ref(LargeBody,-2) AND Ref(whiteBody,-2)
  306.     AND Ref(whiteBody,-1) AND
  307.    whiteBody AND Ref(O,-1)>Ref(O,-2) AND Ref(O,-1)<Ref(C,-2) AND
  308.    Ref(C,-1)>Ref(C,-2) AND C>Ref(C,-1) AND
  309.    O<Ref(C,-1) AND O>Ref(O,-1) AND Ref(LargeUpperShadow,-1) AND LargeUpperShadow
  310.    AND C-O<Ref(C,-1)-Ref(O,-1) AND Ref(C,-1)-Ref(O,-1) < Ref(C,-2)-Ref(O,-2);
  311.  
  312. /*Belt Hold Bearish*/
  313. beltHoldBearish=LargeBody AND BlackBody AND smalluppershadow AND MHT;
  314.  
  315. /*Breakaway Bearish*/
  316. breakAwayBearish=Ref(LargeBody,-4) AND Ref(whiteBody,-4) AND
  317.    Ref(GapUp(),-3) AND Ref(whiteBody,-3) AND
  318.    Ref(smallbody,-2) AND Ref(smallBody,-1) AND
  319.    blackBody AND O>Ref(O,-3) AND C<Ref(C,-4);
  320.  
  321. /*Dark Cloud Cover*/
  322. darkCloudCover=Ref(LargeBody,-1) AND Ref(whiteBody,-1) AND
  323.    blackBody AND O>Ref(H,-1) AND C>Ref(O,-1) AND C<(Ref(O,-1)+Ref(C,-1))/2
  324.    AND MHT;
  325.  
  326. /*Deliberation Bearish: needs confirmation*/
  327. deliberationBearish=Ref(LargeBody,-2) AND Ref(whiteBody,-2) AND
  328.    Ref(LargeBody,-1) AND Ref(whiteBody,-1) AND Ref(C,-1)>Ref(C,-2) AND
  329.    smallbody AND upGap;
  330.  
  331. /*CounterAttackBearish*/
  332. CounterAttackBearish=MHT AND LargeBody AND blackbody AND
  333.    Ref(largeBody,-1) AND Ref(whiteBody,-1) AND
  334.    C<Ref(C,-1)*1.0025 AND C>Ref(C,-1)*0.9975;;
  335.  
  336. /*Doji Star Bearish*/
  337. dojiStarBearish=(dojiStar AND (MHT OR MHY))OR
  338.    (doji AND (C>Ref(C,-1) OR O>Ref(C,-1))AND Ref(whiteBody,-1)
  339.     AND Ref(LargeBody,-1));
  340.  
  341. /*Engulfing Bearish*/
  342. engulfingBearish=engulfing AND largeBody AND blackBody AND
  343.     (Ref(whitebody,-1) OR Ref(Doji,-1))AND (MHT OR MHY);
  344.  
  345. /*Evening Doji Star check formula???*/
  346. eveningDojiStar=Ref(LargeBody,-2) AND Ref(whiteBody,-2) AND
  347.    Ref(dojiStar,-1) AND Ref(GapUp(),-1) AND (MHY OR MHT);
  348.  
  349. /*Evening Star*/
  350. eveningStar=Ref(LargeBody,-2) AND Ref(whiteBody,-2) AND
  351.    Ref(upGap,-1) AND NOT Ref(largeBody,-1) AND blackBody AND NOT smallBody AND
  352.    (MHT OR MHY);
  353.  
  354. /*Hammer Bearish*/
  355. HammerBearish=Hammer AND HHV(H,8)==H;
  356.  
  357. /*hangingMan*/
  358. HangingMan=NOT largeBody AND smallUpperShadow AND LargeLowerShadow AND MHT;
  359.  
  360. /*dragonfly Doji Bearish*/
  361. dragonflyDojiBearish=doji AND smallUpperShadow AND LargeLowerShadow AND MHT;
  362.    
  363. /*Harami Bearish-*/
  364. HaramiBearish=harami AND Ref(Largebody,-1) AND Ref(whiteBody,-1)AND blackBody
  365. AND (MHY OR MHT);
  366.  
  367. /*HaramiCross Bearish*/
  368. HaramiCrossBearish=harami AND doji AND Ref(whiteBody,-1) AND Ref(Largebody,-1);
  369.  
  370. /*Identical three black crows*/
  371. idendicalThreeBlackCrows=Ref(blackBody,-2) AND Ref(blackBody,-1) AND blackBody AND
  372.    abs(Ref(C,-2)-Ref(O,-1))<Ref(C,-1)*0.0025 AND abs(Ref(C,-1)-O)<O*0.0025 AND
  373.    HHV(H,20)==Ref(H,-2) AND NOT Ref(doji,-2) AND NOT Ref(doji,-1) AND NOT doji AND
  374.    Ref(smallLowerShadow,-2) AND Ref(smallLowerShadow,-1) AND smallLowerShadow;
  375.  
  376. /*Kicking Bearish No trades*/
  377. kickingBearish=Ref(whiteBody,-1) AND Ref(MArabuzu,-1) AND blackBody AND MArabuzu    AND GapDown();
  378.  
  379. /*Meeting Lines Bearish*/
  380. MeetingLinesBearish=Ref(LargeBody,-1) AND Ref(whiteBody,-1) AND
  381.   HHV(C,8)==Ref(C,-1) AND LargeBody AND blackBody AND
  382.   abs(C-Ref(C,-1))<C*0.0025;
  383.  
  384. /*ShootingStar*/
  385. shootingStarGap=shootingStar AND GapUp() AND MHT;
  386.  
  387. /*Gravestone Doji*/
  388. gravestoneDoji=doji AND largeUpperShadow AND smallLowerShadow AND GapUp()AND MHT;
  389.  
  390. /*Three Inside Down Bearish*/
  391. threeInsideDownBearish=Ref(HaramiBearish,-1) AND blackBody AND C<Ref(C,-1)AND    smallUpperShadow;
  392.  
  393. /*Three Outside Down Bearish*/
  394. threeoutsideDownBearish=Ref(engulfingBearish,-1) AND blackBody AND C<Ref(C,-1)AND
  395.    NOT LargeUpperShadow;
  396.  
  397. /*Tri Star Bearish*/
  398. triStarBearish=Ref(doji,-2) AND Ref(doji,-1) AND doji AND MHY AND Ref(upGap,-1)AND    downGap;
  399.  
  400. /*Two Crows Bearish*/
  401. twoCrows=Ref(whiteBody,-2) AND Ref(LargeBody,-2) //first day
  402.    AND Ref(blackBody,-1) AND Ref(upGap,-1)//Second Day
  403.    AND blackBody AND O<Ref(O,-1) AND O>Ref(C,-1)AND C<Ref(C,-2) AND
  404.    C>Ref(O,-2) AND MHY;//Third day
  405.  
  406. /*Upside Gap Two Crows*/
  407. upsideGapTwoCrows= Ref(whiteBody,-2) AND Ref(LargeBody,-2)// first day
  408.    AND Ref(upGap,-1) AND Ref(blackBody,-1) // 2nd day
  409.    AND blackbody AND O>Ref(O,-1) AND C<Ref(C,-1) AND C>Ref(C,-2);
  410.  
  411. /*Doji Star Bearish needs confirmation
  412. dojiStarBearish=Ref(LargeBody,-1) AND Ref(whiteBody,-1) // first day
  413.    AND doji AND upGap AND MHT;*/
  414.  
  415. /* Downside Gap Three Methods*/
  416. downsideGapThreeMethods=
  417.      Ref(LargeBody,-2) AND Ref(blackBody,-2) AND Ref(downGap,-2) //first day
  418.      AND Ref(LargeBody,-1) AND Ref(blackBody,-1)//2nd day
  419.      AND whitebody AND O<Ref(O,-1) AND C>Ref(C,-2)
  420.      AND LLV(L,8)==Ref(L,-1);
  421.  
  422. /*Downside Tasuki Gap*/
  423. downsideTasukiGap=
  424.    Ref(blackBody,-2)//first day
  425.    AND Ref(blackbody,-1) AND Ref(downgap,-1) //2nd day
  426.    AND whiteBody AND O<Ref(O,-1) AND O>Ref(C,-1) AND C>Ref(O,-1) AND C<Ref(C,-2)
  427.    AND Ref(identicalBodies,-1)                                                                                                                  
  428.    AND LLV(L,15)==Ref(L,-1);
  429.  
  430.  
  431. /*Falling Three Meothods*/
  432. fallingThreeMethods=Ref(LargeBody,-4) AND Ref(blackBody,-4) AND
  433.   /*Ref(doji,-3) AND Ref(doji,-2) AND Ref(doji,-1) AND*/ Ref(C,-1)>Ref(C,-2)
  434.   AND Ref(C,-2)>Ref(C,-3) AND LargeBody AND blackBody AND O>Ref(C,-4) AND
  435.   O<Ref(O,-4) AND C<Ref(O,-4)AND C<Ref(C,-4);
  436.  
  437. /*In Neck Bearish not good*/
  438. inNeckBearish=Ref(LargeBody,-1) AND Ref(blackBody,-1) AND
  439.    whiteBody AND O<Ref(L,-1) AND C<Ref(C,-1)*1.0005 AND C>=Ref(C,-1);
  440.  
  441. /*On Neck Bearish not good*/
  442. OnNeckBearish=Ref(LargeBody,-1) AND Ref(blackBody,-1) AND
  443.    whiteBody AND O<Ref(L,-1) AND C<Ref(L,-1)*1.0025 AND C>=Ref(L,-1)*0.9975;
  444.  
  445. /*separating Lines Bearish*/
  446. separatingLinesBearish=Ref(LargeBody,-1) AND Ref(whiteBody,-1) AND
  447.    blackBody AND O>Ref(O,-1)*0.9975 AND O<=Ref(O,-1)*1.0025;
  448.  
  449. /*Side By Side White Lines Bearish*/
  450. sideBySideWhiteLinesBearish=NOT Ref(smallBody,-2) AND Ref(blackBody,-2) AND
  451.    Ref(whiteBody,-1) AND whiteBody AND Ref(downGap,-1) AND identicalBodies
  452.   AND abs(C-Ref(C,-1)<C*0.0025);
  453.  
  454. /*Three Black Crows*/
  455. threeBlackCrows=Ref(blackBody,-2) AND Ref(blackBody,-1) AND blackBody  AND Ref(C,-1)<Ref(C,-2) AND C<Ref(C,-1) AND HHV(H,8)==Ref(H,-2) AND NOT Ref(doji,-2) AND NOT Ref(doji,-1) AND NOT doji;;
  456.    
  457. /*Three Line Strike no trades*/
  458. threeLineStrike=threeBlackCrows AND whiteBody AND O<Ref(C,-1) AND C>Ref(O,-3);
  459.  
  460. /*Thrusting Bearish*/
  461. thrustingBearish=Ref(blackBody,-1) AND Ref(LargeBody,-1) AND LargeBody AND
  462.    whitebody AND O<Ref(L,-1) AND C<(Ref(O,-1)+Ref(C,-1))/2 AND C>Ref(C,-1);
  463.  
  464. /*Tweezer Top*/
  465. tweezerTop= (abs(H-Ref(H,-1))/H<0.0025 OR
  466.                abs(H-Ref(H,-2))/H<0.0025)
  467.                AND (MHT OR MHY);
  468.  
  469.  
  470.  
  471. /* ***********************************************
  472.                   Buy Rules
  473. **************************************************/
  474. Buy=
  475. abandonedBabybullish OR
  476. beltHoldBullish OR
  477. breakAwayBullish OR
  478. ConcealingBabySwallow OR
  479. engulfingBullish OR
  480. hammerBullish OR
  481. dragonflyDoji OR
  482. dojiStarBullish OR
  483. haramiBullish OR
  484. HaramiCross OR
  485. homingPigeon OR
  486. invertedHammer OR
  487. meetingLinesbullish OR
  488. morningDojiStar OR
  489. morningStar OR
  490. piercingLine OR
  491. stickSandwich OR
  492. threeInsideUp OR
  493. threeOutsideUp OR
  494. threeStarsInTheSouth OR  
  495. triStarBullish OR
  496. threeriverBottom OR
  497. MAtHoldBullish OR
  498. risingThreeMethods OR
  499. separatingLinesBullish OR
  500. sideBySideWhiteLines OR
  501. threeWhiteSoldiers OR
  502. upsideGapThreeMethods OR
  503. threeLineStrike OR
  504. tweezerBottom OR
  505. upsideTasukiGap;
  506.  
  507. /************************************
  508.                     Sell Rules
  509. *************************************/
  510. Sell=
  511. AbandonedBabyBearish OR
  512. advanceBlockBearish OR
  513. beltHoldBearish OR
  514. breakAwayBearish OR
  515. darkCloudCover OR
  516. deliberationBearish OR
  517. CounterAttackBearish OR
  518. engulfingBearish OR
  519. eveningDojiStar OR
  520. eveningStar OR
  521. HangingMan OR
  522. dragonflyDojiBearish OR
  523. HammerBearish OR
  524. HaramiBearish OR
  525. HaramiCrossBearish OR
  526. idendicalThreeBlackCrows OR
  527. kickingBearish OR
  528. MeetingLinesBearish OR
  529. shootingStarGap OR
  530. gravestoneDoji OR
  531. threeInsideDownBearish OR
  532. threeoutsideDownBearish OR
  533. triStarBearish OR
  534. twoCrows OR
  535. upsideGapTwoCrows OR
  536. dojiStarBearish OR
  537. downsideGapThreeMethods OR
  538. downsideTasukiGap OR
  539. fallingThreeMethods OR
  540. inNeckBearish OR
  541. OnNeckBearish OR
  542. separatingLinesBearish OR
  543. sideBySideWhiteLinesBearish OR
  544. threeBlackCrows OR
  545. threeLineStrike OR
  546. thrustingBearish OR
  547. tweezerTop;
  548.  
  549.  
  550. /***************************************
  551.               Commentary
  552. ***************************************
  553.             Bullish Candles
  554. ****************************************/
  555. WriteIf(Buy,"Bullish\n=======\n","")+
  556. WriteIf(abandonedBabybullish,"Abandoned Baby Bullish. \nA reversal pattern.\n\\c16LiWick reliability : High.","")+
  557. WriteIf(beltHoldBullish,"Belt Hold Bullish. \nA reversal pattern.\nNison:The larger the candlestick, the more significant it is.\nLitWick Reliability: Low.","")+  
  558. WriteIf(breakAwayBullish,"Break Away Bullish. \nA reversal pattern.\nLitWick reliability: moderate.","")+
  559. WriteIf(ConcealingBabySwallow,"Concealing Baby Swallow. \nA reversal pattern.\n LitWick reliability: high.","")+
  560. WriteIf(dojiStarBullish,"Bullish doji Star. A reversal pattern.\nNison: Needs confirmation. Better at calling tops.\nLitWick reliability: moderate.","")+
  561. WriteIf(engulfingBullish,"Bullish Engulfing. \nA 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","")+  
  562. WriteIf(hammerBullish,"Bullish Hammer. \nA 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.","")+
  563. WriteIf(dragonflyDoji,"Dragonfly Doji. \nLitWick reliability: moderate.","")+
  564. WriteIf(haramiBullish, "Harami Bullish. \nA reversal pattern.\nNison: Less significant. Pattern needs confirmation.\nLitWick reliability: low.","")+
  565. WriteIf(HaramiCross,"Harami Cross. \nA reversal pattern.\nNison: Better indicator than Harami. Better at calling tops than bottoms.\nLitWick reliability: low.","")+
  566. WriteIf(homingPigeon,"Homing Pigeon. \nA reversal pattern.\nLitWick reliability: moderate.","")+
  567. WriteIf(invertedHammer,"Inverted Hammer. \nA reversal pattern.\nNison:Needs bullish verification.\nLitWick reliability: low.","")+
  568. WriteIf(meetingLinesbullish,"Meeting Lines bullish. \nA reversal pattern.\nLitWick reliability: moderate.","")+
  569. WriteIf(morningDojiStar,"Morning Doji Star. \nA reversal pattern.\nImportant reversal signal.\nLitWick reliability: high.","")+
  570. WriteIf(morningStar,"Morning Star. \nA reversal pattern.\nNison: The stronger the white third body the better.\nLitWick reliability: high.","")+
  571. WriteIf(piercingLine,"Piercing Line. \nA reversal pattern.\nNison: A stron reversal pattern.\nLitWick reliability: moderate.","")+
  572. WriteIf(stickSandwich,"Stick Sandwich. \nA reversal pattern.\nLitWick reliability: moderate.","")+
  573. WriteIf(threeInsideUp,"3 Inside Up. \nA reversal pattern.\nLitWick reliability: high.","")+
  574. WriteIf(threeOutsideUp,"3 Outside Up. \nA reversal pattern.\nLitWick reliability: high.","")+
  575. WriteIf(threeStarsInTheSouth,"3 Stars in the South. \nA reversal pattern.\nLitWick reliability: moderate.","")+
  576. WriteIf(triStarBullish,"Tri-Star Bullish. \nA reversal pattern.\nNison: Significant reversal pattern.\nLitWick reliability: moderate.","")+
  577. WriteIf(threeriverBottom,"3 River Bottom. \nA reversal pattern.\nNison: Selling pressure drying up.\nLit Wick reliability: moderate.","")+
  578. WriteIf(MAtHoldBullish,"Mat Hold Bullish. \nA continuation pattern.\nNison: May have 2-4 black candles.\nLitWick reliability: high. ","")+
  579. WriteIf(risingThreeMethods,"Rising Three Methods. \nA continuation pattern>\nNison: Has more significance if volume of white candle sticks is greater than on black candlesticks.\nLitWick reliability: high.","")+
  580. WriteIf(separatingLinesBullish,"Separating Lines Bullish. \nA continuation pattern.\nNison:    \nLitWick reliability: low.","")+
  581. WriteIf(sideBySideWhiteLines,"Side by Side White Lines. \nA continuation pattern.\nNison: If occurring during a downtrend may only be short covering.\nLitWick reliability: high.","")+
  582. WriteIf(threeWhiteSoldiers,"3 White Soldiers. \nA continuation pattern.\nNison: Positive, but be aware of negative similar stalled pattern and advance block pattern.\nLitWick reliability: high.","")+
  583. WriteIf(upsideGapThreeMethods,"Upside Gap 3 Methods. \nA continuation pattern.\nLitWick reliability: moderate.","")+
  584. WriteIf(threeLineStrike,"3 Line Strike. \nA continuation pattern.\nLitWick reliability: low.","")+
  585. WriteIf(tweezerBottom,"Tweezer Bottom.\nA reversal pattern. With other reversal candles it could indicate a support level.\nNison: Needs confirmation.","")+
  586. WriteIf(upsideTasukiGap,"Upside Tasuki Gap. \nA continuation pattern.\nNison: the real bodies of the two candlesticks in the gap should be about the same size.\nLitWick reliability: moderate.","")+
  587. WriteIf(Buy,"\n-------------------------------------------","");;                                      /***************************************
  588.                  Bearish Candles
  589. ********************************************/
  590. WriteIf(Sell,"Bearish\n=======\n","")+
  591. WriteIf(AbandonedBabyBearish,"Abandoned Baby Bearish. \nA reversal pattern.\nNison: Extremely rare.\nLitWick reliability: high.","")+
  592. WriteIf(advanceBlockBearish,"Advancing Block Bearish. \nA 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.","")+
  593. WriteIf(beltHoldBearish,"Belt Hold Bearish. \nA reversal pattern.\nNison: The longer the height of the belt-hold candle the more significant the pattern.\nLitWick reliability: low.","")+
  594. WriteIf(breakAwayBearish,"Break Away Bearish. \nA reversal pattern.\nLitWick reliability: moderate.","")+
  595. WriteIf(darkCloudCover,"Dark Cloud Cover. \nA 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.","")+
  596. WriteIf(deliberationBearish,"Deliberation Bearish. \nA reversal pattern.\nNison: Not a reversal pattern, but a sign the rally is weakening.\nLitWick reliability: moderate.","")+
  597. WriteIf(CounterAttackBearish,"Counter Attack Bearish.\nNison: A potential stalling of the rally.","")+
  598. WriteIf(engulfingBearish,"Engulfing Bearish. \nA reversal pattern.\nNison: Major reversal signal. Factors increasing patterns importance are\n1) The first day has a very small real body and the second day a very large real body.\n2) The pattern apears after a protracted or very fast move.\n3) Heavy volume on the second day.\n4) The second day engulfs more than one real body.\nLitWick reliability: moderate.","")+
  599. WriteIf(eveningDojiStar,"Evening Doji Star \nA reversal pattern.\nNison: Must be confirmed by long black candle.\nLit Wick reliability: high","")+
  600. WriteIf(eveningStar,"Evening Star. \nA reversal pattern.\nNison: Gap between Second AND third bodies does NOT always occur.\nLitWick reliability: High.","")+
  601. WriteIf(HammerBearish,"Bearish Hammer. \nA reversal pattern.\nNison: More bearish if hammer is black. Needs bearish confirmation. A large gap down on the following day would be a good confirmation.","")+
  602. WriteIf(HangingMan,"Hanging Man. \nA reversal pattern.\nNison: Same as bearish hammer with a large gap down the following day.\nLitWick reliability: low.","")+
  603. WriteIf(dragonflyDojiBearish,"Dragonfly Bearish. \nA reversal pattern.\nNison: Same as Hanging Man.\nLitWick reliability: moderate.","")+
  604. WriteIf(HaramiBearish,"Harami Bearish. \nA reversal pattern.\nNison: Not as significant a reversal pattern as hanging man or engulfing.\nLitWick reliability: low.","")+
  605. WriteIf(HaramiCrossBearish,"Harami Cross Bearish. \nA reversal pattern.\nNison: More significant reversal pattern than Harami. Second day can be white or black.\nLitWick reliability: moderate.","")+
  606. WriteIf(idendicalThreeBlackCrows,"Identical 3 Black Crows. \nA reversal pattern in an uptrend.\nNison:Very bearish.\nLitWick reliability: high. ","")+
  607. WriteIf(kickingBearish,"Kicking Bearish. \nA reversal pattern.\nLitWick reliability: high.","")+
  608. WriteIf(MeetingLinesBearish,"Meeting Lines Bearish. \nA reversal pattern.\nNison:  \nLitWick reliability: moderate, but not as strong as Dark cloud Cover.","")+
  609. WriteIf(shootingStarGap,"Shooting Star. \nA reversal pattern.\nNison:Not major reversal signal as evening star. Ideally real body would gap away from previous body. Needs to appear after an uptrend.\nLitWick reliability: low.","")+
  610. WriteIf(gravestoneDoji,"Gravestone Doji. \nA reversal pattern.\nNison: more significant if it hits new high.\nLitWick reliability: moderate.","")+
  611. WriteIf(threeInsideDownBearish,"3 Inside Down. \nA reversal pattern.\nNison:  \nLitWick reliability: high.","")+
  612. WriteIf(threeoutsideDownBearish,"3 Outside Down. \nA reversal pattern.\nLitWick reliability: high.","")+
  613. WriteIf(triStarBearish,"Tri-Star Bearish. \nA reversal pattern.\nNison: Very significant reversal pattern.\nLitWick reliability: moderate.","")+
  614. WriteIf(twoCrows,"2 Crows. \nA reversal pattern.\nLitWick reliability: moderate.","")+
  615. WriteIf(upsideGapTwoCrows,"Upside Gap 2 Crows. \nA reversal pattern.\nNison:Needs confirmation of a continued reversal on third day.\nLitWick reliability: high.","")+
  616. WriteIf(dojiStarBearish,"Doji Star Bearish. \nA reversal pattern.\nNison: needs confirmation.\nLitWick reliability: moderate.","")+
  617. WriteIf(downsideGapThreeMethods,"Downside Gap 3 Methods. A continuation pattern.\nNison: \nLitWick reliability: moderate.","")+
  618. WriteIf(downsideTasukiGap,"Downside Tasuki Gap. \nA continuation method\nN Nison: If last day closes window, continuation pattern is negated.\nLitWick reliability: moderate.","")+
  619. WriteIf(fallingThreeMethods,"Falling 3 Methods. \nA continuation pattern.\nNison:  \nLitWick reliability: high.","")+
  620. WriteIf(inNeckBearish,"In Neck Bearish. A continuatin pattern.\nNison: Similar to piercing pattern but bearish because there is no penetration of second day.\nLitWick reliability: moderate.","")+
  621. WriteIf(OnNeckBearish,"On Neck Bearish. \nA continuation pattern. Similar to piercing pattern but bearish beccause there is no penetration of the second day.\nLitWick reliability: moderate.","")+
  622. WriteIf(separatingLinesBearish,"Separating Lines Bearish","");
  623. WriteIf(sideBySideWhiteLinesBearish,"Side by Side White Lines Bearish. \nA continuation pattern.\nNison: very rare.\nLitWick reliability: moderate.","")+
  624. WriteIf(threeBlackCrows,"3 Black Crows. \nA reversal pattern.\nNison: Need to appear after a mature advance.\nLitWick reliability: high.","")+  
  625. WriteIf(threeLineStrike,"3 Line Strike. \nA continuation pattern.\nLitWick reliability: low.","")+
  626. WriteIf(thrustingBearish,"Thrusting. \nA continuation pattern.\nNison: Not a reversal day because second day does not pierce midpoint of first day.\nLitWick reliability: low.","")+
  627. WriteIf(tweezerTop,"Tweezer Top. \nA reversal pattern.\nNison: Needs confirmation.","")+
  628. WriteIf(Sell,"\n---------------------------------------------------","");
  629.  
  630.                                                                                          /***********************************************
  631.                End Commentary
  632. ************************************************/
  633.  
  634. _SECTION_END();