Stock Portfolio Organizer
The ultimate porfolio management solution.
WiseTrader Toolbox
#1 Selling Amibroker Plugin featuring:
Ribbon for Amibroker (AFL)
For EOD trade combination of other afls. Displays lots of different signals in different colors.
Similar Indicators / Formulas
Indicator / Formula
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 | /////////////////////////////// // CCI Panel for Amibroker Dr. Bob // Codded/Added by Dennis, Kris, Wring // Last Update: 11/25/2007 /////////////////////////////// // Go to www.tradershaven.net to learn everything about this system. // You must be a registered user to see the images and downloads. /////////////////////////////// // Setup Axes and Grid section (right click on chart panel, click on Parameters): // Scaling: Custom , Min=-250 Max=250 // Show Date Axis = Yes , Show Middle Lines = No /////////////////////////////// // To activate the timer properly, make sure the following is set: // click on Tools==>Preferences==>Intraday.... // make sure "Allign minute bars to market hours" is checked... // make sure "Start time of interval" is checked... // make sure "Override: Weekly/monthly bars use day of last trade" is checked. /////////////////////////////// // Tic/PIP values: YM=1.0, ER2=0.10, NQ=0.25, EUR/USD=.0001, USD/JPY=0.01, Stocks=0.01 // Rangebar Settings : // ER2 1.50 // YM 25 // ES 3 // NQ 3.75 // DAX 5 // ZG 1.5 /////////////////////////////// // Discalimer: For educational purposes only. Trade at your own risk. /////////////////////////////// // Timer TTMperiod = 6; Low_ma = EMA ( L , TTMperiod); High_ma = EMA ( H , TTMperiod); Low_third = (High_ma - Low_ma) / 3 + Low_ma; High_third = 2 * (High_ma - Low_ma) / 3 + Low_ma; tempnum = Now ( 4 ) - TimeNum (); TimeRem = Interval () - (( int (tempnum[ BarCount - 1] / 100) * 60) + (tempnum[ BarCount - 1] - int (tempnum[ BarCount - 1] / 100) * 100)); if (TimeRem[ BarCount - 1] < 0) TimeRem = 0; MinuteVar = int (TimeRem / 60); SecondsVar = int ( frac (TimeRem / 60) * 60); if (TimeRem[ BarCount - 1] > 60) { TitleTimeRem = EncodeColor ( colorWhite ) + MinuteVar + ":" + WriteIf (SecondsVar > 9, "" , "0" ) + SecondsVar; } else if (TimeRem[ BarCount - 1] > 20) { TitleTimeRem = EncodeColor ( colorYellow ) + MinuteVar + ":" + WriteIf (SecondsVar > 9, "" , "0" ) + SecondsVar; } else { TitleTimeRem = EncodeColor ( colorRed ) + MinuteVar + ":" + WriteIf (SecondsVar > 9, "" , "0" ) + SecondsVar; } // Background colors //SetChartBkColor(ParamColor("Panel color ",colorPaleBlue)); // CCI Colors zcolor= ParamColor ( "WCCI color" , colorBlack ); z6color= ParamColor ( "TCCI color" , colorBrown ); patterncolor= ParamColor ( "Pattern trace color" , colorWhite ); // Tic/PIP value TicMult= Param ( "Tic multiplier(ER2=10,YM=1,ES=4,FOREX=1)" ,1,0,1000000); TicDiv= Param ( "Tic or PIP value(ER2=0.1,YM=1,FOREX=1)" ,1,0,1000000); // Spread spread= Param ( "Spread (included in stop)" ,0,0,1000000); // Stop value stopval= Param ( "Stop above/below entry bar" ,2,0,1000000); // CCI periods zperiod= Param ( "WCCI Period" ,14,0,100); z = CCI (zperiod); z6period= Param ( "TCCI Period" ,6,0,100); z6 = CCI (z6period); z50period= Param ( "Long Term CCI Period" ,50,0,1000); z50 = CCI (z50period); // Rangebar interval rbint= Param ( "Rangebar interval:(YM=25.0,AB=1.5,NQ=3.75,ES=3.0)" ,1.0,0.25,1000000); // Rangebar counter rbcounter= round (((rbint-( H - L ))) * ticmult); rbcounterpercent= round ((rbcounter/(rbint * ticmult))*100); // Timer/counter title timercode= Param ( "Timer:(minutes=1,rangebar=2)" ,1,1,2); timetitle= WriteIf (timercode==1,TitleTimeRem, EncodeColor ( colorWhite ) + "Countdown " + rbcounter + " (" + rbcounterpercent + "%)" ); // Plot grids PlotTheGrids = ParamToggle ( "Plot grids" , "No|Yes" ,0); if (PlotTheGrids ==1) { PlotGrid (0); PlotGrid (-100); PlotGrid (100); PlotGrid (-200); PlotGrid (200); } // EMA 34 EMA34 = EMA ( C ,34); // Color the bars for Woodies Trend Following Plusbars = BarsSince (z < 0); Minusbars = BarsSince (z > 0); TrendBarCount = 6; Color[0] = colorDefault ; Trend[0] = 0; for ( i = 1; i < BarCount ; i++ ) { if (Plusbars[i] >= TrendBarCount) { Trend[i] = 1; } else if (Minusbars[i] >= TrendBarCount) { Trend[i] = -1; } else { Trend[i] = Trend[i - 1]; } if (Trend[i] == 1) { if (Minusbars[i] == TrendBarCount - 1) { Color[i] = colorYellow ; } else if (z[i] < 0) { Color[i] = colorGrey40 ; } else { Color[i] = colorBlue ; } } else if (Trend[i] == -1) { if (Plusbars[i] == TrendBarCount - 1) { Color[i] = colorYellow ; } else if (z[i] >= 0) { Color[i] = colorGrey40 ; } else { Color[i] = colorRed ; } } else { Color[i] = colorDefault ; } } // Plot the 100s //Plot(100,"", colorLightGrey , styleLine | styleThick | styleNoLabel); //Plot(-100,"", colorLightGrey , styleLine | styleThick | styleNoLabel); // Plotthe 200s //Plot(200,"", colorLightGrey, styleLine | styleThick | styleNoLabel); //Plot(-200,"", colorLightGrey, styleLine | styleThick | styleNoLabel); // zero line 25lsma Plot (0, "" , colorLightGrey , styleLine | styleThick | styleNoLabel ); // Price Panel Lastpricetitlehi= WriteIf ( H > Ref ( H ,-1), EncodeColor ( colorBrightGreen ) + Ref ( H ,-1) + " " + H , EncodeColor ( colorWhite )+ Ref ( H ,-1) + " " + H ); Lastpricetitlelo= WriteIf ( L < Ref ( L ,-1), EncodeColor ( colorRed ) + Ref ( L ,-1) + " " + L , EncodeColor ( colorWhite ) + Ref ( L ,-1) + " " + L ); // Pattern codes z50limitlong= LLV (z50, BarsSince (z>0))>0; z50limitshort= HHV (z50, BarsSince (z<0))<0; // 5014 Long CCIhook_long5014= LLV ( Ref (z,-1), BarsSince ( Ref (z,-1)<0)); Long5014= z50limitlong AND (( Ref (z,-1)<-75 AND Z>-75 AND CCIhook_long5014<-75 AND CCIhook_long5014>=-100) OR ( Ref (z,-1)<-100 AND Z>-100 AND CCIhook_long5014<-100)) AND Z50>0; // 5014 Short CCIhook_short5014= HHV ( Ref (z,-1), BarsSince ( Ref (z,-1)>0)); Short5014= z50limitshort AND (( Ref (z,-1)>75 AND Z<75 AND CCIhook_short5014>75 AND CCIhook_short5014<=100) OR ( Ref (z,-1)>100 AND Z<100 AND CCIhook_short5014>100)) AND Z50<0; // 50140 Long CCIhook_long50140= LLV ( Ref (z,-1), BarsSince ( Ref (z,-1)<0)); Long50140= z50limitlong AND z50>0 AND z>0 AND CCIhook_long50140<-75; // 50140 Short CCIhook_short50140= HHV ( Ref (z,-1), BarsSince ( Ref (z,-1)>0)); Short50140= z50limitshort AND z50<0 AND z<0 AND CCIhook_short50140>75; // Slingshot Long z6pivotlong= LLV (z6, BarsSince ( Ref (z6,-1)>0))<=-100 AND z6>0 AND Ref (z6,-1)<0; zpivotlong= LLV (z, BarsSince ( Ref (z,-1)>-100)) AND LLV (z, BarsSince (z>-100))<50 AND z> Ref (z,-1) AND z>0; slingshotlong= z6pivotlong AND zpivotlong AND trend==1 AND z50>0 AND z<120; // Slingshot Short z6pivotshort= HHV (z6, BarsSince ( Ref (z6,-1)<0))>=100 AND z6<0 AND Ref (z6,-1)>0; zpivotshort= HHV (z, BarsSince ( Ref (z,-1)<100))<100 AND HHV (z, BarsSince ( Ref (z,-1)<100))>-50 AND z< Ref (z,-1) AND z<0; slingshotshort= z6pivotshort AND zpivotshort AND trend==-1 AND z50<0 AND z>-120; // Signal Title PatCode1= ParamToggle ( "Plot 5014 (1)" , "No|Yes" ,1); PatCode2= ParamToggle ( "Plot 50140 (2)" , "No|Yes" ,1); PatCode3= ParamToggle ( "Plot Slingshot (3)" , "No|Yes" ,1); Signaltitle= WriteIf (PatCode1==1 AND Long5014 AND NOT Long50140, EncodeColor ( colorRed ) + "\n" + "*** ALERT -- 5014 ***" + "\n" , WriteIf (PatCode1==1 AND Short5014 AND NOT short50140, EncodeColor ( colorRed ) + "\n" + "*** ALERT -- 5014 ***" + "\n" , WriteIf (PatCode2==1 AND Long50140, EncodeColor ( colorRed ) + "\n" + "*** ALERT -- 50140 ***" + "\n" , WriteIf (PatCode2==1 AND Short50140, EncodeColor ( colorRed ) + "\n" + "*** ALERT -- 50140 ***" + "\n" , WriteIf (PatCode3==1 AND slingshotlong, EncodeColor ( colorRed ) + "\n" + "*** ALERT -- SLINGSHOT ***" + "\n" , WriteIf (PatCode3==1 AND slingshotshort, EncodeColor ( colorRed ) + "\n" + "*** ALERT -- SLINGSHOT ***" + "\n" , "" )))))); // Pattern signal codes //PlotShapes(IIf(PatCode1==1 AND Long5014 AND NOT Long50140,shapeDigit1,shapeNone),colorBlue,0,0,-40); //PlotShapes(IIf(PatCode1==1 AND Short5014 AND NOT short50140,shapeDigit1+ shapePositionAbove,shapeNone),colorRed,0,0,-40); //PlotShapes(IIf(PatCode2==1 AND Long50140,shapeDigit2,shapeNone),colorBlue,0,0,-25); //PlotShapes(IIf(PatCode2==1 AND Short50140,shapeDigit2+ shapePositionAbove,shapeNone),colorRed,0,0,-25) ; //PlotShapes(IIf(PatCode3==1 AND slingshotlong,shapeDigit3,shapeNone),colorBlue,0,0,-10); //PlotShapes(IIf(PatCode3==1 AND slingshotshort ,shapeDigit3+ shapePositionAbove,shapeNone),colorRed,0,0,-10) ; // CCI Exit HookExitLong= z<= Ref (z,-1); HookExitShort= z>= Ref (z,-1); // 100 Line Cross Exit Cross100long= Ref (z,-1)>100 AND z<100; Cross100short= Ref (z,-1)<-100 AND z>-100; // Mplay Exit MplayExitLong= z< Ref (z,-1) AND Ref (z,-1)< Ref (z,-2) AND C < O ; MplayExitShort= z> Ref (z,-1) AND Ref (z,-1)> Ref (z,-2) AND C > O ; // Heikin-Ashi Exit HaClose = EMA (( O + H + L + C )/4,3); HaOpen = AMA ( Ref ( HaClose, -1 ), 0.5 ); HaHigh = Max ( H , Max ( HaClose, HaOpen ) ); HaLow = Min ( L , Min ( HaClose, HaOpen ) ); HExitConLong= HaLow < HaOpen; HExitConShort= HaHigh > HaOpen; // Exit code ExitCode= Param ( "Exits:Hook=1,100x=2,Mplay=3,H-Ashi=4" ,1,1,4); ExitCodeTitleLong= IIf (ExitCode==1,HookExitLong, IIf (Exitcode==3,MplayExitLong, IIf (Exitcode==4,HExitConLong, IIf (Exitcode==2,Cross100long,0)))); ExitCodeTitleShort= IIf (ExitCode==1,HookExitShort, IIf (Exitcode==3,MplayExitShort, IIf (Exitcode==4,HExitConShort, IIf (Exitcode==2,Cross100short,0)))); AllPatterns =(Long50140 AND patcode2==1) OR (Long5014 AND patcode1==1) OR (slingshotlong AND patcode3==1) OR (short50140 AND patcode2==1) OR (short5014 AND patcode1==1) OR (slingshotshort AND patcode3==1) ; BuyPattern = (Long50140 AND patcode2==1) OR (Long5014 AND patcode1==1) OR (slingshotlong AND patcode3==1);; SellPattern= ExitCodeTitleLong; ShortPattern = (short50140 AND patcode2==1) OR (short5014 AND patcode1==1) OR (slingshotshort AND patcode3==1); CoverPattern = ExitCodeTitleShort; //Plot Sell/Cover Arrows Sell1= ExRem (SellPattern,BuyPattern); Cover1= ExRem (CoverPattern,ShortPattern); SellCode= ParamToggle ( "Plot sell/cover arrows " , "No|Yes" ,0); //PlotShapes(IIf(Sell1 AND SellCode==1,shapeHollowDownArrow,shapeNone),colorBlue,0,200,10); //PlotShapes(IIf(Cover1 AND SellCode==1,shapeHollowDownArrow,shapeNone),colorRed,0,200,10); // Calculate pattern hilites // Long AsellL= BuyPattern; BsellL= Sell1; bs_AsellL= BarsSince (AsellL); bs_BsellL= BarsSince (BsellL); bars_sellL= IIf (bs_ASellL<= bs_BsellL,bs_AsellL,0); //Short AsellS= ShortPattern; BsellS= Cover1; bs_AsellS= BarsSince (AsellS); bs_BsellS= BarsSince (BsellS); bars_sellS= IIf (bs_ASellS<= bs_BsellS,bs_AsellS,0); hilitecode= ParamToggle ( "Hi-lite patterns" , "No|Yes" ,0); // CCI Line CCIcolor= IIf (((bars_sellL OR bars_sellS) OR AllPAtterns) AND hilitecode==1,patterncolor,zcolor); //Plot(round(z),"WCCI", CCIcolor , styleLine | styleThick); // Turbo CCI //Plot(round(z6),"TCCI", z6color, styleLine); // CCI Histogram //Plot(z,"",Color,styleHistogram | styleThick | styleNoLabel); // BackTest Long LastPatLong= BuyPattern; LastPatBarLong= BarsSince (LastPatLong); DDL= IIf (((( LLV ( L ,LastPatBarLong)- Ref ( C ,-LastPatBarLong))))/ticdiv>=0,0,((( LLV ( L ,LastPatBarLong)- Ref ( C ,-LastPatBarLong))))/ticdiv); BTExitLong= ((( C - Ref ( C ,-LastPatBarLong))))/ticdiv; PeakLong= IIf (((( HHV ( H ,LastPatBarLong)- Ref ( C ,-LastPatBarLong))))/ticdiv<=0,0,((( HHV ( H ,LastPatBarLong)- Ref ( C ,-LastPatBarLong))))/ticdiv); StopLong1= Ref ( C ,-LastPatBarLong) - ( Ref ( L ,-LastPatBarLong) - (stopval*ticdiv) - (spread*ticdiv)); stoplong= (((StopLong1)))/ticdiv; BackTestLongTitle= WriteIf (Sell1, EncodeColor ( colorBlue ) + "\n" + "Stop: " + round (stoplong) + "\n" + "DD: " + round (DDL) + "\n" + "Exit: " + round (BTExitLong)+ "\n" + "Peak: " + round (PeakLong) + "\n" , EncodeColor ( colorBlue ) + "\n" + "Stop: " + round (stoplong) + "\n" + "DD: " + round (DDL) + "\n" + "Exit: " + round (BTExitLong)+ "\n" + "Peak: " + round (PeakLong) + "\n" ); // BackTest Short LastPatShort= ShortPattern; LastPatBarShort= BarsSince (LastPatShort); DDS= IIf (((( Ref ( C ,-LastPatBarShort)- HHV ( H ,LastPatBarShort))))/ticdiv>=0,0,((( Ref ( C ,-LastPatBarShort)- HHV ( H ,LastPatBarShort))))/ticdiv); BTExitShort= ((( Ref ( C ,-LastPatBarShort)- C )))/ticdiv; PeakShort= IIf (((( Ref ( C ,-LastPatBarShort)- LLV ( L ,LastPatBarShort))))/ticdiv<=0,0,((( Ref ( C ,-LastPatBarShort)- LLV ( L ,LastPatBarShort))))/ticdiv); StopShort1= ( Ref ( H ,-LastPatBarShort) + (Stopval*ticdiv) + (spread*ticdiv)) - Ref ( C ,-LastPatBarShort); StopShort= (((StopShort1)))/ticdiv; BackTestShortTitle= WriteIf (Cover1, EncodeColor ( colorRed ) + "\n" + "Stop: " + round (StopShort) + "\n" + "DD: " + round (DDS) + "\n" + "Exit: " + round (BTExitShort)+ "\n" + "Peak: " + round (PeakShort) + "\n" , EncodeColor ( colorRed )+ "\n" + "Stop: " + round (StopShort) + "\n" + "DD: " + round (DDS) + "\n" + "Exit: " + round (BTExitShort)+ "\n" + "Peak: " + round (PeakShort) + "\n" ); // Backtest title BackTestCode= ParamToggle ( "Display Stop,DD,Peak,Exit stats" , "No|Yes" ,0); BackTestTitle= WriteIf ((bars_sellL>0 OR Sell1) AND BackTestCode==1,BackTestLongTitle , WriteIf ((bars_sellS>0 OR Cover1 ) AND BackTestCode==1,BackTestShortTitle , "" )); // Stop in Longbar= L +rbint; Shortbar= H -rbint; // Stop in title stopincode= ParamToggle ( "Display stop-in for range bar mode" , "No|Yes" ,0); sstoptitle= WriteIf (stopincode==1, EncodeColor ( colorBlue ) + "\n" + "Stop In Long: " + Longbar + EncodeColor ( colorRed ) + "\n" + "Stop In Short: " + Shortbar , "" ); // Title Title = "\n" + "" + EncodeColor ( colorWhite ) + "14 CCI" + "\n" + EncodeColor ( colorWhite ) + Date () + "\n" + "\n" + timetitle + "\n" + "\n" + Lastpricetitlehi + "\n" + EncodeColor ( colorWhite ) + " " + Close + "\n" + Lastpricetitlelo + "\n" + BackTestTitle + Signaltitle + sstoptitle; Color = IIf ( (z6<-100 ), colorRed , IIf ( z6>100 , colorBrightGreen , colorGrey50 )); Plot ( 1, "" , Color, styleArea | styleOwnScale | styleNoLabel , -0.1, 20); /* Larry William's Volatility Channels Right Click select Param "parameters" and select variable you need..*/ /* AFL code by Prakash Shenoi*/ // Enable radio button "middle" for grid lines. MaxGraph = 4; Vc= Param ( "Volatility channel -" ,10,2,14); Up= HHV ((((( H + L + C )/3)*2)- H ),Vc); Lo= LLV ((((( H + L + C )/3)*2)- L ),Vc); /*Graph0=C; Graph0Style=128+4; Graph0BarColor = IIf( Close > Ref( Close, -1 ), colorDarkGreen, colorDarkRed ); Graph0Style = styleDots; Graph0 = Close; Graph1=Up; Graph1Style=styleLine; Graph1Color=colorBlue; Graph2=Lo; Graph2Style=styleLine; Graph2Color=colorBlue; Title=Name() + " Volatiltiy Channels - LC" + WriteVal( Graph2 )+ ", UC" + WriteVal( Graph1 )+ ", Close" + WriteVal( Graph0 ); */ Color = IIf ( C >up, colorGreen , IIf ( C <Lo , colorDarkRed , colorGrey50 )); Plot ( 1, "" , Color, styleArea | styleOwnScale | styleNoLabel , -0.1, 10); _SECTION_BEGIN ( "Name" ); GfxSetOverlayMode (1); GfxSelectFont ( "Tahoma" , Status ( "pxheight" )/6 ); GfxSetTextAlign ( 6 ); // center alignment //GfxSetTextColor( ColorRGB( 200, 200, 200 ) ); GfxSetTextColor ( ColorHSB ( 42, 42, 42 ) ); GfxSetBkMode (0); // transparent //GfxTextOut( Name(), Status("pxwidth")/2, Status("pxheight")/12 ); GfxSelectFont ( "Tahoma" , Status ( "pxheight" )/12 ); GfxTextOut ( "nick analysis" , Status ( "pxwidth" )/2, Status ( "pxheight" )/3 ); /////////////////////GfxSelectFont("Tahoma", Status("pxheight")/36 ); //GfxTextOut( "www.vpanalysis.blogspot.com", Status("pxwidth")/2, Status("pxheight")/2 ); _SECTION_END (); //------------------------------------------------------------------------------ // // Formula Name: ATR Volatility System // Author/Uploader: Marcelin // E-mail: marcelint@xnet.ro // //------------------------------------------------------------------------------ // // ATR trading system for short terms tradings. You can use it with Absolute // Strength Index for confirmation of signals. // //------------------------------------------------------------------------------ _SECTION_BEGIN ( "NewSystem ATR" ); /*Writed & composed by Tudor Marcelin - Art Invest*/ n= Param ( "perioada" , 14, 5 , 20, 1 ); k= Param ( "factor de multiplicare" , 1.4, 0.5 , 2.5, 0.1 ); f= ATR (n); /*R rezistenta pentru ziua curenta*/ R[0] = C [0]; /*S rezistenta pentru ziua curenta*/ S[0] = C [0]; for ( i = n+1; i < BarCount ; i++ ) { R[i]=R[i-1]; S[i]=S[i-1]; if (( S[i-1]<= C [i-1]) AND ( C [i-1] <=R[i-1] ) AND ( C [i-1]+k*f[i-1])<=RV) r[i] = C [i-1]+k*f[i-1]; if (( S[i-1]<= C [i-1]) AND ( C [i-1]<=R[i-1] ) AND ( C [i-1]-k*f[i-1])>=SV) s[i]= C [i-1]-k*f[i-1]; if ( C [i-1] >R[i-1] ) { r[i] = C [i-1]+k*f[i-1]; s[i]= C [i-1]-k*f[i-1]; RV=r[i]; SV=s[i]; } if ( C [i-1] <S[i-1] ) { r[i] = C [i-1]+k*f[i-1]; s[i]= C [i-1]-k*f[i-1]; RV=r[i]; SV=s[i]; } Buy = Close >R; Sell = Close <S; Cump= IIf ( Close >R,1,0); Vanz= IIf ( Close <S,1,0); } Buy = ExRem ( Buy , Sell ); //Elimina semnalele buy consecutive Sell = ExRem ( Sell , Buy ); //Elimina semnalele sell consecutive Color = IIf ( Vanz OR Sell , colorDarkRed , IIf ( Buy , colorGreen , colorGrey50 )); Plot ( 1, "" , Color, styleArea | styleOwnScale | styleNoLabel , -0.1, 6 ); GraphXSpace = 3; Title= EncodeColor ( colorBlue )+ "Volatility System" + EncodeColor ( colorBlack )+ " Open:" + O + " High:" + H + " Low:" + L + " Close:" + C + EncodeColor ( colorGreen )+ " Rez:" +R+ EncodeColor ( colorRed )+ " Sup:" +S+ EncodeColor ( colorBlue )+ " \nDate: " + EncodeColor ( colorRed )+ Date (); _SECTION_END (); ///////////////////// //In "Using Implied Volatility And Volume," Scott Castleman presents an interesting trading system that blends option volatility index movement with price AND Volume data to produce more reliable signals. //Implementing such a system is relatively easy in Afl, the language for AmiBroker. Listing 1 shows the code that should be entered in the Automatic Analysis formula window. We use the "Foreign" function to reference other symbols' data. Various data vendors use different symbols for indices. for example, "!VIX" is a symbol used by the QuotesPlus database for SP100 implied volatility, while Yahoo! Finance uses "^VIX." You may need to adjust the code according to the symbol used by your data vendor. //LISTING 1 ///////////////////////////////// // Implied volatility AND Volume ///////////////////////////////// RefLength1 = 29; RefLength2 = 25; LookBackIV=252; LookBackVolume=50; // the line below should be adjusted depending on // data source you are using // !VIX is for Quotes Plus database // ^VIX is for Yahoo (AmiQuote) CurrentIV = Foreign ( "!VIX" , "C" ); LowestIV = LLV ( CurrentIV, LookbackIV ); HighestIV = HHV ( CurrentIV, LookbackIV ); AvgVolume = MA ( Volume , 10 ); LowestVolume = LLV ( Volume , LookbackVolume ); HighestVolume = HHV ( Volume , LookbackVolume ); RangeIV = HighestIV - LowestIV; RangeVolume = HighestVolume - LowestVolume; DayLengthLong = int ( RefLength1 - 0.5 * RefLength2* Nz ( ( CurrentIV - LowestIV )/RangeIV +( AvgVolume - LowestVolume )/RangeVolume, 1 ) ); DayLengthShort = int ( RefLength1 - 0.5 * RefLength2* Nz ( ( HighestIV - CurrentIV )/RangeIV +( HighestVolume - AvgVolume )/RangeVolume, 1 ) ); SetTradeDelays ( 1, 1, 1, 1 ); BuyPrice = SellPrice = ShortPrice = CoverPrice = Open ; Buy = High > HHV ( Ref ( High , -1 ), DayLengthLong ); Sell = Low < LLV ( Ref ( Low , -1 ), DayLengthShort ); Short = Sell ; Cover = Buy ; Color = IIf ( Cover , colorGreen , IIf ( Short , colorDarkRed , colorGrey50 )); Plot ( 1, "" , Color, styleArea | styleOwnScale | styleNoLabel , -0.1,4); ///////////// /*THE TRUTH ABOUT VOLATILITY - Feb2005 S&C In "The Truth About Volatility," Jim Berg presents how to use several well-known volatility measures such as average True range (ATR) to calculate entry, trailing stop, AND profit-taking levels. Implementing techniques presented in the article is very simple using the AmiBroker Formula Language (Afl), AND takes just a few lines of code. Listing 1 shows the formula that the plots color-coded price chart, trailing stop, AND profit-taking lines, as well as a colored ribbon showing volatility-based entry AND exit signals. The relative strength index (RSI) used by Berg is a built-in indicator in AmiBroker, so no additional code is necessary. */ EntrySignal = C > ( LLV ( L , 20 ) + 2 * ATR ( 10 ) ); ExitSignal = C < ( HHV ( H , 20 ) - 2 * ATR ( 10 ) ); Color = IIf ( EntrySignal, colorBlue , IIf ( ExitSignal, colorOrange , colorGrey50 )); TrailStop = HHV ( C - 2 * ATR (10), 15 ); ProfitTaker = EMA ( H , 13 ) + 2 * ATR (10); /* plot price chart and stops */ /* plot color ribbon */ Plot ( 1, "" , Color, styleArea | styleOwnScale | styleNoLabel , -0.1, 3 ); ///////////////////// //* ATR Study: <<<BU?*/ Exclude = MA ( V ,50)<200 ; MaxGraph = 12; //Graph0 = C; //Graph0Color = 1; //Graph0Style = 64; BuyOffSet = 18; //Optimize("BuyOffSet",18,15,20,1); SellOffset = BuyOffSet; //Optimize("SellOffset",2,2,14,2); RegLength = 5; //Optimize("RegLength",5, 2,11,2); BuyATRPeriod = 2; //Optimize("BuyATRPeriod",2,2,5,1); SellATRPeriod = BuyATRPeriod; //Optimize("SellATRPeriod",4,2,11,2); ATRMultiplier = 1; //Optimize("ATRMultiplier",1,0.7,1.25,.05); Graph = HHV ( H -ATRMultiplier* ATR (BuyATRPeriod),BuyOffset); /* RED */ Graph_ = LLV ( L +ATRMultiplier* ATR (SellATRPeriod),SellOffset); /* GREEN */ //Graph9Color= 5; /* 5 is green */ //Graph8Color = 4; /* 4 is red */ /* plot color ribbon */ Color = IIf ( C >Graph AND C >Graph_ AND LinRegSlope ( EMA ( C ,17),2)>0, colorOrange , IIf ( C <Graph_, colorGreen , colorGrey50 )); Plot ( 1, "" , Color, styleArea | styleOwnScale | styleNoLabel , -0.1, 2.5 ); m=10; x= HHV ( C ,m);xx= LLV ( C ,m); Plot ( C , "C" ,5,1); h1= C ;L1= C ; for (i=1;i<m;i++) { h1= Max (h1, Ref ( C ,-i)); L1= Min (L1, Ref ( C ,-i)); } Color = IIf ( C >L1 AND C <H1 , colorGrey50 , IIf ( C ==h1 , colorYellow , colorBrightGreen )); Plot ( 1, "" , Color, styleArea | styleOwnScale | styleNoLabel , -0.1, 2.3); Type = ParamList ( "Chart Type" , "Price Bands|Price Band Oscillator|Stochastic Channel|Raw Stochastic" ); Periods = Param ( "Periods" , 14, 2, 100, 1 ); Smoothed = ParamToggle ( "Smoothed" , "No|Yes" , 1 ); IsStochType = ( Type == "Stochastic Channel" OR Type == "Raw Stochastic" ); // if stochastic - include today's bar PH = IIf ( IsStochType, H , Ref ( H , -1 ) ); PL = IIf ( IsStochType, L , Ref ( L , -1 ) ); if ( Type == "Price Bands" OR Type == "Stochastic Channel" ) { } else { // plot oscillator Range = HHV ( PH, Periods ) - LLV ( PL, Periods ); Position = C - LLV ( PL, Periods ); if ( Smoothed ) { Slow = 100 * Sum ( Position, 3 ) / Sum ( Range, 3 ); } else { Raw = 100 * ( Position / Range ); } } Color = IIf ( Close < LLV ( PL, Periods ), colorBrightGreen , IIf ( Close > HHV ( PH, Periods ), colorYellow , colorGrey50 )); Plot ( 1, "" , Color, styleArea | styleOwnScale | styleNoLabel , -0.1, 2.1 ); /////////////////////////////// //// Vchart //This was converted from code created for TradeStation by Mark W. Helweg ofValueCharts.com VarNumbars = Param ( "Number of Bars" ,5,2,1000,1); Color = Param ( "Bar Color" , colorBlue ); Top = Param ( "Top Chart Line" ,8); TopMid = Param ( "Top Mid Chart Line" ,4); BottomMid = Param ( "Bottom Mid Chart Line" ,-4); Bottom = Param ( "Bottom Chart Line" ,-8); LRange = 0; VarP = round (VarNumBars/5); if (VarNumBars > 7) { VarA= HHV ( H ,VarP)- LLV ( L ,VarP); VarR1 = IIf (VarA==0 AND VarP==1, abs ( C - Ref ( C ,-Varp)),VarA); VarB= Ref ( HHV ( H ,VarP),-VarP+1)- Ref ( LLV ( L ,VarP),-VarP); VarR2 = IIf (VarB==0 AND VARP==1, abs ( Ref ( C ,-VarP)- Ref ( C ,-Varp*2) ),VarB); VarC= Ref ( HHV ( H ,VarP),-VarP*2)- Ref ( LLV ( L ,VarP),-VarP*2); VarR3 = IIf (VarC == 0 AND VarP==1, abs ( Ref ( C ,-Varp*2)- Ref ( C ,-Varp*3)),VarC); VarD = Ref ( HHV ( H ,VarP),-VarP*3)- Ref ( LLV ( L ,VarP),-VarP*3); VarR4 = IIf (VarD == 0 AND VarP==1, abs ( Ref ( C ,-Varp*3)- Ref ( C ,-Varp*4)),VarD); VarE = Ref ( HHV ( H ,VarP),-VarP*4)- Ref ( LLV ( L ,VarP),-VarP*4); VarR5 = IIf (VarE == 0 AND VarP==1, abs ( Ref ( C ,-Varp*4)- Ref ( C ,-Varp*5)),VarE); LRange=((VarR1+VarR2+VarR3+VarR4+VarR5)/5)*.2; }; CDelta = abs ( C - Ref ( C ,-1)); if (VarNumBars <=7) { Var0 = IIf (CDelta > ( H - L ) OR H == L ,CDelta,( H - L )); LRange = MA (Var0,5)*.2; } MidBarAverage = MA ( ( H + L )/2,VarNumbars); VOpen = ( Open - MidBarAverage)/LRange; VHigh = ( High -MidBarAverage)/LRange; VLow = ( Low -MidBarAverage)/LRange; VClose = ( Close -MidBarAverage)/LRange; //PlotOHLC(VOpen,VHigh,VLow,VClose,"ValueChart",color,styleBar | styleThick //,-12,12); //Title= Name() + " " + WriteVal( DateTime(), formatDateTime )+ //"\nVOpen " + VOpen + "\n"+ " VHigh "+ VHigh + "\n"+ " VLow " + Vlow + "\n"+ " //VClose " + VClose; Color = IIf ( VClose>4, colorGreen , IIf ( VClose<-4 , colorRed , colorGrey50 )); Plot ( 1, "" , Color, styleArea | styleOwnScale | styleNoLabel , -0.1, 1.9); Color = IIf ( VClose>8, colorDarkGreen , IIf ( VClose<-8 , colorDarkRed , colorGrey50 )); Plot ( 1, "" , Color, styleArea | styleOwnScale | styleNoLabel , -0.1, 1.7); _SECTION_BEGIN ( "Multiline Stochastic " ); /* Multiline Stochastic This was recommendeed by Judith in post 45268 Use a multiple line STOCH with the SK set on 3 and SD set on 1 Plot periods 2,5,8,12,17,20,27 and 37. Plot 2 and 37 in red as borders with 2 solid and 37 dashed. These are my fences. When all of these lines converge below 20 or above 80, I bet the farm. This has been successful for me because I usually have the configuration the day before a shift in direction and it lasts anywhere from 3 to 30 days. But the movement is very noticeable and highly dependable. I've poured over charts in it for some 6 months but now I have something that works for me. If it is a premature or immature breakout/fakeout, the 2 runs ahead of the group and I know better than to follow it. Sometimes, in the sideways ups and downs, the 37 will remain behind the others. That tells me the movement is way too choppy for my tastes -- gets into day trading in my mind, rightly or wrongly. When the lines are all over the place, like a bowl of spaghetti, don't waste any time on it. Go to the next chart. */ tgl = ParamToggle ( "Select" , "Chart|Signal" , 0); kSmooth = Param ( "kSmooth" ,3,1,10,1); dSmooth = Param ( "dSmooth" ,1,1,10,1); pA = Param ( "Period A" ,3,1,3,1); pB = Param ( "Period B" ,5,3,7,1); pC = Param ( "Period C" ,8,5,12,1); pD = Param ( "Period D" ,12,8,17,1); pE = Param ( "Period E" ,17,12,21,1); pF = Param ( "Period F" ,21,17,26,1); pG = Param ( "Period G" ,26,21,31,1); pH = Param ( "Period H" ,31,26,35,1); pI = Param ( "Period I" ,35,31,39,1); /* old values sA = StochD( 2, 3, 1); sB = StochD( 5, 3, 1); sC = StochD( 8, 3, 1); sD = StochD( 12, 3, 1); sE = StochD( 17, 3, 1); sF = StochD( 20, 3, 1); sG = StochD( 27, 3, 1); sH = StochD( 31, 3, 1); sI = 0 */ sA = StochD ( pA, kSmooth, dSmooth); // 3 default sB = StochD ( pB, kSmooth, dSmooth); // 5 sC = StochD ( pC, kSmooth, dSmooth); // 7 sD = StochD ( pD, kSmooth, dSmooth); // 12 sE = StochD ( pE, kSmooth, dSmooth); // 17 sF = StochD ( pF, kSmooth, dSmooth); // 21 sG = StochD ( pG, kSmooth, dSmooth); // 26 sH = StochD ( pH, kSmooth, dSmooth); // 31 sI = StochD ( pI, kSmooth, dSmooth); // 35 if (!tgl) /*{ Plot(sA, "Stochastic Multi-line(" + NumToStr(kSmooth,1.0) + "," + NumToStr(dSmooth,1.0) + ") - " + NumToStr(pA,1.0) + " " , colorRed); Plot(sB, NumToStr(pB,1.0), colorLightBlue); Plot(sC, NumToStr(pC,1.0), colorBlue); Plot(sD, NumToStr(pD,1.0), colorIndigo); Plot(sE, NumToStr(pE,1.0), colorBrown); Plot(sF, NumToStr(pF,1.0), colorViolet); Plot(sG, NumToStr(pG,1.0), colorBrightGreen); Plot(sH, NumToStr(pH,1.0), colorTeal); Plot(sI, NumToStr(pI,1.0), colorRed, styleDashed); Plot(20, "", colorBlack, styleLine); Plot(80, "", colorBlack, styleLine); } else { Buy = Cover = sA < 20 AND sB < 20 AND sC < 20 AND sD < 20 AND sE < 20 AND sF < 20 AND sG < 20 AND sH < 20 AND sI < 20; Short = Sell = sA > 80 AND sB > 80 AND sC > 80 AND sD > 80 AND sE > 80 AND sF > 80 AND sG > 80 AND sH > 80 AND sI > 80; Plot(Buy, "Stochastic Multi-line - Oversold", colorGreen); Plot(-Short, "Overbought", colorRed); }*/ _SECTION_END (); //agora=sA < 20 AND sB < 20 AND sC < 20 AND sD < 20 AND sE < 20 AND sF < 20 AND sG < 20 AND sH < 20 AND sI < 20; agora=sA > 20 AND sB > 20 AND sC > 20 AND sD > 20 AND sE < 20 AND sF < 20 AND sG < 20 AND sH < 20 AND sI < 20; pwlhsh=sA > 80 AND sB > 80 AND sC > 80 AND sD > 80 AND sE > 80 AND sF > 80 AND sG > 80 AND sH > 80 AND sI > 80; bc=sA < 20 AND sB < 20 AND sC < 20 AND sD < 20 AND sE < 20 AND sF < 20 AND sG < 20 AND sH < 20 AND sI < 20; ss=sA > 80 AND sB > 80 AND sC > 80 AND sD > 80 AND sE > 80 AND sF > 80 AND sG > 80 AND sH > 80 AND sI > 80; Cond1=sa>sc; Cond2=sg>sh; color = IIf ( bc OR Cond1 OR Cond2, colorGrey50 , IIf ( ss , colorBlack , colorGrey50 )); Plot ( 1, "" , Color, styleArea | styleOwnScale | styleNoLabel , -0.1, 1.5 ); //MAmisio color = IIf ( agora, colorGreen , IIf ( pwlhsh , colorDarkRed , colorGrey50 )); Plot ( 1, "" , Color, styleArea | styleOwnScale | styleNoLabel , -0.1, 1.3 ); ////////////// Title= " " ; ///////////////////// function PercentR( periods ) { return 100 * ( HHV ( H , periods ) - C )/( HHV ( H , periods ) - LLV ( L , periods ) ); } Plot ( PercentR( Param ( "Periods" , 10, 2, 100 ) ), _DEFAULT_NAME (), ParamColor ( "Color" , ColorCycle ) ); Plot ( 90, "" , colorBlue , styleDashed ); Plot ( 10, "" , colorBlue , styleDashed ); Plot ( 80, "" , colorGreen , styleNoLabel ); Plot ( 20, "" , colorGreen , styleNoLabel ); "Statistics of " + Name () + " as of " + Date (); "" ; "Closing price = " + WriteVal ( Close ); "Change since yesterday = " + WriteVal ( Close - Ref ( Close , -1 ) ); "Percent chg. since yesterday = " + WriteVal ( ROC ( Close , 1 ) ) + " %" ; "R% = " + WriteVal ( PercentR( Param ( "Periods" , 14, 2, 100 ) )); "" ; "BUY when 90 or Higher." ; "" ; "SELL when 10 or Lower." ; "" ; "An excellent Trading Indicator. Needless to say the signals MUST be varied/compared with Bollinger Bands and any of Mr. Chaikin's Indicators." ; "" ; "All things being equal, which unfortunately they are not, I would enter a BUY between 80-90 or above, and liquidate my position between 20-10 or below." ; "" ; "GOOD TRADING" ; "" ; "Mubashar Virk, mavirk@gmail.com" ; Color = IIf ( PercentR( Param ( "Periods" , 10, 2, 100 ))>=90, colorBrightGreen , IIf ( PercentR( Param ( "Periods" , 10, 2, 100 ))<=10 AND Ref (PercentR( Param ( "Periods" , 10, 2, 100 )),-1)>10, colorRed , colorGrey50 )); Plot ( 1, "" , Color, styleArea | styleOwnScale | styleNoLabel , -0.1, 1); Title= "nick analysis" ; |
2 comments
Leave Comment
Please login here to leave a comment.
Back
Usefull…what for?
how does it work?