Trend Following Strategy In Gold (Amibroker And Tradestation Code)

The strategy in plain English:

 

Go long when the close is above the 12-month moving average, sell when the close is below. Enter and exit at the close. Monthly data.

 

Click here for the original article.

 

Amibroker code:

 

Buy= c>ma(c,12);

buyPrice= C;

Sell= c<ma(c,12);

sellPrice= C ;

 

Tradestation code:

 

If c > average(c,12) then buy this bar at close;
If c < average(c,12) then sell 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.