Print Page  
MISC / UTILITY
MonthBars(bars[, "cid"])
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
AlbaniaALB
AlgeriaDZA
AndorraAND
AngolaAGO
AnguillaAIA
Antigua and BarbudaATG
ArgentinaARG
ArmeniaARM
AustraliaAUS
AustriaAUT
AzerbaijanAZE
BahamasBHS
BahrainBHR
BangladeshBGD
BarbadosBRB
BelarusBLR
BelgiumBEL
BelizeBLZ
BermudaBMU
BoliviaBOL
Bosnia and HerzegovinaBIH
BotswanaBWA
BrazilBRA
BulgariaBGR
CambodiaKHM
CameroonCMR
CanadaCAN
Cayman IslandsCYM
ChileCHL
ChinaCHN
ColombiaCOL
CongoCOD
Costa RicaCRI
Cote d'IvoireCIV
CroatiaHRV
CuracaoCUW
CyprusCYP
Czech RepublicCZE
DenmarkDNK
Dominican RepublicDOM
EcuadorECU
EgyptEGY
El SalvadorSLV
EstoniaEST
Faroe IslandsFRO
FinlandFIN
FranceFRA
GabonGAB
GeorgiaGEO
GermanyDEU
GhanaGHA
GibraltarGIB
GreeceGRC
GreenlandGRL
GuadeloupeGLP
GuamGUM
GuernseyGGY
Holy SeeVAT
Hong KongHKG
HungaryHUN
IcelandISL
IndiaIND
IndonesiaIDN
IranIRN
IraqIRQ
IrelandIRL
Isle of ManIMN
IsraelISR
ItalyITA
JamaicaJAM
JapanJPN
JerseyJEY
JordanJOR
KazakhstanKAZ
KenyaKEN
KuwaitKWT
KyrgyzstanKGZ
LaosLAO
LatviaLVA
LebanonLBN
LiechtensteinLIE
LithuaniaLTU
LuxembourgLUX
MacauMAC
MacedoniaMKD
MalawiMWI
MalaysiaMYS
MaltaMLT
Marshall IslandsMHL
MauritiusMUS
MayotteMYT
MexicoMEX
MoldovaMDA
MonacoMCO
MongoliaMNG
MontenegroMNE
MontserratMSR
MoroccoMAR
MozambiqueMOZ
MyanmarMMR
NamibiaNAM
NepalNPL
NetherlandsNLD
New ZealandNZL
NicaraguaNIC
NigeriaNGA
NorwayNOR
OmanOMN
PakistanPAK
PanamaPAN
Papua New GuineaPNG
PeruPER
PhilippinesPHL
PolandPOL
PortugalPRT
Puerto RicoPRI
QatarQAT
ReunionREU
RomaniaROU
RussiaRUS
RwandaRWA
Saint Vincent and GrenadinesVCT
San MarinoSMR
Saudi ArabiaSAU
SenegalSEN
SerbiaSRB
SeychellesSYC
Sierra LeoneSLE
SingaporeSGP
SlovakiaSVK
SloveniaSVN
Solomon IslandsSLB
South AfricaZAF
South KoreaKOR
SpainESP
Sri LankaLKA
St. Pierre and MiquelonSPM
Svalbard and Jan MayenSJM
SwazilandSWZ
SwedenSWE
SwitzerlandCHE
SyriaSYR
TaiwanTWN
TanzaniaTZA
ThailandTHA
Trinidad and TobagoTTO
TunisiaTUN
TurkeyTUR
Turks and Caicos IslandsTCA
UgandaUGA
UkraineUKR
United Arab EmiratesARE
United KingdomGBR
United StatesUSA
UruguayURY
VenezuelaVEN
Viet NamVNM
Virgin Islands (British)VGB
Virgin Islands (U.S.)VIR
ZambiaZMB
ZimbabweZWE