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. Conversely, 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. You will need to use the function once in the buy rules to prevent from buying any other day, and in all your sell rules. See the example below.
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.
To specify a strategy that buys and sells only on the third-to-last trading day of each month based on the British calendar, add this Buy rule
MonthBars(-3, "GBR")
Since sell rules operate as OR operations, you need to add this at the beginning of ALL your sell rules:
MonthBars(-3, "GBR") AND "your sell rule"
For a list of country ids see the Country() function.