Jump to content

Backtesting using variables to test best MACD configuration


Recommended Posts

Does anyone know how to back test an automatic trading system that uses macd crossover signals? I understand how to backtest using variables on a moving average but for macd it seems a little more difficult. A snippet of a system below so you can see what I am trying to explain. Any help would appreciated.

 

// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated

// Conditions to enter long positions
indicator1 = Average[1](close)
indicator2 = Average[29](close)
c1 = (indicator1 CROSSES OVER indicator2)

indicator3 = MACDline[37/3, 77/3, 9](close)
indicator4 = ExponentialAverage[9](MACDline[37/3, 77/3, 9](close))
c2 = (indicator3 CROSSES OVER indicator4)

IF c1 AND c2 THEN
BUY 1 PERPOINT AT MARKET
ENDIF

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...