Overnight In The S&P 500 H-L (Amibroker And Tradestation Code)
The strategy in plain English:
- Calculate the average H-L range over the last 25 days (in percent).
- If the ETF falls more than 1.5 times this average, enter at the close.
- Exit at tomorrow’s close.
Amibroker code:
range=MA((H-L),25);
Buy= ( Ref(C,-1)-Close ) > (range*1.5);
buyPrice=Close;
Sell= C>0;
sellPrice= Close ;
Tradestation code:
Var:Rangeentry(0);
Rangeentry=average(range,25);
If c < (c[1]-1.5*Rangeentry)
then buy this bar at close;
Sell next bar at open;
Disclosure: 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.
