Crude Oil Trading Strategy (Amibroker And Tradestation Code)
The original article can be found here.
The strategy in plain English:
- Calculate the 25-day average of the daily High minus the Low (daily prices).
- Today is Tuesday or Thursday.
- The close today must be lower than yesterday’s close minus the range in number one.
- We sell at the close of the next trading day.
Amibroker code:
setOption("holdminbars",1);
range=MA((H-L),25);
Buy =(DayOfWeek()==4 OR DayOfWeek()==2 ) AND ( ref(C,-1)-C )> range;
buyPrice=Close;
Sell = C>0 ; //forced sale but hold for one day due to setoptions
sellPrice=Close;
Tradestation code:
( dayofweek(date)=4 or dayofweek(date)=2 )
AND (Close-Close[1]) < Average((h-l), 25)
Then buy this bar on Close;
