Swordfish Indicators
Moving Average Crossover with Closing Confirmation

Updated: 2014/08/20

This always in overnight moving average crossover indicator includes a price confirmation requirement to reduce the number of whipsaw trades.
It includes parameters to limit the trade times and to select the moving average periods you prefer. It can easily be changed to use Exponential Moving Averages.


  • The fast MA line is drawn in green.

  • The slow MA line is drawn in red.

A Buy signal will only be shown when:

  1. The MA Fast crosses up through the MA Slow.

  2. A subsequent candle closes higher than the greater of the open or close of the crossing candle.
    The higher closing price is indicated on the chart using green text as a warning that a Buy signal may occur on the following candle.

  3. Buy trade enter signal is shown on open of next candle.

A Short signal will only be shown when:

  1. The MA Fast crosses down through the MA Slow.

  2. A subsequent candle closes lower than the lesser of the open or close of the crossing candle. The lower closing price is indicated on the chart using red text as a Short signal is imminent.

  3. Short trade enter signal is shown on open of next candle.

The chart below demonstrates how the confirmation closes are used to trigger trades. Click on the chart to see a larger image.

Trade
Short
Long
Short
Long

Date
2013/12/05
2013/12/05
2013/12/05
2013/12/06

Time  (Candle Close)
12:09
13:09
15:44
10:14

Price  (Candle Open)
39797
39942
39828
39790

Create the Moving Average Crossover Indicator on your Swordfish by following the instructions below:
Follow the detailed instructions for the Custom Indicator Installation Example if you are unsure of how to add an indicator or watch our YouTube video.

Create a new custom FML script like the one shown below. Mine is named: CS_MAx
Remember that Swordfish FML does not allow spaces or many other characters in the name. Stick to alphanumerics and underscores.

Moving Average Crossover Indicator Manager

Download the Swordfish indicator script file. Use Ctrl-V to paste the code from the downloaded file into the script area.

Swordfish Indicator:
CS_MAx.txt CS_MAx.txt
Size : 1.063 Kb
Type : txt

CS_MAx uses 4 parameters that have to be added manually when you create the script:

Name
MAFp
MASp
TimeIn
TimeOut

CS_MAx
MA Fast periods
MA Slow periods
Signal start time
Signal end time

Default
10
20
083000
173000

Minimum
1
2
083000
083000

Maximum
100
200
173000
173000

Type
Double
Double
Double
Double