On Balance Volume Trading Strategy (Amibroker And Tradestation Code)
The strategy in plain English (this is an optimization):
When the N-day RSI of the OBV drops below threshold X, then we buy. We sell when the close is higher than yesterday’s high:
- We use an N-day RSI period from two to ten days (intervals of one).
- We use a threshold level from 10 to 40 (intervals of 10)
Amibroker code:
oddis=Optimize(“RSI period”,5,2,10,1) ;
oddis1=Optimize(“Threshold”,30,10,40,10);
Buy = Cross(oddis1,RSIa(OBV(),oddis)) ;
BuyPrice=Close;
Sell = C>Ref(H,-1);
SellPrice=Close;
Tradestation code:
{
Strategy 120 - OBV indicator
When the N-day RSI of the OBV drops below threshold X, then we buy.
We sell when the close is higher than yesterday’s high.
}
Inputs:
Lookback(5),
Treshold(30);
if RSI(OBV, Lookback) cross under Treshold Then
buy this bar on close;
if Close > High[1] then
sell this bar on close;
