The Moving Average Convergence/Divergence indicator is a centered oscillator that shows the difference between two moving averages, typically 12 and 26 days. These values, like any other parameter, can be altered to show the MACD over a different period of time.
The MACD system buys when the MACD goes above zero and sells when it goes below zero. So it's always in the market. Very similar in function to the Dual Moving Average System.
The MACD system uses the following parameters:
Short Moving Average Days
Number of days used to calculate the short moving average
Long Moving Average Days
Number of days used to calculate the long moving average
Average True Range Days
Number of days used to calculate the Average True Range
ATR Stop
ATR Stop (fraction): Fraction of the ATR used for stops
Entry Script
IF macdIndicator > 0 AND
instrument.position <> LONG THEN
IF useATRStops THEN
broker.EnterLongOnOpen( instrument.close - averageTrueRange * atrStop )
ELSE
broker.EnterLongOnOpen
ENDIF
ENDIF
IF macdIndicator < 0 AND
instrument.position <> SHORT THEN
IF useATRStops THEN
broker.EnterShortOnOpen( instrument.close + averageTrueRange * atrStop )
ELSE
broker.EnterShortOnOpen
ENDIF
ENDIF
Adjust Stops
' ---------------------------------------------
' Enter stop if "holdstops" is true
' ---------------------------------------------
IF useATRStops THEN
broker.ExitAllUnitsOnStop( instrument.unitExitStop )
ENDIF
Edit Time: 9/12/2020 9:50:00 AM |
Topic ID#: 165 |