This is a further development of my Seasonality Analysis Indicator that analyses historical data month by month to test for the seasonality of any market.
Apply only on Monthly charts.
In this version you can select a period to be tested as in sample and a period to be tested as out of sample. Comparison of the two allows more accurate analysis of the results.
You can set any number of years for each sample period but be aware that short data samples will not include much data. For example there are only five of each month in a five year sample.
You must set the current month before each test. 1 = Jan and 12 = Dec.
If you set fifteen years for the in sample and ten years for the out of sample then the analysis will start twenty five years back from today. The in sample will be tested on the first fifteen years and and the out of sample on the last ten.
The results you are interested in are the last ones under the current months candle and I suggest making the indicator window full size to make it easier to read.
The result categories are as follows:
Return: The average pips return in that month over the period tested. If you had opened a long bet at the beginning of that month and closed it at the end of that month every year then this is how much you would have gained or lost on average each month.
Rank%: The best performing monthly average return and the worst performing monthly average return are ranked at 100% and -100%. All months in between are given a ranking% relative to these. This is useful if you want to alter position sizing in a strategy month by month based on seasonality. You might want to place position size of 100% of your maximum bet size in months rated at 100% and only 33% in months rated 33% for example.
Reliability%: The number of up months and number of down months are totalled up and a reliability percentage calculated. For example if you test over 10 years and have ten tests of January and January’s results favour long positions then if 7 of those months see a gain and 3 a loss then the reliability is 70%. You may wish to only go long in months with a Reliability% of over 70% for example. This reliability% helps you decide the probability of future results matching historical results.
Rating Score: The in sample and out of sample Rank% and Reliability% are combined and converted into this score. Twice as much weight is given to the more recent out of sample data. A very low score indicates a very good month to enter short trades and a very high score a very good month to enter long trades. The rating can also be used to decide on position size and preferred trade direction for trades month by month. This rating system is unproven and will obviously vary depending on the length of sample periods chosen – so use at your discretion.
If this indicator is used alongside my other two indicators Seasonality Analysis and Seasonality Analysis Graph then any trader should be easily be able to make good decisions on when is a good time to trade long or short and whether to increase or decrease position size month by month for any market where sufficient data is available.
I advise downloading and importing the .itf file to ensure that you get full functionality.
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 |
//Seasonality Analysis In Sample and Out of Sample with Rating //Created by Vonasi //In Sample calculations StartMonthIn = ThisMonth StartYearIn = CurrentYear - (InSampleYears + OutofSampleYears) YearInEnd = CurrentYear - OutOfSampleYears IF OpenYear >= StartYearIn and OpenYear < YearInEnd THEN YearFlag = 1 ELSE YearFlag = 0 ENDIF IF OpenMonth = StartMonthIn and OPenYear = StartYearIn THEN MonthFlag = 1 ENDIF IF YearFlag = 1 and MonthFlag = 1 THEN IF OpenMonth = 1 THEN JanTotal = JanTotal + (close - open) JanCount = JanCount + 1 IF close > open THEN JanUp = JanUp + 1 ENDIF ENDIF IF OpenMonth = 2 THEN FebTotal = FebTotal + (close - open) FebCount = FebCount + 1 IF close > open THEN FebUp = FebUp + 1 ENDIF ENDIF IF OpenMonth = 3 THEN MarTotal = MarTotal + (close - open) MarCount = MarCount + 1 IF close > open THEN MarUp = MarUp + 1 ENDIF ENDIF IF OpenMonth = 4 THEN AprTotal = AprTotal + (close - open) AprCount = AprCount + 1 IF close > open THEN AprUp = AprUp + 1 ENDIF ENDIF IF OpenMonth = 5 THEN MayTotal = MayTotal + (close - open) MayCount = MayCount + 1 IF close > open THEN MayUp = MayUp + 1 ENDIF ENDIF IF OpenMonth = 6 THEN JunTotal = JunTotal + (close - open) JunCount = JunCount + 1 IF close > open THEN JunUp = JunUp + 1 ENDIF ENDIF IF OpenMonth = 7 THEN JulTotal = JulTotal + (close - open) JulCount = JulCount + 1 IF close > open THEN JulUp = JulUp + 1 ENDIF ENDIF IF OpenMonth = 8 THEN AugTotal = AugTotal + (close - open) AugCount = AugCount + 1 IF close > open THEN AugUp = AugUp + 1 ENDIF ENDIF IF OpenMonth = 9 THEN SepTotal = SepTotal + (close - open) SepCount = SepCount + 1 IF close > open THEN SepUp = SepUp + 1 ENDIF ENDIF IF OpenMonth = 10 THEN OctTotal = OctTotal + (close - open) OctCount = OctCount + 1 IF close > open THEN OctUp = OctUp + 1 ENDIF ENDIF IF OpenMonth = 11 THEN NovTotal = NovTotal + (close - open) NovCount = NovCount + 1 IF close > open THEN NovUp = NovUp + 1 ENDIF ENDIF IF OpenMonth = 12 THEN DecTotal = DecTotal + (close - open) DecCount = DecCount + 1 IF close > open THEN DecUp = DecUp + 1 ENDIF ENDIF ENDIF Jan = Round(JanTotal/JanCount) Feb = Round(FebTotal/FebCount) Mar = Round(MarTotal/MarCount) Apr = Round(AprTotal/AprCount) May = Round(MayTotal/MayCount) Jun = Round(JunTotal/JunCount) Jul = Round(JulTotal/JulCount) Aug = Round(AugTotal/AugCount) Sep = Round(SepTotal/SepCount) Oct = Round(OctTotal/OctCount) Nov = Round(NovTotal/NovCount) Dec = Round(DecTotal/DecCount) IF Jan > 0 THEN JanR = 0 JanG = 128 JanRel = Round((JanUp/JanCount)*100) JanRelScore = JanRel ELSE JanR = 128 JanG = 0 JanRel = Round(((JanCount - JanUp)/JanCount)*100) JanRelScore = (0 - JanRel) ENDIF IF Feb > 0 THEN FebR = 0 FebG = 128 FebRel = Round((FebUp/FebCount)*100) FebRelScore = FebRel ELSE FebR = 128 FebG = 0 FebRel = Round(((FebCount - FebUp)/FebCount)*100) FebRelScore = (0 - FebRel) ENDIF IF Mar > 0 THEN MarR = 0 MarG = 128 MarRel = Round((MarUp/MarCount)*100) MarRelScore = MarRel ELSE MarR = 128 MarG = 0 MarRel = Round(((MarCount - MarUp)/MarCount)*100) MarRelScore = (0 - MarRel) ENDIF IF Apr > 0 THEN AprR = 0 AprG = 128 AprRel = Round((AprUp/AprCount)*100) AprRelScore = AprRel ELSE AprR = 128 AprG = 0 AprRel = Round(((AprCount - AprUp)/AprCount)*100) AprRelScore = (0 - AprRel) ENDIF IF May > 0 THEN MayR = 0 MayG = 128 MayRel = Round((MayUp/MayCount)*100) MayRelScore = MayRel ELSE MayR = 128 MayG = 0 MayRel = Round(((MayCount - MayUp)/MayCount)*100) MayRelScore = (0 - MayRel) ENDIF IF Jun > 0 THEN JunR = 0 JunG = 128 JunRel = Round((JunUp/JunCount)*100) JunRelScore = JunRel ELSE JunR = 128 JunG = 0 JunRel = Round(((JunCount - JunUp)/JunCount)*100) JunRelScore = (0 - JunRel) ENDIF IF Jul > 0 THEN JulR = 0 JulG = 128 JulRel = Round((JulUp/JulCount)*100) JulRelScore = JulRel ELSE JulR = 128 JulG = 0 JulRel = Round(((JulCount - JulUp)/JulCount)*100) JulRelScore = (0 - JulRel) ENDIF IF Aug > 0 THEN AugR = 0 AugG = 128 AugRel = Round((AugUp/AugCount)*100) AugRelScore = AugRel ELSE AugR = 128 AugG = 0 AugRel = Round(((AugCount - AugUp)/AugCount)*100) AugRelScore = (0 - AugRel) ENDIF IF Sep > 0 THEN SepR = 0 SepG = 128 SepRel = Round((SepUp/SepCount)*100) SepRelScore = SepRel ELSE SepR = 128 SepG = 0 SepRel = Round(((SepCount - SepUp)/SepCount)*100) SepRelScore = (0 - SepRel) ENDIF IF Oct > 0 THEN OctR = 0 OctG = 128 OctRel = Round((OctUp/OctCount)*100) OctRelScore = OctRel ELSE OctR = 128 OctG = 0 OctRel = Round(((OctCount - OctUp)/OctCount)*100) OctRelScore = (0 - OctRel) ENDIF IF Nov > 0 THEN NovR = 0 NovG = 128 NovRel = Round((NovUp/NovCount)*100) NovRelScore = NovRel ELSE NovR = 128 NovG = 0 NovRel = Round(((NovCount - NovUp)/NovCount)*100) NovRelScore = (0 - NovRel) ENDIF IF Dec > 0 THEN DecR = 0 DecG = 128 DecRel = Round((DecUp/DecCount)*100) DecRelScore = DecRel ELSE DecR = 128 DecG = 0 DecRel = Round(((DecCount - DecUp)/DecCount)*100) DecRelScore = (0 - DecRel) ENDIF Avg = Round((Jan + Feb + Mar + Apr + May + Jun + Jul + Aug + Sep + Oct + Nov + Dec)/12) AvgCount = (JanCount + FebCount + MarCount + AprCount + MayCount + JunCount + JulCount + AugCount + SepCount + OctCount + NovCount + DecCount) AvgUp = (JanUp + FebUp + MarUp + AprUp + MayUp + JunUp + JulUp + AugUp + SepUp + OctUp + NovUp + DecUp) IF Avg > 0 THEN AvgR = 0 AvgG = 128 AvgRel = Round((AvgUp/AvgCount)*100) ELSE AvgR = 128 AvgG = 0 AvgRel = Round(((AvgCount - AvgUp)/AvgCount)*100) ENDIF Bottom = Min(Dec,Min(Nov,Min(Oct,Min(Sep,Min(Aug,Min(Jul,Min(Jun,Min(May,Min(Apr,Min(Mar,MIN(Feb,Jan))))))))))) Top = Max(Dec,Max(Nov,Max(Oct,Max(Sep,Max(Aug,Max(Jul,Max(Jun,Max(May,Max(Apr,Max(Mar,Max(Feb,Jan))))))))))) IF Jan > 0 THEN JanPerc = Round((Jan/Top)*100) ELSE JanPerc = 0 - Round((ABS(Jan)/ABS(Bottom))*100) ENDIF IF Feb > 0 THEN FebPerc = Round((Feb/Top)*100) ELSE FebPerc = 0 - Round((ABS(Feb)/ABS(Bottom))*100) ENDIF IF Mar > 0 THEN MarPerc = Round((Mar/Top)*100) ELSE MarPerc = 0 - Round((ABS(Mar)/ABS(Bottom))*100) ENDIF IF Apr > 0 THEN AprPerc = Round((Apr/Top)*100) ELSE AprPerc = 0 - Round((ABS(Apr)/ABS(Bottom))*100) ENDIF IF May > 0 THEN MayPerc = Round((May/Top)*100) ELSE MayPerc = 0 - Round((ABS(May)/ABS(Bottom))*100) ENDIF IF Jun > 0 THEN JunPerc = Round((Jun/Top)*100) ELSE JunPerc = 0 - Round((ABS(Jun)/ABS(Bottom))*100) ENDIF IF Jul > 0 THEN JulPerc = Round((Jul/Top)*100) ELSE JulPerc = 0 - Round((ABS(Jul)/ABS(Bottom))*100) ENDIF IF Aug > 0 THEN AugPerc = Round((Aug/Top)*100) ELSE AugPerc = 0 - Round((ABS(Aug)/ABS(Bottom))*100) ENDIF IF Sep > 0 THEN SepPerc = Round((Sep/Top)*100) ELSE SepPerc = 0 - Round((ABS(Sep)/ABS(Bottom))*100) ENDIF IF Oct > 0 THEN OctPerc = Round((Oct/Top)*100) ELSE OctPerc = 0 - Round((ABS(Oct)/ABS(Bottom))*100) ENDIF IF Nov > 0 THEN NovPerc = Round((Nov/Top)*100) ELSE NovPerc = 0 - Round((ABS(Nov)/ABS(Bottom))*100) ENDIF IF Dec > 0 THEN DecPerc = Round((Dec/Top)*100) ELSE DecPerc = 0 - Round((ABS(Dec)/ABS(Bottom))*100) ENDIF IF Avg > 0 THEN AvgPerc = Round((Avg/Top)*100) ELSE AvgPerc = 0 - Round((ABS(Avg)/ABS(Bottom))*100) ENDIF //Out of Sample Calculations StartMonthOut = ThisMonth StartYearOut = CurrentYear - OutOfSampleYears IF OpenYear = StartYearOut and OpenMonth = StartMonthOut THEN OutFlag = 1 ENDIF IF OutFlag = 1 THEN IF OpenMonth = 1 THEN JanOutTotal = JanOutTotal + (close - open) JanOutCount = JanOutCount + 1 IF close > open THEN JanOutUp = JanOutUp + 1 ENDIF ENDIF IF OpenMonth = 2 THEN FebOutTotal = FebOutTotal + (close - open) FebOutCount = FebOutCount + 1 IF close > open THEN FebOutUp = FebOutUp + 1 ENDIF ENDIF IF OpenMonth = 3 THEN MarOutTotal = MarOutTotal + (close - open) MarOutCount = MarOutCount + 1 IF close > open THEN MarOutUp = MarOutUp + 1 ENDIF ENDIF IF OpenMonth = 4 THEN AprOutTotal = AprOutTotal + (close - open) AprOutCount = AprOutCount + 1 IF close > open THEN AprOutUp = AprOutUp + 1 ENDIF ENDIF IF OpenMonth = 5 THEN MayOutTotal = MayOutTotal + (close - open) MayOutCount = MayOutCount + 1 IF close > open THEN MayOutUp = MayOutUp + 1 ENDIF ENDIF IF OpenMonth = 6 THEN JunOutTotal = JunOutTotal + (close - open) JunOutCount = JunOutCount + 1 IF close > open THEN JunOutUp = JunOutUp + 1 ENDIF ENDIF IF OpenMonth = 7 THEN JulOutTotal = JulOutTotal + (close - open) JulOutCount = JulOutCount + 1 IF close > open THEN JulOutUp = JulOutUp + 1 ENDIF ENDIF IF OpenMonth = 8 THEN AugOutTotal = AugOutTotal + (close - open) AugOutCount = AugOutCount + 1 IF close > open THEN AugOutUp = AugOutUp + 1 ENDIF ENDIF IF OpenMonth = 9 THEN SepOutTotal = SepOutTotal + (close - open) SepOutCount = SepOutCount + 1 IF close > open THEN SepOutUp = SepOutUp + 1 ENDIF ENDIF IF OpenMonth = 10 THEN OctOutTotal = OctOutTotal + (close - open) OctOutCount = OctOutCount + 1 IF close > open THEN OctOutUp = OctOutUp + 1 ENDIF ENDIF IF OpenMonth = 11 THEN NovOutTotal = NovOutTotal + (close - open) NovOutCount = NovOutCount + 1 IF close > open THEN NovOutUp = NovOutUp + 1 ENDIF ENDIF IF OpenMonth = 12 THEN DecOutTotal = DecOutTotal + (close - open) DecOutCount = DecOutCount + 1 IF close > open THEN DecOutUp = DecOutUp + 1 ENDIF ENDIF ENDIF JanOut = Round(JanOutTotal/JanOutCount) FebOut = Round(FebOutTotal/FebOutCount) MarOut = Round(MarOutTotal/MarOutCount) AprOut = Round(AprOutTotal/AprOutCount) MayOut = Round(MayOutTotal/MayOutCount) JunOut = Round(JunOutTotal/JunOutCount) JulOut = Round(JulOutTotal/JulOutCount) AugOut = Round(AugOutTotal/AugOutCount) SepOut = Round(SepOutTotal/SepOutCount) OctOut = Round(OctOutTotal/OctOutCount) NovOut = Round(NovOutTotal/NovOutCount) DecOut = Round(DecOutTotal/DecOutCount) IF JanOut > 0 THEN JanOutR = 0 JanOutG = 128 JanOutRel = Round((JanOutUp/JanOutCount)*100) JanOutRelScore = JanOutRel ELSE JanOutR = 128 JanOutG = 0 JanOutRel = Round(((JanOutCount - JanOutUp)/JanOutCount)*100) JanOutRelScore = (0 - JanOutRel) ENDIF IF FebOut > 0 THEN FebOutR = 0 FebOutG = 128 FebOutRel = Round((FebOutUp/FebOutCount)*100) FebOutRelScore = FebOutRel ELSE FebOutR = 128 FebOutG = 0 FebOutRel = Round(((FebOutCount - FebOutUp)/FebOutCount)*100) FebOutRelScore = (0 - FebOutRel) ENDIF IF MarOut > 0 THEN MarOutR = 0 MarOutG = 128 MarOutRel = Round((MarOutUp/MarOutCount)*100) MarOutRelScore = MarOutRel ELSE MarOutR = 128 MarOutG = 0 MarOutRel = Round(((MarOutCount - MarOutUp)/MarOutCount)*100) MarOutRelScore = (0 - MarOutRel) ENDIF IF AprOut > 0 THEN AprOutR = 0 AprOutG = 128 AprOutRel = Round((AprOutUp/AprOutCount)*100) AprOutRelScore = AprOutRel ELSE AprOutR = 128 AprOutG = 0 AprOutRel = Round(((AprOutCount - AprOutUp)/AprOutCount)*100) AprOutRelScore = (0 - AprOutRel) ENDIF IF MayOut > 0 THEN MayOutR = 0 MayOutG = 128 MayOutRel = Round((MayOutUp/MayOutCount)*100) MayOutRelScore = MayOutRel ELSE MayOutR = 128 MayOutG = 0 MayOutRel = Round(((MayOutCount - MayOutUp)/MayOutCount)*100) MayOutRelScore = (0 - MayOutRel) ENDIF IF JunOut > 0 THEN JunOutR = 0 JunOutG = 128 JunOutRel = Round((JunOutUp/JunOutCount)*100) JunOutRelScore = JunOutRel ELSE JunOutR = 128 JunOutG = 0 JunOutRel = Round(((JunOutCount - JunOutUp)/JunOutCount)*100) JunOutRelScore = (0 - JunOutRel) ENDIF IF JulOut > 0 THEN JulOutR = 0 JulOutG = 128 JulOutRel = Round((JulOutUp/JulOutCount)*100) JulOutRelScore = JulOutRel ELSE JulOutR = 128 JulOutG = 0 JulOutRel = Round(((JulOutCount - JulOutUp)/JulOutCount)*100) JulOutRelScore = (0 - JulOutRel) ENDIF IF AugOut > 0 THEN AugOutR = 0 AugOutG = 128 AugOutRel = Round((AugOutUp/AugOutCount)*100) AugOutRelScore = AugOutRel ELSE AugOutR = 128 AugOutG = 0 AugOutRel = Round(((AugOutCount - AugOutUp)/AugOutCount)*100) AugOutRelScore = (0 - AugOutRel) ENDIF IF SepOut > 0 THEN SepOutR = 0 SepOutG = 128 SepOutRel = Round((SepOutUp/SepOutCount)*100) SepOutRelScore = SepOutRel ELSE SepOutR = 128 SepOutG = 0 SepOutRel = Round(((SepOutCount - SepOutUp)/SepOutCount)*100) SepOutRelScore = (0 - SepOutRel) ENDIF IF OctOut > 0 THEN OctOutR = 0 OctOutG = 128 OctOutRel = Round((OctOutUp/OctOutCount)*100) OctOutRelScore = OctOutRel ELSE OctOutR = 128 OctOutG = 0 OctOutRel = Round(((OctOutCount - OctOutUp)/OctOutCount)*100) OctOutRelScore = (0 - OctOutRel) ENDIF IF NovOut > 0 THEN NovOutR = 0 NovOutG = 128 NovOutRel = Round((NovOutUp/NovOutCount)*100) NovOutRelScore = NovOutRel ELSE NovOutR = 128 NovOutG = 0 NovOutRel = Round(((NovOutCount - NovOutUp)/NovOutCount)*100) NovOutRelScore = (0 - NovOutRel) ENDIF IF DecOut > 0 THEN DecOutR = 0 DecOutG = 128 DecOutRel = Round((DecOutUp/DecOutCount)*100) DecOutRelScore = DecOutRel ELSE DecOutR = 128 DecOutG = 0 DecOutRel = Round(((DecOutCount - DecOutUp)/DecOutCount)*100) DecOutRelScore = (0 - DecOutRel) ENDIF AvgOut = Round((JanOut + FebOut + MarOut + AprOut + MayOut + JunOut + JulOut + AugOut + SepOut + OctOut + NovOut + DecOut)/12) AvgOutCount = (JanOutCount + FebOutCount + MarOutCount + AprOutCount + MayOutCount + JunOutCount + JulOutCount + AugOutCount + SepOutCount + OctOutCount + NovOutCount + DecOutCount) AvgOutUp = (JanOutUp + FebOutUp + MarOutUp + AprOutUp + MayOutUp + JunOutUp + JulOutUp + AugOutUp + SepOutUp + OctOutUp + NovOutUp + DecOutUp) IF AvgOut > 0 THEN AvgOutR = 0 AvgOutG = 128 AvgOutRel = Round((AvgOutUp/AvgOutCount)*100) ELSE AvgOutR = 128 AvgOutG = 0 AvgOutRel = Round(((AvgOutCount - AvgOutUp)/AvgOutCount)*100) ENDIF BottomOut = Min(DecOut,Min(NovOut,Min(OctOut,Min(SepOut,Min(AugOut,Min(JulOut,Min(JunOut,Min(MayOut,Min(AprOut,Min(MarOut,MIN(FebOut,JanOut))))))))))) TopOut = Max(DecOut,Max(NovOut,Max(OctOut,Max(SepOut,Max(AugOut,Max(JulOut,Max(JunOut,Max(MayOut,Max(AprOut,Max(MarOut,Max(FebOut,JanOut))))))))))) IF JanOut > 0 THEN JanOutPerc = Round((JanOut/TopOut)*100) ELSE JanOutPerc = 0 - Round((ABS(JanOut)/ABS(BottomOut))*100) ENDIF IF FebOut > 0 THEN FebOutPerc = Round((FebOut/TopOut)*100) ELSE FebOutPerc = 0 - Round((ABS(FebOut)/ABS(BottomOut))*100) ENDIF IF MarOut > 0 THEN MarOutPerc = Round((MarOut/TopOut)*100) ELSE MarOutPerc = 0 - Round((ABS(MarOut)/ABS(BottomOut))*100) ENDIF IF AprOut > 0 THEN AprOutPerc = Round((AprOut/TopOut)*100) ELSE AprOutPerc = 0 - Round((ABS(AprOut)/ABS(BottomOut))*100) ENDIF IF MayOut > 0 THEN MayOutPerc = Round((MayOut/TopOut)*100) ELSE MayOutPerc = 0 - Round((ABS(MayOut)/ABS(BottomOut))*100) ENDIF IF JunOut > 0 THEN JunOutPerc = Round((JunOut/TopOut)*100) ELSE JunOutPerc = 0 - Round((ABS(JunOut)/ABS(BottomOut))*100) ENDIF IF JulOut > 0 THEN JulOutPerc = Round((JulOut/TopOut)*100) ELSE JulOutPerc = 0 - Round((ABS(JulOut)/ABS(BottomOut))*100) ENDIF IF AugOut > 0 THEN AugOutPerc = Round((AugOut/TopOut)*100) ELSE AugOutPerc = 0 - Round((ABS(AugOut)/ABS(BottomOut))*100) ENDIF IF SepOut > 0 THEN SepOutPerc = Round((SepOut/TopOut)*100) ELSE SepOutPerc = 0 - Round((ABS(SepOut)/ABS(BottomOut))*100) ENDIF IF OctOut > 0 THEN OctOutPerc = Round((OctOut/TopOut)*100) ELSE OctOutPerc = 0 - Round((ABS(OctOut)/ABS(BottomOut))*100) ENDIF IF NovOut > 0 THEN NovOutPerc = Round((NovOut/TopOut)*100) ELSE NovOutPerc = 0 - Round((ABS(NovOut)/ABS(BottomOut))*100) ENDIF IF DecOut > 0 THEN DecOutPerc = Round((DecOut/TopOut)*100) ELSE DecOutPerc = 0 - Round((ABS(DecOut)/ABS(BottomOut))*100) ENDIF IF AvgOut > 0 THEN AvgOutPerc = Round((AvgOut/TopOut)*100) ELSE AvgOutPerc = 0 - Round((ABS(AvgOut)/ABS(BottomOut))*100) ENDIF //Rating Calculations JanScore = Round((((((JanPerc/2) + JanOutPerc)/2) + (((JanRelScore/2) + JanOutRelScore)/2))/20)*10)/10 FebScore = Round((((((FebPerc/2) + FebOutPerc)/2) + (((FebRelScore/2) + FebOutRelScore)/2))/20)*10)/10 MarScore = Round((((((MarPerc/2) + MarOutPerc)/2) + (((MarRelScore/2) + MarOutRelScore)/2))/20)*10)/10 AprScore = Round((((((AprPerc/2) + AprOutPerc)/2) + (((AprRelScore/2) + AprOutRelScore)/2))/20)*10)/10 MayScore = Round((((((MayPerc/2) + MayOutPerc)/2) + (((MayRelScore/2) + MayOutRelScore)/2))/20)*10)/10 JunScore = Round((((((JunPerc/2) + JunOutPerc)/2) + (((JunRelScore/2) + JunOutRelScore)/2))/20)*10)/10 JulScore = Round((((((JulPerc/2) + JulOutPerc)/2) + (((JulRelScore/2) + JulOutRelScore)/2))/20)*10)/10 AugScore = Round((((((AugPerc/2) + AugOutPerc)/2) + (((AugRelScore/2) + AugOutRelScore)/2))/20)*10)/10 SepScore = Round((((((SepPerc/2) + SepOutPerc)/2) + (((SepRelScore/2) + SepOutRelScore)/2))/20)*10)/10 OctScore = Round((((((OctPerc/2) + OctOutPerc)/2) + (((OctRelScore/2) + OctOutRelScore)/2))/20)*10)/10 NovScore = Round((((((NovPerc/2) + NovOutPerc)/2) + (((NovRelScore/2) + NovOutRelScore)/2))/20)*10)/10 DecScore = Round((((((DecPerc/2) + DecOutPerc)/2) + (((DecRelScore/2) + DecOutRelScore)/2))/20)*10)/10 IF JanScore > 0 THEN JanScoreR = 0 JanScoreG = 128 ELSE JanScoreR = 128 JanScoreG = 0 ENDIF IF FebScore > 0 THEN FebScoreR = 0 FebScoreG = 128 ELSE FebScoreR = 128 FebScoreG = 0 ENDIF IF MarScore > 0 THEN MarScoreR = 0 MarScoreG = 128 ELSE MarScoreR = 128 MarScoreG = 0 ENDIF IF AprScore > 0 THEN AprScoreR = 0 AprScoreG = 128 ELSE AprScoreR = 128 AprScoreG = 0 ENDIF IF MayScore > 0 THEN MayScoreR = 0 MayScoreG = 128 ELSE MayScoreR = 128 MayScoreG = 0 ENDIF IF JunScore > 0 THEN JunScoreR = 0 JunScoreG = 128 ELSE JunScoreR = 128 JunScoreG = 0 ENDIF IF JulScore > 0 THEN JulScoreR = 0 JulScoreG = 128 ELSE JulScoreR = 128 JulScoreG = 0 ENDIF IF AugScore > 0 THEN AugScoreR = 0 AugScoreG = 128 ELSE AugScoreR = 128 AugScoreG = 0 ENDIF IF SepScore > 0 THEN SepScoreR = 0 SepScoreG = 128 ELSE SepScoreR = 128 SepScoreG = 0 ENDIF IF OctScore > 0 THEN OctScoreR = 0 OctScoreG = 128 ELSE OctScoreR = 128 OctScoreG = 0 ENDIF IF NovScore > 0 THEN NovScoreR = 0 NovScoreG = 128 ELSE NovScoreR = 128 NovScoreG = 0 ENDIF IF DecScore > 0 THEN DecScoreR = 0 DecScoreG = 128 ELSE DecScoreR = 128 DecScoreG = 0 ENDIF //Text IF StartMonthIn = 1 THEN DrawText(" From Jan #StartYearIn#",barindex,55,SansSerif,Standard,10)coloured(0,0,0) ENDIF IF StartMonthIn = 2 THEN DrawText(" From Feb #StartYearIn#" ,barindex,15.5,SansSerif,Standard,10)coloured(0,0,0) ENDIF IF StartMonthIn = 3 THEN DrawText(" From Mar #StartYearIn#",barindex,55,SansSerif,Standard,10)coloured(0,0,0) ENDIF IF StartMonthIn = 4 THEN DrawText(" From Apr #StartYearIn#",barindex,55,SansSerif,Standard,10)coloured(0,0,0) ENDIF IF StartMonthIn = 5 THEN DrawText(" From May #StartYearIn#",barindex,55,SansSerif,Standard,10)coloured(0,0,0) ENDIF IF StartMonthIn = 6 THEN DrawText(" From Jun #StartYearIn#",barindex,55,SansSerif,Standard,10)coloured(0,0,0) ENDIF IF StartMonthIn = 7 THEN DrawText(" From Jul #StartYearIn#",barindex,55,SansSerif,Standard,10)coloured(0,0,0) ENDIF IF StartMonthIn = 8 THEN DrawText(" From Aug #StartYearIn#",barindex,55,SansSerif,Standard,10)coloured(0,0,0) ENDIF IF StartMonthIn = 9 THEN DrawText(" From Sep #StartYearIn#",barindex,55,SansSerif,Standard,10)coloured(0,0,0) ENDIF IF StartMonthIn = 10 THEN DrawText(" From Oct #StartYearIn#",barindex,55,SansSerif,Standard,10)coloured(0,0,0) ENDIF IF StartMonthIn = 11 THEN DrawText(" From Nov #StartYearIn#",barindex,55,SansSerif,Standard,10)coloured(0,0,0) ENDIF IF StartMonthIn = 12 THEN DrawText(" From Dec #StartYearIn#",barindex,55,SansSerif,Standard,10)coloured(0,0,0) ENDIF DrawText(" Return Rank% Reliability%",barindex,52,SansSerif,Standard,10)coloured(0,0,0) DrawText("Jan IS #Jan# #JanPerc# #JanRel#",barindex,48,SansSerif,Standard,10)coloured(JanR,JanG,0) DrawText("Feb IS #Feb# #FebPerc# #FebRel#",barindex,44,SansSerif,Standard,10)coloured(FebR,FebG,0) DrawText("Mar IS #Mar# #MarPerc# #MarRel#",barindex,40,SansSerif,Standard,10)coloured(MarR,MarG,0) DrawText("Apr IS #Apr# #AprPerc# #AprRel#",barindex,36,SansSerif,Standard,10)coloured(AprR,AprG,0) DrawText("May IS #May# #MayPerc# #MayRel#",barindex,32,SansSerif,Standard,10)coloured(MayR,MayG,0) DrawText("Jun IS #Jun# #JunPerc# #JunRel#",barindex,28,SansSerif,Standard,10)coloured(JunR,JunG,0) DrawText("Jul IS #Jul# #JulPerc# #JulRel#",barindex,24,SansSerif,Standard,10)coloured(JulR,JulG,0) DrawText("Aug IS #Aug# #AugPerc# #AugRel#",barindex,20,SansSerif,Standard,10)coloured(AugR,AugG,0) DrawText("Sep IS #Sep# #SepPerc# #SepRel#",barindex,16,SansSerif,Standard,10)coloured(SepR,SepG,0) DrawText("Oct IS #Oct# #OctPerc# #OctRel#",barindex,12,SansSerif,Standard,10)coloured(OctR,OctG,0) DrawText("Nov IS #Nov# #NovPerc# #NovRel#",barindex,8,SansSerif,Standard,10)coloured(NovR,NovG,0) DrawText("Dec IS #Dec# #DecPerc# #DecRel#",barindex,4,SansSerif,Standard,10)coloured(DecR,DecG,0) DrawText("Avg IS #Avg# #AvgPerc# #AvgRel#",barindex,-2,SansSerif,Standard,10)coloured(AvgR,AvgG,0) DrawText("_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _",barindex,50,SansSerif,Standard,10)coloured(128,128,128) DrawText("Jan OS #JanOut# #JanOutPerc# #JanOutRel#",barindex,46,SansSerif,Standard,10)coloured(JanOutR,JanOutG,0) DrawText("_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _",barindex,46,SansSerif,Standard,10)coloured(128,128,128) DrawText("Feb OS #FebOut# #FebOutPerc# #FebOutRel#",barindex,42,SansSerif,Standard,10)coloured(FebOutR,FebOutG,0) DrawText("_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _",barindex,42,SansSerif,Standard,10)coloured(128,128,128) DrawText("Mar OS #MarOut# #MarOutPerc# #MarOutRel#",barindex,38,SansSerif,Standard,10)coloured(MarOutR,MarOutG,0) DrawText("_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _",barindex,38,SansSerif,Standard,10)coloured(128,128,128) DrawText("Apr OS #AprOut# #AprOutPerc# #AprOutRel#",barindex,34,SansSerif,Standard,10)coloured(AprOutR,AprOutG,0) DrawText("_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _",barindex,34,SansSerif,Standard,10)coloured(128,128,128) DrawText("May OS #MayOut# #MayOutPerc# #MayOutRel#",barindex,30,SansSerif,Standard,10)coloured(MayOutR,MayOutG,0) DrawText("_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _",barindex,30,SansSerif,Standard,10)coloured(128,128,128) DrawText("Jun OS #JunOut# #JunOutPerc# #JunOutRel#",barindex,26,SansSerif,Standard,10)coloured(JunOutR,JunOutG,0) DrawText("_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _",barindex,26,SansSerif,Standard,10)coloured(128,128,128) DrawText("Jul OS #JulOut# #JulOutPerc# #JulOutRel#",barindex,22,SansSerif,Standard,10)coloured(JulOutR,JulOutG,0) DrawText("_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _",barindex,22,SansSerif,Standard,10)coloured(128,128,128) DrawText("Aug OS #AugOut# #AugOutPerc# #AugOutRel#",barindex,18,SansSerif,Standard,10)coloured(AugOutR,AugOutG,0) DrawText("_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _",barindex,18,SansSerif,Standard,10)coloured(128,128,128) DrawText("Sep OS #SepOut# #SepOutPerc# #SepOutRel#",barindex,14,SansSerif,Standard,10)coloured(SepOutR,SepOutG,0) DrawText("_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _",barindex,14,SansSerif,Standard,10)coloured(128,128,128) DrawText("Oct OS #OctOut# #OctOutPerc# #OctOutRel#",barindex,10,SansSerif,Standard,10)coloured(OctOutR,OctOutG,0) DrawText("_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _",barindex,10,SansSerif,Standard,10)coloured(128,128,128) DrawText("Nov OS #NovOut# #NovOutPerc# #NovOutRel#",barindex,6,SansSerif,Standard,10)coloured(NovOutR,NovOutG,0) DrawText("_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _",barindex,6,SansSerif,Standard,10)coloured(128,128,128) DrawText("Dec OS #DecOut# #DecOutPerc# #DecOutRel#",barindex,2,SansSerif,Standard,10)coloured(DecOutR,DecOutG,0) DrawText("_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _",barindex,2,SansSerif,Standard,10)coloured(128,128,128) DrawText("Avg OS #AvgOut# #AvgOutPerc# #AvgOutRel#",barindex,-4,SansSerif,Standard,10)coloured(AvgOutR,AvgOutG,0) DrawText("Rating Score",barindex,-8,SansSerif,Standard,10)coloured(0,0,0) DrawText("Jan #JanScore#",barindex,-12,SansSerif,Standard,10)coloured(JanScoreR,JanScoreG,0) DrawText("Feb #FebScore#",barindex,-14,SansSerif,Standard,10)coloured(FebScoreR,FebScoreG,0) DrawText("Mar #MarScore#",barindex,-16,SansSerif,Standard,10)coloured(MarScoreR,MarScoreG,0) DrawText("Apr #AprScore#",barindex,-18,SansSerif,Standard,10)coloured(AprScoreR,AprScoreG,0) DrawText("May #MayScore#",barindex,-20,SansSerif,Standard,10)coloured(MayScoreR,MayScoreG,0) DrawText("Jun #JunScore#",barindex,-22,SansSerif,Standard,10)coloured(JunScoreR,JunScoreG,0) DrawText("Jul #JulScore#",barindex,-24,SansSerif,Standard,10)coloured(JulScoreR,JulScoreG,0) DrawText("Aug #AugScore#",barindex,-26,SansSerif,Standard,10)coloured(AugScoreR,AugScoreG,0) DrawText("Sep #SepScore#",barindex,-28,SansSerif,Standard,10)coloured(SepScoreR,SepScoreG,0) DrawText("Oct #OctScore#",barindex,-30,SansSerif,Standard,10)coloured(OctScoreR,OctScoreG,0) DrawText("Nov #NovScore#",barindex,-32,SansSerif,Standard,10)coloured(NovScoreR,NovScoreG,0) DrawText("Dec #DecScore#",barindex,-34,SansSerif,Standard,10)coloured(DecScoreR,DecScoreG,0) Hi = 57 Mid = 50 Mid2 = 0 Lo = -6 Lo1 = -10 Lo2 = -36 Return Hi as "Line1", Mid as "Line2", Mid2 as "Line3", Lo as "Line4", Lo1 as "Line5", Lo2 as "Line6" |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
Hello Vonasi, In the same spirit as this table would you have something similar to analyze on daily data. In order to determine in the long run if a Monday is rather hauled or lowered, Tuesday, Wednesday etc .
Sorry but I don’t have anything like that at the moment. This thread might be of interest to you though https://www.prorealcode.com/topic/investor-behavior/page/2/ . I have put on there a strategy that can be run to analyse buying at each hour of each day and then selling after a preset length of time. You can use this to work out which days and which hours have been historically better times to trade long.
Too bad for my question … 😉 And thank you for the link!
Very Very Good!
Thanks for the compliments ALE. If you use any results from it in a strategy then please share as you usually do!
this is Awesome tool. thanks Vonasi
….and thank you for the compliment CKW.