Full Description
MonthBars is to be used in strategies that require trading to be done on the nth day of the month or the nth-from-last day of the month. It is to be used only in strategies, not in screens and ranking systems. It should be used with daily rebalancing only.
For strategies that require trading on the nth day of the month, MonthBars(n) will be true on that day and no other. So include that command in your buy rules and append it, followed by
and, to the beginning of each of your sell rules.
For strategies that require trading on the nth-from-last day of the month, MonthBars(-n) will be true on that day and no other. Again, include that command in your buy rules and append it, followed by
and, to the beginning each of your sell rules.
Using MonthBars in buy and sell rules will not affect formula weight rebalancing, which will still occur on other days. Nor will it affect stop loss or hedge rules, which will also force trades on other days. However, MonthBars can be used in hedge rules.
If the region of your universe is not US alone or Canada alone, MonthBars must be used with an additional parameter specifying the country whose holidays you want the strategy to observe.
Example:
To specify a strategy that buys and sells only on the third-to-last trading day of each month based on the British calendar, include
MonthBars(-3, "GBR")
in your buy rule; in addition, each of your sell rules should have this at the beginning:
MonthBars(-3, "GBR") and
Country |
Country Code |
Albania | ALB |
Algeria | DZA |
Andorra | AND |
Angola | AGO |
Anguilla | AIA |
Antigua and Barbuda | ATG |
Argentina | ARG |
Armenia | ARM |
Australia | AUS |
Austria | AUT |
Azerbaijan | AZE |
Bahamas | BHS |
Bahrain | BHR |
Bangladesh | BGD |
Barbados | BRB |
Belarus | BLR |
Belgium | BEL |
Belize | BLZ |
Bermuda | BMU |
Bolivia | BOL |
Bosnia and Herzegovina | BIH |
Botswana | BWA |
Brazil | BRA |
Bulgaria | BGR |
Cambodia | KHM |
Cameroon | CMR |
Canada | CAN |
Cayman Islands | CYM |
Chile | CHL |
China | CHN |
Colombia | COL |
Congo | COD |
Costa Rica | CRI |
Cote d'Ivoire | CIV |
Croatia | HRV |
Curacao | CUW |
Cyprus | CYP |
Czech Republic | CZE |
Denmark | DNK |
Dominican Republic | DOM |
Ecuador | ECU |
Egypt | EGY |
El Salvador | SLV |
Estonia | EST |
Faroe Islands | FRO |
Finland | FIN |
France | FRA |
Gabon | GAB |
Georgia | GEO |
Germany | DEU |
Ghana | GHA |
Gibraltar | GIB |
Greece | GRC |
Greenland | GRL |
Guadeloupe | GLP |
Guam | GUM |
Guernsey | GGY |
Holy See | VAT |
Hong Kong | HKG |
Hungary | HUN |
Iceland | ISL |
India | IND |
Indonesia | IDN |
Iran | IRN |
Iraq | IRQ |
Ireland | IRL |
Isle of Man | IMN |
Israel | ISR |
Italy | ITA |
Jamaica | JAM |
Japan | JPN |
Jersey | JEY |
Jordan | JOR |
Kazakhstan | KAZ |
Kenya | KEN |
Kuwait | KWT |
Kyrgyzstan | KGZ |
Laos | LAO |
Latvia | LVA |
Lebanon | LBN |
Liechtenstein | LIE |
Lithuania | LTU |
Luxembourg | LUX |
Macau | MAC |
Macedonia | MKD |
Malawi | MWI |
Malaysia | MYS |
Malta | MLT |
Marshall Islands | MHL |
Mauritius | MUS |
Mayotte | MYT |
Mexico | MEX |
Moldova | MDA |
Monaco | MCO |
Mongolia | MNG |
Montenegro | MNE |
Montserrat | MSR |
Morocco | MAR |
Mozambique | MOZ |
Myanmar | MMR |
Namibia | NAM |
Nepal | NPL |
Netherlands | NLD |
New Zealand | NZL |
Nicaragua | NIC |
Nigeria | NGA |
Norway | NOR |
Oman | OMN |
Pakistan | PAK |
Panama | PAN |
Papua New Guinea | PNG |
Peru | PER |
Philippines | PHL |
Poland | POL |
Portugal | PRT |
Puerto Rico | PRI |
Qatar | QAT |
Reunion | REU |
Romania | ROU |
Russia | RUS |
Rwanda | RWA |
Saint Vincent and Grenadines | VCT |
San Marino | SMR |
Saudi Arabia | SAU |
Senegal | SEN |
Serbia | SRB |
Seychelles | SYC |
Sierra Leone | SLE |
Singapore | SGP |
Slovakia | SVK |
Slovenia | SVN |
Solomon Islands | SLB |
South Africa | ZAF |
South Korea | KOR |
Spain | ESP |
Sri Lanka | LKA |
St. Pierre and Miquelon | SPM |
Svalbard and Jan Mayen | SJM |
Swaziland | SWZ |
Sweden | SWE |
Switzerland | CHE |
Syria | SYR |
Taiwan | TWN |
Tanzania | TZA |
Thailand | THA |
Trinidad and Tobago | TTO |
Tunisia | TUN |
Turkey | TUR |
Turks and Caicos Islands | TCA |
Uganda | UGA |
Ukraine | UKR |
United Arab Emirates | ARE |
United Kingdom | GBR |
United States | USA |
Uruguay | URY |
Venezuela | VEN |
Viet Nam | VNM |
Virgin Islands (British) | VGB |
Virgin Islands (U.S.) | VIR |
Zambia | ZMB |
Zimbabwe | ZWE |