Gold Weekend Trading Strategy (GLD Swing Trading) (Amibroker And Tradestation Code)

The original article can be found here.

Amibroker code:

How to check the daily return from buying the close of weekday x and selling at the close the next day:

setOption(“holdminbars”,1);
oddis=Optimize(“Day of week”,1,1,5,1);

Buy= DayOfWeek()==oddis ;
buyPrice=Close;
Sell= C>0 ; //force exit next day
sellPrice=Close ;  //to exit on next day’s open type “open”

 

To test for day trades, ie. from the open to the close on the same day, remove “setOption(“holdminbars”,1);” and put buyprice as “open” and sellprice as “close”.

The gold weekend strategy is as follows in plain English:

  • If today is Thursday buy at the close
  • Sell on Monday’s open

This is the Amibroker code:

setOption(“holdminbars”,1);

Buy= DayOfWeek()==4 ;
buyPrice=Close;
Sell= DayOfWeek()==1 ;
sellPrice=Open ;

This is the Tradestation/Easy Language code:

If dayofweek(date)=4
then buy this bar at close;
If dayofweek(date)=5 then sell next bar at open;

Disclaimer: 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.