Last Trading Day Of The Month Trading Strategy (Amibroker And Tradestation Code)
The strategies on this page were summarized in this article.
Strategy 1: Average gain the last trading day of the month
The strategy in plain English:
- Go long at the close on the second last day of the month.
- Exit at the close on the last trading day of the month (not calendar day).
Amibroker code:
setOption(“holdminbars”,1);
Buy= Ref(Month(),1)!=Ref(Month(),2);
buyPrice=Close;
Sell= C>0 ; //force exit
sellPrice=close ;
Strategy 2: Overnight gain until the last trading day of the month
The strategy in plain English:
- Go long at the close on the second last day of the month.
- Exit at the open on the last trading day of the month (not calendar day).
Amibroker code:
setOption(“holdminbars”,1);
Buy= Ref(Month(),1)!=Ref(Month(),2);
buyPrice=Close;
Sell= C>0 ; //force exit
sellPrice=open ;
Strategy 3: Average gain from open to close last trading day of the month
The strategy in plain English:
- Enter at the open on the last trading day of the month.
- Exit at the close of the same day (the close of the month).
Amibroker code:
Buy= Month()!=Ref(Month(),1);
buyPrice=Open;
Sell= C>0 ;
sellPrice=close ;
Tradestation code:
{
Last Trading Day Of The Month (Strategy 81A)
Go long at the close on the second last day of the month.
Exit at the close on the last trading day of the month (not calendar day).
}
if TdaysTillMonthEnd = 1 then Buy this bar on close;
if TdaysTillMonthEnd = 0 then Sell this bar on close;
-----------------------------------------------
{
Last Trading Day Of The Month (Strategy 81B)
Go long at the close on the second last day of the month.
Exit at the open on the last trading day of the month (not calendar day).
}
if TdaysTillMonthEnd = 1 then
begin
Buy this bar on close;
Sell next bar on open;
end;
------------------------------------------------
{
Last Trading Day Of The Month (Strategy 81C)
Enter at the open on the last trading day of the month.
Exit at the close of the same day (the close of the month).
}
if TdaysTillMonthEnd = 1 then Buy next bar on open;
if TdaysTillMonthEnd = 0 then Sell this bar on close;
Disclaimer: We are not financial advisors. Please do your own due diligence and investment research or consult a financial professional. All articles are our opinions – they are not suggestions to buy or sell any securities.
