Stock Portfolio Organizer
The ultimate porfolio management solution.
Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
WiseTrader Toolbox
#1 Selling Amibroker Plugin featuring:
Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
85% sure candle search based indicator for Amibroker (AFL)
Copy & Paste Friendly
Back
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 | // search historical DAILy data. sorted columns c_candle1 c_candle2 c_candle3 latest // // //SetChartOptions(0,chartShowArrows|chartShowDates); GraphXSpace = 5; /*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 C < Ref ( C ,-1),1, IIf ( Ref (blackbody,-1) AND blackBody AND O < Ref ( C ,-1),1, IIf ( Ref (whiteBody,-1) AND whiteBody AND C < Ref ( O ,-1),1, IIf ( Ref (whiteBody,-1) AND blackBody AND O < Ref ( O ,-1),1,0)))); /*Maximum High Today - (MHT) Today is the maximum High in the last 5 days*/ MHT= HHV ( H ,5)== H ; /*Maximum High Yesterday - (MHY) Yesterday is the maximum High in the last 5 days*/ MHY= HHV ( H ,5)== Ref ( H , -1); /*Minimum Low Today - (MLT) Today is the minimum Low in the last 5 days*/ MLT= LLV ( L ,5)== L ; /*Minimum Low Yesterday - (MLY) Yesterday is the minimum Low in the last 5 days*/ MLY= LLV ( L ,5)== Ref ( L ,-1); /*DOJI definitions*/ /*Doji Today - (DT)*/ DT = abs ( C - O ) <= ( C *smallBodyMaximum) OR ( abs ( O - C )<=(( H - L )*0.1)); /* Doji Yesterday - (DY)*/ DY = abs ( Ref ( C , -1)- Ref ( O ,-1)) <= Ref ( C , -1) *smallBodyMaximum OR abs ( Ref ( O , -1)- Ref ( C ,-1)) <= ( Ref ( H , -1 ) - Ref ( L , -1 ) )*0.1; 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); NearDoji = ( abs ( O - C )<= (( H - L )*0.1)); BlackCandle = ( O > C ); LongBlackCandle = ( O > C AND ( O - C )/(0.001+ H - L )>0.6); SmallBlackCandle = (( O > C ) AND (( H - L )>(3*( O - C )))); WhiteCandle = ( C > O ); LongWhiteCandle = (( C > O ) AND (( C - O )/(0.001+ H - L )>0.6)); SmallWhiteCandle = (( C > O ) AND (( H - L )>(3*( C - O )))); BlackMaubozu = ( O > C AND H == O AND C == L ); WhiteMaubozu = ( C > O AND H == C AND O == L ); BlackClosingMarubozu = ( O > C AND C == L ); WhiteClosingMarubozu = ( C > O AND C == H ); BlackOpeningMarubozu = ( O > C AND O == H ); WhiteOpeningMarubozu = ( C > O AND O == L ); HangingMan = ((( H - L )>4*( O - C )) AND (( C - L )/(0.001+ H - L )>= 0.75) AND (( O - L )/(0.001+ H - L )>= 0.75)); Hammer = ((( H - L )>3*( O - C )) AND (( C - L )/(0.001+ H - L )>0.6) AND (( O - L )/(0.001+ H - L )>0.6)); InvertedHammer = ((( H - L )>3*( O - C )) AND (( H - C )/(0.001+ H - L )>0.6) AND (( H - O )/(0.001+ H - L )>0.6)); ShootingStar = ((( H - L )>4*( O - C )) AND (( H - C )/(0.001+ H - L )>= 0.75) AND (( H - O )/(0.001+ H - L )>= 0.75)); BlackSpinningTop = (( O > C ) AND (( H - L )>(3*( O - C ))) AND ((( H - O )/(0.001+ H - L ))<0.4) AND ((( C - L )/(0.001+ H - L ))<0.4)); WhiteSpinningTop = (( C > O ) AND (( H - L )>(3*( C - O ))) AND ((( H - C )/(0.001+ H - L ))<0.4) AND ((( O - L )/(0.001+ H - L ))<0.4)); BearishAbandonedBaby = ((C1 == O1) AND (C2>O2) AND ( O > C ) AND (L1>H2) AND (L1> H )); BearishEveningDojiStar = ((C2>O2) AND ((C2-O2)/(0.001+H2-L2)>0.6) AND (C2<O1) AND (C1>O1) AND ((H1-L1)>(3*(C1-O1))) AND ( O > C ) AND ( O <O1)); DarkCloudCover = (C1>O1 AND ((C1+O1)/2)> C AND O > C AND O >C1 AND C >O1 AND ( O - C )/(0.001+( H - L )>0.6)); BearishEngulfing = ((C1>O1) AND ( O > C ) AND ( O >= C1) AND (O1>= C ) AND (( O - C )>(C1-O1))); ThreeOutsideDownPattern = ((C2>O2) AND (O1>C1) AND (O1>= C2) AND (O2>= C1) AND ((O1-C1)>(C2-O2)) AND ( O > C ) AND ( C <C1)); BullishAbandonedBaby = ((C1 == O1) AND (O2>C2) AND ( C > O ) AND (L2>H1) AND ( L >H1)); BullishMorningDojiStar = ((O2>C2) AND ((O2-C2)/(0.001+H2-L2)>0.6) AND (C2>O1) AND (O1>C1) AND ((H1-L1)>(3*(C1-O1))) AND ( C > O ) AND ( O >O1)); BullishEngulfing = ((O1>C1) AND ( C > O ) AND ( C >= O1) AND (C1>= O ) AND (( C - O )>(O1-C1))); ThreeOutsideUpPattern = ((O2>C2) AND (C1>O1) AND (C1>= O2) AND (C2>= O1) AND ((C1-O1)>(O2-C2)) AND ( C > O ) AND ( C >C1)); BullishHarami = ((O1>C1) AND ( C > O ) AND ( C <= O1) AND (C1<= O ) AND (( C - O )<(O1-C1))); ThreeInsideUpPattern = ((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)); PiercingLine = ((C1<O1) AND (((O1+C1)/2)< C ) AND ( O < C ) AND ( O <C1) AND ( C <O1) AND (( C - O )/(0.001+( H - L ))>0.6)); BearishHarami = ((C1>O1) AND ( O > C ) AND ( O <= C1) AND (O1<= C ) AND (( O - C )<(C1-O1))); ThreeInsideDownPattern = ((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)); ThreeWhiteSoldiers = ( 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 ))<0.2) AND (((H1-C1)/(H1-L1))<0.2) AND (((H2-C2)/(H2-L2))<0.2); DarkCloudCover = (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); ThreeBlackCrows = ( 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 ))<0.2) AND (((C1-L1)/(H1-L1))<0.2) AND (((C2-L2)/(H2-L2))<0.2); 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); morningStar = Ref (largeBody,-2) AND Ref (blackBody,-2) AND Ref (downGap,-1) AND whiteBody AND LargeBody AND C > Ref ( C ,-2) AND MLY; Doji = ( O == C ); MATCHLOW = LLV ( Low ,8)== LLV ( Low ,2) AND Ref ( Close ,-1)<= Ref ( Open ,-1)*.99 AND abs ( Close - Ref ( Close ,-1))<= Close *.0025 AND Open > Ref ( Close ,-1) AND Open <=( High -(( High - Low )*.5)); GapUpx = GapUp (); GapDownx = GapDown (); BigGapUp = L >1.01*H1; BigGapDown = H <0.99*L1; HugeGapUp = L >1.02*H1; HugeGapDown = H <0.98*L1; DoubleGapUp = GapUp () AND Ref ( GapUp (),-1); DoubleGapDown = GapDown () AND Ref ( GapDown (),-1); txt2= "" ; txt2+= WriteIf (BlackCandle , "BlackCandle " , "" ); txt2+= WriteIf (LongBlackCandle , "LongBlackCandle " , "" ); txt2+= WriteIf (SmallBlackCandle , "SmallBlackCandle " , "" ); txt2+= WriteIf (WhiteCandle , "WhiteCandle " , "" ); txt2+= WriteIf (LongWhiteCandle , "LongWhiteCandle " , "" ); txt2+= WriteIf (SmallWhiteCandle , "SmallWhiteCandle " , "" ); txt2+= WriteIf (BlackMaubozu , "BlackMaubozu " , "" ); txt2+= WriteIf (WhiteMaubozu , "WhiteMaubozu " , "" ); txt2+= WriteIf (BlackClosingMarubozu , "BlackClosingMarubozu " , "" ); txt2+= WriteIf (WhiteClosingMarubozu , "WhiteClosingMarubozu " , "" ); txt2+= WriteIf (BlackOpeningMarubozu , "BlackOpeningMarubozu " , "" ); txt2+= WriteIf (WhiteOpeningMarubozu , "WhiteOpeningMarubozu " , "" ); txt2+= WriteIf (BlackMaubozu , "BlackMaubozu " , "" ); txt2+= WriteIf (BearishHarami , "BearishHarami " , "" ); txt2+= WriteIf (eveningStar , "eveningStar " , "" ); txt2+= WriteIf (Hammer , "Hammer " , "" ); txt2+= WriteIf (InvertedHammer , "InvertedHammer " , "" ); txt2+= WriteIf (PiercingLine , "PiercingLine " , "" ); txt2+= WriteIf (BullishEngulfing , "BullishEngulfing " , "" ); txt2+= WriteIf (BearishEngulfing , "BearishEngulfing " , "" ); txt2+= WriteIf (BullishHarami , "BullishHarami " , "" ); txt2+= WriteIf (BearishHarami , "BearishHarami " , "" ); txt2+= WriteIf (morningStar , "morningStar " , "" ); txt2+= WriteIf (NearDoji , "NearDoji " , "" ); txt2+= WriteIf (Doji , "Doji " , "" ); txt2+= WriteIf (DarkCloudCover , "DarkCloudCover " , "" ); txt2+= WriteIf (invertedHammer , "invertedHammer " , "" ); txt2+= WriteIf (Hammer , "Hammer " , "" ); txt2+= WriteIf (shootingStar , "shootingStar " , "" ); txt2+= WriteIf (invertedHammer , "invertedHammer " , "" ); txt2+= WriteIf (eveningStar , "eveningStar " , "" ); txt2+= WriteIf (darkCloudCover, "darkCloudCover " , "" ); txt2+= WriteIf (smallUpperShadow, "smallUpperShadow " , "" ); txt2+= WriteIf (smallLowerShadow, "smallLowerShadow " , "" ); txt2+= WriteIf (largeUpperShadow , "largeUpperShadow " , "" ); txt2+= WriteIf (largeLowerShadow, "largeLowerShadow " , "" ); txt2+= WriteIf (upGap, "upGap " , "" ); txt2+= WriteIf (downGap, "downGap " , "" ); txt2+= WriteIf (morningStar, "morningStar " , "" ); txt2+= WriteIf (piercingLine, "piercingLine " , "" ); txt2+= WriteIf (threeWhiteSoldiers, "threeWhiteSoldiers " , "" ); txt2+= WriteIf (darkCloudCover, "darkCloudCover " , "" ); txt2+= WriteIf (eveningStar, "eveningStar " , "" ); /*Tweezer Top*/ TweezerTop= abs ( H - Ref ( H ,-1))<= H *0.0025 AND O > C AND ( Ref ( C ,-1) > Ref ( O ,-1)) AND (MHT OR MHY); /*Tweezer Bottom*/ tweezerBottom= ( abs ( L - Ref ( L ,-1))/ L <0.0025 OR abs ( L - Ref ( L ,-2))/ L <0.0025) AND O < C AND ( Ref ( O ,-1) > Ref ( C ,-1)) AND (MLT OR MLY); PATTERN = WriteIf (tweezerTop, "Tweezer Top" , WriteIf (tweezerBottom, "Tweezer Bottom" , "Zilch" )); //Filter = tweezerTop OR tweezerBottom; /*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 C < Ref ( C ,-1),1, IIf ( Ref (blackbody,-1) AND blackBody AND O < Ref ( C ,-1),1, IIf ( Ref (whiteBody,-1) AND whiteBody AND C < Ref ( O ,-1),1, IIf ( Ref (whiteBody,-1) AND blackBody AND O < Ref ( O ,-1),1,0)))); /*Maximum High Today - (MHT) Today is the maximum High in the last 5 days*/ MHT= HHV ( H ,5)== H ; /*Maximum High Yesterday - (MHY) Yesterday is the maximum High in the last 5 days*/ MHY= HHV ( H ,5)== Ref ( H , -1); /*Minimum Low Today - (MLT) Today is the minimum Low in the last 5 days*/ MLT= LLV ( L ,5)== L ; /*Minimum Low Yesterday - (MLY) Yesterday is the minimum Low in the last 5 days*/ MLY= LLV ( L ,5)== Ref ( L ,-1); /*DOJI definitions*/ /*Doji Today - (DT)*/ DT = abs ( C - O ) <= ( C *smallBodyMaximum) OR ( abs ( O - C )<=(( H - L )*0.1)); /* Doji Yesterday - (DY)*/ DY = abs ( Ref ( C , -1)- Ref ( O ,-1)) <= Ref ( C , -1) *smallBodyMaximum OR abs ( Ref ( O , -1)- Ref ( C ,-1)) <= ( Ref ( H , -1 ) - Ref ( L , -1 ) )*0.1; 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); NearDoji = ( abs ( O - C )<= (( H - L )*0.1)); BlackCandle = ( O > C ); LongBlackCandle = ( O > C AND ( O - C )/(0.001+ H - L )>0.6); SmallBlackCandle = (( O > C ) AND (( H - L )>(3*( O - C )))); WhiteCandle = ( C > O ); LongWhiteCandle = (( C > O ) AND (( C - O )/(0.001+ H - L )>0.6)); SmallWhiteCandle = (( C > O ) AND (( H - L )>(3*( C - O )))); BlackMaubozu = ( O > C AND H == O AND C == L ); WhiteMaubozu = ( C > O AND H == C AND O == L ); BlackClosingMarubozu = ( O > C AND C == L ); WhiteClosingMarubozu = ( C > O AND C == H ); BlackOpeningMarubozu = ( O > C AND O == H ); WhiteOpeningMarubozu = ( C > O AND O == L ); HangingMan = ((( H - L )>4*( O - C )) AND (( C - L )/(0.001+ H - L )>= 0.75) AND (( O - L )/(0.001+ H - L )>= 0.75)); Hammer = ((( H - L )>3*( O - C )) AND (( C - L )/(0.001+ H - L )>0.6) AND (( O - L )/(0.001+ H - L )>0.6)); InvertedHammer = ((( H - L )>3*( O - C )) AND (( H - C )/(0.001+ H - L )>0.6) AND (( H - O )/(0.001+ H - L )>0.6)); ShootingStar = ((( H - L )>4*( O - C )) AND (( H - C )/(0.001+ H - L )>= 0.75) AND (( H - O )/(0.001+ H - L )>= 0.75)); BlackSpinningTop = (( O > C ) AND (( H - L )>(3*( O - C ))) AND ((( H - O )/(0.001+ H - L ))<0.4) AND ((( C - L )/(0.001+ H - L ))<0.4)); WhiteSpinningTop = (( C > O ) AND (( H - L )>(3*( C - O ))) AND ((( H - C )/(0.001+ H - L ))<0.4) AND ((( O - L )/(0.001+ H - L ))<0.4)); BearishAbandonedBaby = ((C1 == O1) AND (C2>O2) AND ( O > C ) AND (L1>H2) AND (L1> H )); BearishEveningDojiStar = ((C2>O2) AND ((C2-O2)/(0.001+H2-L2)>0.6) AND (C2<O1) AND (C1>O1) AND ((H1-L1)>(3*(C1-O1))) AND ( O > C ) AND ( O <O1)); DarkCloudCover = (C1>O1 AND ((C1+O1)/2)> C AND O > C AND O >C1 AND C >O1 AND ( O - C )/(0.001+( H - L )>0.6)); BearishEngulfing = ((C1>O1) AND ( O > C ) AND ( O >= C1) AND (O1>= C ) AND (( O - C )>(C1-O1))); ThreeOutsideDownPattern = ((C2>O2) AND (O1>C1) AND (O1>= C2) AND (O2>= C1) AND ((O1-C1)>(C2-O2)) AND ( O > C ) AND ( C <C1)); BullishAbandonedBaby = ((C1 == O1) AND (O2>C2) AND ( C > O ) AND (L2>H1) AND ( L >H1)); BullishMorningDojiStar = ((O2>C2) AND ((O2-C2)/(0.001+H2-L2)>0.6) AND (C2>O1) AND (O1>C1) AND ((H1-L1)>(3*(C1-O1))) AND ( C > O ) AND ( O >O1)); BullishEngulfing = ((O1>C1) AND ( C > O ) AND ( C >= O1) AND (C1>= O ) AND (( C - O )>(O1-C1))); ThreeOutsideUpPattern = ((O2>C2) AND (C1>O1) AND (C1>= O2) AND (C2>= O1) AND ((C1-O1)>(O2-C2)) AND ( C > O ) AND ( C >C1)); BullishHarami = ((O1>C1) AND ( C > O ) AND ( C <= O1) AND (C1<= O ) AND (( C - O )<(O1-C1))); ThreeInsideUpPattern = ((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)); PiercingLine = ((C1<O1) AND (((O1+C1)/2)< C ) AND ( O < C ) AND ( O <C1) AND ( C <O1) AND (( C - O )/(0.001+( H - L ))>0.6)); BearishHarami = ((C1>O1) AND ( O > C ) AND ( O <= C1) AND (O1<= C ) AND (( O - C )<(C1-O1))); ThreeInsideDownPattern = ((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)); ThreeWhiteSoldiers = ( 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 ))<0.2) AND (((H1-C1)/(H1-L1))<0.2) AND (((H2-C2)/(H2-L2))<0.2); DarkCloudCover = (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); ThreeBlackCrows = ( 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 ))<0.2) AND (((C1-L1)/(H1-L1))<0.2) AND (((C2-L2)/(H2-L2))<0.2); 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); morningStar = Ref (largeBody,-2) AND Ref (blackBody,-2) AND Ref (downGap,-1) AND whiteBody AND LargeBody AND C > Ref ( C ,-2) AND MLY; Doji = ( O == C ); MATCHLOW = LLV ( Low ,8)== LLV ( Low ,2) AND Ref ( Close ,-1)<= Ref ( Open ,-1)*.99 AND abs ( Close - Ref ( Close ,-1))<= Close *.0025 AND Open > Ref ( Close ,-1) AND Open <=( High -(( High - Low )*.5)); GapUpx = GapUp (); GapDownx = GapDown (); BigGapUp = L >1.01*H1; BigGapDown = H <0.99*L1; HugeGapUp = L >1.02*H1; HugeGapDown = H <0.98*L1; DoubleGapUp = GapUp () AND Ref ( GapUp (),-1); DoubleGapDown = GapDown () AND Ref ( GapDown (),-1); /*Tweezer Top*/ TweezerTop= abs ( H - Ref ( H ,-1))<= H *0.0025 AND O > C AND ( Ref ( C ,-1) > Ref ( O ,-1)); /*Tweezer Bottom*/ tweezerBottom= ( abs ( L - Ref ( L ,-1))/ L <0.0025 OR abs ( L - Ref ( L ,-2))/ L <0.0025) AND O < C AND ( Ref ( O ,-1) > Ref ( C ,-1)); PATTERN = WriteIf (tweezerTop, "Tweezer Top" , WriteIf (tweezerBottom, "Tweezer Bottom" , "Zilch" )); ///Filter = tweezerTop OR tweezerBottom; //AddTextColumn(PATTERN, "Tweezer Pattern", 5.6, colorWhite, IIf(TweezerTop, colorRed, //IIf(TweezerBottom, colorGreen, colorLightGrey))); //AddTextColumn(C_Status, "Candle Pattern", 5.6, colorWhite, IIf(HangingMan OR ShootingStar OR DarkCloudCover OR BearishEngulfing OR BearishHarami OR eveningStar, colorRed, //IIf(Hammer OR InvertedHammer OR PiercingLine OR BullishEngulfing OR BullishHarami OR morningStar OR MATCHLOW, colorGreen, IIf( NearDoji OR Doji, colorBlue, colorLightGrey)))); /************************************************** ***** Candlestick Commentary Load this file into the Commentary Option of the Analysis tab. Green arrows indicate bullish candles. Red arrows indicate bearish candles. Scroll down the commentary for comments. 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. ************************************************** ********/ /*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 C < Ref ( C ,-1),1, IIf ( Ref (blackbody,-1) AND blackBody AND O < Ref ( C ,-1),1, IIf ( Ref (whiteBody,-1) AND whiteBody AND C < Ref ( O ,-1),1, IIf ( Ref (whiteBody,-1) AND blackBody AND O < Ref ( O ,-1),1,0)))); /*Candle Definitions*/ spinningTop=mediumBody; doji=CdDoji(threshold=0.05); /*abs(C-O) <= (C*smallBodyMaximum) OR (abs(O-C)<=((H-L)*0.1));*/ dojiStar=doji AND (upgap OR downgap) AND Ref (LargeBody,-1); marabuzu=LargeBody AND smallUpperShadow AND smallLowerShadow; shootingStar= /*(NOT largeBody AND smallLowerShadow AND LargeUpperShadow) OR*/ smallLowerShadow AND NOT doji AND ((blackBody AND abs ( O - H )>2*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 C < Ref ( C ,-1) AND O > Ref ( O ,-1),1, IIf (blackBody AND Ref (whiteBody,-1) AND O > Ref ( C ,-1) AND C < Ref ( O ,-1),1, IIf (whitebody AND Ref (whitebody,-1) AND C > Ref ( C ,-1) AND O < Ref ( O ,-1),1, IIf (whiteBody AND Ref (blackBody,-1) AND C > Ref ( O ,-1) AND O < Ref ( C ,-1),1,0)))); Harami= IIf (blackbody AND Ref (blackBody,-1) AND O < Ref ( O ,-1) AND C > Ref ( C ,-1),1, IIf (blackBody AND Ref (whiteBody,-1) AND C > Ref ( O ,-1) AND O < Ref ( C ,-1),1, IIf (whiteBody AND Ref (whiteBody,-1) AND C < Ref ( C ,-1) AND O > Ref ( O ,-1),1, IIf (whiteBody AND Ref (blackBody,-1) AND O > Ref ( C ,-1) AND C < Ref ( O ,-1),1,0)))); /*Maximum High Today - (MHT) Today is the maximum High in the last 5 days*/ MHT= HHV ( H ,5)== H ; /*Maximum High Yesterday - (MHY) Yesterday is the maximum High in the last 5 days*/ MHY= HHV ( H ,5)== Ref ( H , -1); /*Minimum Low Today - (MLT) Today is the minimum Low in the last 5 days*/ MLT= LLV ( L ,5)== L ; /*Minimum Low Yesterday - (MLY) Yesterday is the minimum Low in the last 5 days*/ MLY= LLV ( L ,5)== Ref ( L ,-1); /*DOJI definitions*/ /*Doji Today - (DT)*/ DT = abs ( C - O ) <= ( C *smallBodyMaximum) OR ( abs ( O - C )<=(( H - L )*0.1)); /* Doji Yesterday - (DY)*/ DY = abs ( Ref ( C , -1)- Ref ( O ,-1)) <= Ref ( C , -1) *smallBodyMaximum OR abs ( Ref ( O , -1)- Ref ( C ,-1)) <= ( Ref ( H , -1 ) - Ref ( L , -1 ) )*0.1; /************************************************** BULLISH CANDLESTICKS ************************************************** * */ /* Abandoned Baby Bullish*/ abandonedBabybullish = Ref (largeBody,-2) AND Ref (blackBody,-2) //Large black candle AND Ref ( GapDown (),-1) AND whiteBody AND LargeBody AND GapUp (); //Large white candle /* Belt Hold*/ //Bad formula beltHoldBullish = largeBody AND smallLowerShadow AND whiteBody AND MLT; /*BreakAway Bullish*/ breakAwayBullish= Ref (Largebody,-4) AND Ref (blackBody,-4) AND Ref (blackBody,-3) AND Ref ( O ,-3)< Ref ( C ,-4) AND Ref (smallbody,-2) AND Ref ( C ,-2)< Ref ( C ,-3) AND Ref ( C ,-1)< Ref ( C ,-2) AND LargeBody AND whiteBody AND C > Ref ( O , -3) AND C < Ref ( C ,-4); /*Concealing Baby Swallow only one trade */ ConcealingBabySwallow= Ref (marabuzu,-3) AND Ref (blackbody,-3) AND Ref (MArabuzu,-2) AND Ref (blackBody,-2) AND Ref (blackBody,-1) AND Ref (downGap,-1) AND Ref ( H ,-1)> Ref ( 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) OR O < Ref ( C ,-1)) AND Ref (blackBody,-1) AND Ref (LargeBody,-1)); /*Engulfing Bullish*/ engulfingBullish = engulfing AND largeBody AND whiteBody AND ( Ref (blackbody,-1) OR Ref (Doji,-1)) AND MLT; /*Hammer Bullish*/ hammerBullish=Hammer AND (MLT OR MLY); /*Dragonfly Doji Bullish*/ dragonflyDoji=smallBody AND LargeLowerShadow AND smallUpperShadow AND MLT; /* Harami Bullish*/ haramiBullish = harami AND Ref (LargeBody,-1) AND Ref (blackBody,-1) AND NOT LargeBody AND whiteBody; /*Harami Cross*/ HaramiCross=harami AND Ref (LargeBody,-1) AND Ref (blackBody,-1) AND doji; /* Homing Pigeon*/ homingPigeon = Ref (largeBody,-1) AND Ref (blackBody,-1) AND H <= Ref ( O , -1 ) AND L >= Ref ( C , -1) AND C < O AND MLY; /*Inverted Hammer*/ invertedHammer=shootingStar AND (MLT OR MLY); /* Meeting LinesBullish*/ meetingLinesbullish= Ref (LargeBody,-1) AND Ref (blackBody,-1) AND LargeBody AND whiteBody AND C > Ref ( 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 whiteBody AND C > 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 ( L ,-1) AND C >=( Ref ( O ,-1)+ Ref ( C ,-1))/2 AND C < Ref ( O ,-1) AND MLT; /* Stick Sandwich*/ stickSandwich= Ref (largeBody,-2) AND Ref (blackbody,-2) AND Ref (largeBody,-1) AND Ref (whiteBody,-1) AND Ref ( O ,-1)>= 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 H < Ref ( H ,-1); /* Tri-Star Bullish*/ triStarBullish= Ref (doji,-2) AND Ref (doji,-1) AND doji AND MLY AND Ref (downgap,-1) AND upGap; /* Three River Bottom Bad formula*/ threeriverBottom= Ref (largeBody,-2) AND Ref (blackBody,-2) AND Ref (blackbody,-1) AND Ref (Largelowershadow,-1) AND Ref ( O ,-1)< Ref ( O ,-2) AND Ref ( C ,-1)> Ref ( C ,-2) AND whiteBody AND C < Ref ( C ,-1) AND MLY; /* Mat Hold Bullish*/ MAtHoldBullish= Ref (LargeBody,-4) AND Ref (whiteBody,-4) //1st day AND Ref (blackBody,-3) AND Ref (upGap,-3) AND NOT Ref (LargeBody,-3) AND NOT Ref (LargeBody,-2) AND Ref ( C ,-2)< Ref ( C ,-3) AND Ref ( O ,-2)< Ref ( O ,-3) AND Ref ( C ,-2)> Ref ( O ,-4) AND NOT Ref (LargeBody,-1) AND Ref ( C ,-1)< Ref ( C ,-2) AND LargeBody AND whiteBody AND C > 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) AND Ref ( C ,-2)< Ref ( C ,-3) AND Ref ( C ,-1)< Ref ( C ,-2) AND LargeBody AND whitebody AND C > 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))< O *0.0025; /*Three White Soldiers*/ threeWhiteSoldiers= NOT Ref (smallbody,-2) AND Ref (whiteBody,-2) AND NOT Ref (smallBody,-1) AND Ref (whiteBody,-1) AND NOT smallBody AND whiteBody AND C > Ref ( C ,-1) AND Ref ( C ,-1)> Ref ( C ,-2) AND Ref ( O ,-1)> Ref ( O ,-2) AND Ref ( O ,-1)< Ref ( C ,-2) AND O < Ref ( C ,-1) AND O > 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 C < Ref ( C ,-2) AND C > Ref ( 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 C < Ref ( O ,-3); /*Tweezer Bottom*/ tweezerBottom= ( abs ( L - Ref ( L ,-1))/ L <0.0025 OR abs ( L - Ref ( L ,-2))/ L <0.0025) AND O < C AND ( Ref ( O ,-1) > Ref ( C ,-1)); /*Upside Tasuki Gap*/ upsideTasukiGap= Ref (largeBody,-2) AND Ref (largeBody,1) AND Ref (whiteBody,-2) AND Ref (whiteBody,-1) AND Ref (upGap,-1) AND blackBody AND O > Ref ( O ,-1) AND C < Ref ( O ,-1) AND C > Ref ( C ,-2) AND identicalBodies AND O < Ref ( C ,-1); //AND HHV(H,5)==Ref(H,-1); Do not use this line /***************************************** BEARISH CANDLESTICKS ******************************************/ /*Abandoned Baby Bearish*/ AbandonedBabyBearish= Ref (LargeBody,-2) AND Ref (whiteBody,-2) AND Ref (smallBody,-1) AND Ref ( GapUp (),-1) AND GapDown () AND NOT smallBody AND blackBody AND MHY; /*Advance Block Bearish*/ AdvanceBlockBearish= Ref (LargeBody,-2) AND Ref (whiteBody,-2) AND Ref (whiteBody,-1) AND whiteBody AND Ref ( O ,-1)> Ref ( O ,-2) AND Ref ( O ,-1)< Ref ( C ,-2) AND Ref ( C ,-1)> Ref ( C ,-2) AND C > Ref ( C ,-1) AND O < Ref ( C ,-1) AND O > Ref ( O ,-1) AND Ref (LargeUpperShadow,-1) AND LargeUpperShadow AND C - O < Ref ( C ,-1)- Ref ( O ,-1) AND Ref ( C ,-1)- Ref ( O ,-1) < Ref ( C ,-2)- Ref ( O ,-2); /*Belt Hold Bearish*/ beltHoldBearish=LargeBody AND BlackBody AND smalluppershadow AND MHT; /*Breakaway Bearish*/ breakAwayBearish= Ref (LargeBody,-4) AND Ref (whiteBody,-4) AND Ref ( GapUp (),-3) AND Ref (whiteBody,-3) AND Ref (smallbody,-2) AND Ref (smallBody,-1) AND blackBody AND O > Ref ( O ,-3) AND C < Ref ( C ,-4); /*Dark Cloud Cover*/ darkCloudCover= Ref (LargeBody,-1) AND Ref (whiteBody,-1) AND blackBody AND O > Ref ( 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 C < Ref ( C ,-1)*1.0025 AND C > Ref ( 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)*0.0025 AND abs ( Ref ( C ,-1)- O )< O *0.0025 AND HHV ( H ,20)== Ref ( H ,-2) AND NOT Ref (doji,-2) AND NOT Ref (doji,-1) AND NOT doji AND Ref (smallLowerShadow,-2) AND Ref (smallLowerShadow,-1) AND smallLowerShadow; /*Kicking Bearish No trades*/ kickingBearish= Ref (whiteBody,-1) AND Ref (MArabuzu,-1) AND blackBody AND MArabuzu AND GapDown (); /*Meeting Lines Bearish*/ MeetingLinesBearish= Ref (LargeBody,-1) AND Ref (whiteBody,-1) AND HHV ( C ,8)== Ref ( C ,-1) AND LargeBody AND blackBody AND abs ( C - Ref ( C ,-1))< C *0.0025; /*ShootingStar*/ shootingStarGap=shootingStar AND GapUp () AND MHT; /*Gravestone Doji*/ gravestoneDoji=doji AND largeUpperShadow AND smallLowerShadow AND GapUp () AND MHT; /*Three Inside Down Bearish*/ threeInsideDownBearish= Ref (HaramiBearish,-1) AND blackBody AND C < Ref ( C ,-1) AND smallUpperShadow; /*Three Outside Down Bearish*/ threeoutsideDownBearish= Ref (engulfingBearish,-1) AND blackBody AND C < Ref ( C ,-1) AND NOT LargeUpperShadow; /*Tri Star Bearish*/ triStarBearish= Ref (doji,-2) AND Ref (doji,-1) AND doji AND MHY AND Ref (upGap,-1) AND downGap; /*Two Crows Bearish*/ twoCrows= Ref (whiteBody,-2) AND Ref (LargeBody,-2) //first day AND Ref (blackBody,-1) AND Ref (upGap,-1) //Second Day AND blackBody AND O < Ref ( O ,-1) AND O > Ref ( C ,-1) AND C < Ref ( C ,-2) AND C > Ref ( 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 C < Ref ( C ,-1) AND C > Ref ( 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 O < Ref ( O ,-1) AND C > Ref ( 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 O < Ref ( O ,-1) AND O > Ref ( C ,-1) AND C > Ref ( O ,-1) AND C < Ref ( C ,-2) AND Ref (identicalBodies,-1) AND LLV ( L ,15)== Ref ( L ,-1); /*Falling Three Meothods*/ fallingThreeMethods= Ref (LargeBody,-4) AND Ref (blackBody,-4) AND /*Ref(doji,-3) AND Ref(doji,-2) AND Ref(doji,-1) AND*/ Ref ( C ,-1)> Ref ( C ,-2) AND Ref ( C ,-2)> Ref ( C ,-3) AND LargeBody AND blackBody AND O > Ref ( C ,-4) AND O < Ref ( O ,-4) AND C < Ref ( O ,-4) AND C < Ref ( C ,-4); /*In Neck Bearish not good*/ inNeckBearish= Ref (LargeBody,-1) AND Ref (blackBody,-1) AND whiteBody AND O < Ref ( L ,-1) AND C < Ref ( C ,-1)*1.0005 AND C >= Ref ( C ,-1); /*On Neck Bearish not good*/ OnNeckBearish= Ref (LargeBody,-1) AND Ref (blackBody,-1) AND whiteBody AND O < Ref ( L ,-1) AND C < Ref ( L ,-1)*1.0025 AND C >= 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)< C *0.0025); /*Three Black Crows*/ 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;; /*Three Line Strike no trades*/ threeLineStrike=threeBlackCrows AND whiteBody AND O < Ref ( C ,-1) AND C > Ref ( O ,-3); /*Thrusting Bearish*/ thrustingBearish= Ref (blackBody,-1) AND Ref (LargeBody,-1) AND LargeBody AND whitebody AND O < Ref ( L ,-1) AND C <( Ref ( O ,-1)+ Ref ( C ,-1))/2 AND C > Ref ( C ,-1); /*Tweezer Top*/ TweezerTop= abs ( H - Ref ( H ,-1))<= H *0.0025 AND O > C AND ( Ref ( C ,-1) > Ref ( O ,-1)); txt2+= WriteIf (BlackCandle , "BlackCandle " , "" ); txt2+= WriteIf (LongBlackCandle , "LongBlackCandle " , "" ); txt2+= WriteIf (SmallBlackCandle , "SmallBlackCandle " , "" ); txt2+= WriteIf (WhiteCandle , "WhiteCandle " , "" ); txt2+= WriteIf (BlackCandle , "BlackCandle " , "" ); txt2+= WriteIf (LongBlackCandle , "LongBlackCandle " , "" ); txt2+= WriteIf (SmallBlackCandle , "SmallBlackCandle " , "" ); txt2+= WriteIf (WhiteCandle , "WhiteCandle " , "" ); txt2+= WriteIf (LongWhiteCandle , "LongWhiteCandle " , "" ); txt2+= WriteIf (SmallWhiteCandle , "SmallWhiteCandle " , "" ); txt2+= WriteIf (BlackMaubozu , "BlackMaubozu " , "" ); txt2+= WriteIf (WhiteMaubozu , "WhiteMaubozu " , "" ); txt2+= WriteIf (BlackClosingMarubozu , "BlackClosingMarubozu " , "" ); txt2+= WriteIf (WhiteClosingMarubozu , "WhiteClosingMarubozu " , "" ); txt2+= WriteIf (BlackOpeningMarubozu , "BlackOpeningMarubozu " , "" ); txt2+= WriteIf (WhiteOpeningMarubozu , "WhiteOpeningMarubozu " , "" ); txt2+= WriteIf (BlackMaubozu , "BlackMaubozu " , "" ); txt2+= WriteIf (BearishHarami , "BearishHarami " , "" ); txt2+= WriteIf (eveningStar , "eveningStar " , "" ); txt2+= WriteIf (Hammer , "Hammer " , "" ); txt2+= WriteIf (InvertedHammer , "InvertedHammer " , "" ); txt2+= WriteIf (PiercingLine , "PiercingLine " , "" ); txt2+= WriteIf (BullishEngulfing , "BullishEngulfing " , "" ); txt2+= WriteIf (BearishEngulfing , "BearishEngulfing " , "" ); txt2+= WriteIf (BullishHarami , "BullishHarami " , "" ); txt2+= WriteIf (BearishHarami , "BearishHarami " , "" ); txt2+= WriteIf (morningStar , "morningStar " , "" ); txt2+= WriteIf (NearDoji , "NearDoji " , "" ); txt2+= WriteIf (Doji , "Doji " , "" ); txt2+= WriteIf (haramiBullish , "haramiBullish " , "" ); txt2+= WriteIf (DarkCloudCover , "DarkCloudCover " , "" ); txt2+= WriteIf (invertedHammer , "invertedHammer " , "" ); txt2+= WriteIf (HaramiCross , "HaramiCross " , "" ); txt2+= WriteIf (haramiBearish , "haramiBearish " , "" ); txt2+= WriteIf (spinningTop , "spinningTop " , "" ); txt2+= WriteIf (engulfing , "engulfing " , "" ); txt2+= WriteIf (Harami , "Harami " , "" ); txt2+= WriteIf (tweezerBottom , "tweezerBottom " , "" ); txt2+= WriteIf (Hammer , "Hammer " , "" ); txt2+= WriteIf (shootingStar , "shootingStar " , "" ); txt2+= WriteIf (dojiStarBullish , "dojiStarBullish " , "" ); txt2+= WriteIf (dojiStarBearish , "dojiStarBearish " , "" ); txt2+= WriteIf (engulfingBullish , "engulfingBullish " , "" ); txt2+= WriteIf (invertedHammer , "invertedHammer " , "" ); txt2+= WriteIf (haramiBearish , "haramiBearish " , "" ); txt2+= WriteIf (hammerBullish , "hammerBullish " , "" ); txt2+= WriteIf (dojiStarBullish , "dojiStarBullish " , "" ); txt2+= WriteIf (eveningStar , "eveningStar " , "" ); txt2+= WriteIf (HammerBearish, "HammerBearish " , "" ); txt2+= WriteIf (HaramiCrossBearish , "HaramiCrossBearish " , "" ); txt2+= WriteIf (inNeckBearish , "inNeckBearish " , "" ); txt2+= WriteIf (OnNeckBearish , "OnNeckBearish " , "" ); txt2+= WriteIf (fallingThreeMethods , "fallingThreeMethods " , "" ); txt2+= WriteIf (threeBlackCrows , "threeBlackCrows " , "" ); txt2+= WriteIf (downsideTasukiGap , "downsideTasukiGap " , "" ); txt2+= WriteIf (downsideGapThreeMethods , "downsideGapThreeMethods " , "" ); txt2+= WriteIf (twoCrows , "twoCrows " , "" ); txt2+= WriteIf (darkCloudCover, "darkCloudCover " , "" ); txt2+= WriteIf (beltHoldBearish, "beltHoldBearish " , "" ); txt2+= WriteIf (abandonedBabybullish , "abandonedBabybullish " , "" ); txt2+= WriteIf (beltHoldBullish , "beltHoldBullish " , "" ); txt2+= WriteIf (breakAwayBullish, "breakAwayBullish " , "" ); txt2+= WriteIf (dojiStarBullish , "dojiStarBullish " , "" ); txt2+= WriteIf (engulfingBullish , "engulfingBullish " , "" ); txt2+= WriteIf (hammerBullish , "hammerBullish " , "" ); txt2+= WriteIf (homingPigeon , "homingPigeon " , "" ); txt2+= WriteIf (smallUpperShadow, "smallUpperShadow " , "" ); txt2+= WriteIf (smallLowerShadow, "smallLowerShadow " , "" ); txt2+= WriteIf (largeUpperShadow , "largeUpperShadow " , "" ); txt2+= WriteIf (largeLowerShadow, "largeLowerShadow " , "" ); txt2+= WriteIf (upGap, "upGap " , "" ); txt2+= WriteIf (downGap, "downGap " , "" ); txt2+= WriteIf (meetingLinesbullish, "meetingLinesbullish " , "" ); txt2+= WriteIf (morningDojiStar, "morningDojiStar " , "" ); txt2+= WriteIf (morningStar, "morningStar " , "" ); txt2+= WriteIf (piercingLine, "piercingLine " , "" ); txt2+= WriteIf (stickSandwich, "stickSandwich " , "" ); txt2+= WriteIf (threeInsideUp , "threeInsideUp " , "" ); txt2+= WriteIf (threeOutsideUp , "threeOutsideUp " , "" ); txt2+= WriteIf (triStarBullish, "triStarBullish " , "" ); txt2+= WriteIf (threeriverBottom, "threeriverBottom " , "" ); txt2+= WriteIf (risingThreeMethods, "risingThreeMethods " , "" ); txt2+= WriteIf (threeWhiteSoldiers, "threeWhiteSoldiers " , "" ); txt2+= WriteIf (upsideGapThreeMethods, "upsideGapThreeMethods " , "" ); txt2+= WriteIf (tweezerBottom, "tweezerBottom " , "" ); txt2+= WriteIf (breakAwayBearish, "breakAwayBearish " , "" ); txt2+= WriteIf (darkCloudCover, "darkCloudCover " , "" ); txt2+= WriteIf (eveningDojiStar, "eveningDojiStar " , "" ); txt2+= WriteIf (eveningStar, "eveningStar " , "" ); txt2+= WriteIf (triStarBearish, "triStarBearish " , "" ); txt2+= WriteIf (threeoutsideDownBearish, "threeoutsideDownBearish " , "" ); txt2+= WriteIf (dragonflyDojiBearish, "dragonflyDojiBearish " , "" ); txt2+= WriteIf (HammerBearish, "HammerBearish " , "" ); txt2+= WriteIf (threeInsideDownBearish, "threeInsideDownBearish " , "" ); c_cond1= StrFind ( txt2, "BlackCandle" ) OR StrFind ( txt2, "blackCandle" ); c_cond2= StrFind ( txt2, "BlackCandle" ) OR StrFind ( txt2, "blackCandle" ); c_cond3= StrFind ( txt2, "WhiteCandle" ) OR StrFind ( txt2, "whiteCandle" ) ; c_cond1= c_cond1 AND ( StrFind ( txt2, "Hammer" ) OR StrFind ( txt2, "hammer" ) ); c_cond2 = c_cond2 AND ( StrFind ( txt2, "Hammer" ) OR StrFind ( txt2, "hammer" ) ); c_cond3=c_cond3 AND ( StrFind ( txt2, "Doji" ) OR StrFind ( txt2, "doji" ) ); /* c_cond1=c_cond2=c_cond3=False; tempTxt=""; Flag=0; tempTxt=StaticVarGetText("static_tempTxt" ); Flag=StaticVarGet("static_flag",Flag); Flag=Nz(Flag); c_cond1=StrFind( txt2, "BlackCandle" ) OR StrFind( txt2, "blackCandle" ); c_cond2=StrFind( txt2, "BlackCandle" ) OR StrFind( txt2, "blackCandle" ); c_cond3=StrFind( txt2, "WhiteCandle" ) OR StrFind( txt2, "whiteCandle" ) ; c_cond1= c_cond1 AND ( StrFind( txt2, "Hammer" ) OR StrFind( txt2, "hammer" ) ); c_cond2 = c_cond2 AND ( StrFind( txt2, "Hammer" ) OR StrFind( txt2, "hammer" ) ); c_cond3=c_cond3 AND ( StrFind( txt2, "Doji" ) OR StrFind( txt2, "doji" ) ); // start of the formula: /* _TRACE("i: "+ i + " j: " + j +" Flag: " + Flag ); */ /* tmpBartxt=""; tmpBartxt=" bar:"+i+ //" bodyfactor : "+bodyfactor + //" rangefactor: "+rangefactor + P+" "+txt2+"\n" ;//+ " elmt: "+elmt ; if(tempTxt=="") {tempTxt="";} if(c_cond1) {Flag =1; tempTxt= tmpBartxt; } else if(Flag ==1 AND c_cond2 ) { Flag +=2; tempTxt+= tmpBartxt;} else if(Flag ==3 AND c_cond3 ) { Flag +=3; tempTxt+= tmpBartxt;} else { Flag =0; tempTxt=""; } //else if(tempFlag ==(1 OR 2 OR 3 OR 4 OR 5 OR 6) ){ flag=-1; } /*txt+= "bar:"+i+ // " bodyfactor : "+bodyfactor + //" rangefactor: "+rangefactor + P+" "+txt2+"\n" + "elmt: "+elmt; */ //txtRange= WriteIf(tempFlag ==6,tempTxt ,""); /* if(Flag ==6) { end_txt=""+tempTxt+"\n";; //end_txt_global+=end_txt; _TRACE( end_txt); Flag =0; tempTxt=""; //end_txt=""; //StaticVarSetText("staticArrayTxt", "" ); } StaticVarSetText("static_tempTxt", tempTxt ); StaticVarSet("static_flag",Flag); */ k = ( GetPerformanceCounter ()/100)%256; printf ( "GetPerformance Counter %g" ,k); GfxSelectFont ( "Arial Narrow" , 10, 700 ); GfxSetBkMode (1); GfxSetTextColor ( colorYellow ); //GfxTextOut("Dedicated to the loving memory of MY FATHER on his 75th Birth Anniversay - LATE BALKRISHNA RAMCHANDRA RAO 13.10.1935",100+k ,12); GfxSelectFont ( "Century Goliath" ,12,500); GfxSetBkMode (1); GfxSetTextColor ( colorLime ); RequestTimedRefresh (1); _SECTION_END (); SetBarFillColor ( IIf ( O > C , colorOrange , colorDarkGreen ) ); Plot ( C , "Price" , IIf ( O > C , colorRed , colorGreen ), styleCandle ); bodyfactor = ( Close - Open )/ ( High - Low ); rangefactor = ( Close - Open )/ MA ( ( Close - Open ), 15); Title = EncodeColor ( colorGreen )+ Title = Name () + txt2+ "\nbf: " +bodyfactor + " " + "rf: " +rangefactor ; Filter =1; AddTextColumn (txt2, "candle" ); _TRACE ( "------ END AFL---------" ); |