There are two topics previously discussed here related to this concept. One is that all, and I do mean all, positive returns for the SPY occur out of session (close to open).

The other is that the end of month trade is real:
http://www.evernote.com/l/ACPLTIhwvNNB1I69NDoCRR7M3nALsywF8FA/

As for your strat, you'll have to try various combinations of date rules and period deltas. Try just entering on the end of the month -- without the high - close test.
def initialize(context):
context.stock = symbol('SPY')
schedule_function(EnterLong,
date_rule=date_rules.month_end(days_offset=2),
time_rule=time_rules.market_close(hours=0, minutes=5))
schedule_function(ClosePosition,
date_rule=date_rules.month_start(days_offset=1),
time_rule=time_rules.market_close(hours=0, minutes=5))
def handle_data(context, data):
pass
def EnterLong(context, data):
order_target_percent(context.stock, 1.0)
print("EnterLong")
def ClosePosition(context, data):
if context.portfolio.positions[context.stock].amount > 0:
order_target_percent(context.stock, 0.0)
print("ClosePosition")