Shorting Oil When Dollar Rises (Amibroker And Tradestation Code)

The strategy in plain English:

 

The test is done by using the ETFs USO and UUP.

 

  • The dollar must rise more than 0.25% (using UUP as a proxy) from yesterday’s close until today’s close,
  • The USO (oil) must rise 0.25%
  • If 1 and 2 are true, go short at the close
  • Exit on the close the next day.

(This strategy doesn’t work anymore.)

 

Click here for the original article.

 

Amibroker code:

 

setOption(“holdminbars”,1);

Fremmed=Foreign(“UUP”,”close”,fixup=1);

Short= (( fremmed-Ref(fremmed,-1) )/Ref(fremmed,-1)) >0.0025 AND ((C-Ref(C,-1))/Ref(C,-1) ) > 0.0025 ;

ShortPrice= Close;

Cover=C>0 ;

CoverPrice= Close ;

 

Tradestation code:

 

If close data2 >= 1.0025*close[1] data2
and close >= 1.0025*close[1]
then sell short this bar at close;
If marketposition=-1 then buy to cover this bar at 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.