When The S&P 500 Closes Near The Bottom of Its Range But Still Positive For The Day (Amibroker And Tradestation Code)
The strategy in plain English:
- (c-l)/(h-l) (the IBS) must be lower than 0.1.
- Today’s close must be higher than yesterday’s.
- If the above conditions are met, then enter on the close.
- Exit on the close after 3 days or when the close is higher than yesterday’s high.
Click here for the original article.
Amibroker code:
setOption(“holdminbars”,1);
ibs=(C-L)/(H-L) ;
Buy= C>Ref(C,-1) AND ibs<0.1;
buyPrice= Close;
Sell= C>Ref(H,-1);
sellPrice= Close ;
You might also try this extra exit:
ApplyStop(stopTypeNBar,stopModeBars,3,1);
Tradestation code:
{
When The S&P 500 Closes Near The Bottom of Its Range But Still Positive For The Day (Strategy 50)
(c-l)/(h-l) (the IBS) must be lower than 0.1.
Today’s close must be higher than yesterday’s.
If the above conditions are met, then enter on the close.
Exit on the close after 3 days or when the close is higher than yesterday's high.
}
Inputs:
BuyTreshold(0.1),
MaxHoldBars(3);
Vars:
ibs(0);
ibs = (C-L)/(H-L);
if ibs < BuyTreshold and Close > Close[1] Then
Buy this bar on close;
if (BarsSinceEntry(0) > 0 and Close > High[1]) or BarsSinceEntry(0) >= MaxHoldBars Then
Sell this bar on close;
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.
