Swordfish Indicators
Custom Indicator Installation

Updated: 2014/08/25

This Swordfish custom indicator example will show you how to install any custom indicator script with parameters.
The indicator is a sample only and is not intended to be a viable trading system.
It will draw a fast and a slow moving average and will label entries as follows:


  • Buy:


  • Short:

The fast MA is above the slow MA and closing price crosses the fast MA in an upwards direction.

The fast MA is below the slow MA and closing price crosses the fast MA in a downwards direction.

Audio alerts are also generated.

Line Colours


  • The Fast MA line is drawn in blue.

  • The Slow MA line is drawn in red.

Two parameters are required to specify the fast and slow moving average periods.

The Swordfish custom indicator sample script can be downloaded here. Follow the detailed instructions below to install this sample indicator or any of the other indicators available. Create the associated parameters exactly as shown lower on this page.

Swordfish Indicator:
CS_Custom.txt CS_Custom.txt
Size : 0.713 Kb
Type : txt

Create the new Indicator on your Swordfish:

Select any of your current charts or add a new chart. Right click on the chart and then left click Edit/Add Indicator.

Swordfish Custom Chart

Click More.

Swordfish Custom Indicator Manager

Expand the Custom folder and then click MyInd0.
Click OK.

Swordfish Custom Indicator

The Indicator Manager dialog box will be displayed. You may also have other indicators listed.
Make sure the Custom.MyInd0 is highlighted and click the Source Code button.

Swordfish Custom Indicator Manager

The dialog box below will be displayed.
Right click on Custom and then click Add Custom Indicator.

Swordfish Custom Indicator Editor

Select CustomIndicator1.

Swordfish Custom Indicator Editor

For this example the indicator is named CS_Custom.
Name your new indicator anything you like. Only use alphanumeric characters and underscores. Do not use spaces.

Swordfish Custom Indicator Editor

Enter a Full or longer indicator name as well as a detailed Description of the indicator.
Neither fields are required.

Swordfish Custom Indicator Editor

Create the parameters:
Repeat these steps for each required parameter. This example uses two indicator parameters.
Other indicator scripts could use many more parameters and some may require none.
This website will usually list the parameters in the table format below. The second column in the table describes the function of the parameter and is not entered in Swordfish.

Name
MAFp
MASp

CS_Custom
Fast MA Periods
Slow MA Periods

Default
10
50

Minimum
1
2

Maximum
100
200

Type
Double
Double

Feel free to change the Default, Minimum and Maximum values to match your preferences where applicable.
Do not amend the parameter Name or Type in any way. The parameter Description field is best left blank.

Right click on the new indicator name. CS_Custom in this example.
Click Add Indicator Parameter.

Swordfish Custom Indicator Editor

Enter the parameter details.

Swordfish Custom Indicator Parameters

Repeat the process for each indicator parameter.
Both parameters for this Swordfish example has been added below.

Swordfish Custom Indicator Parameters

Paste the indicator script code:
Download the custom indicator you want to create. CS_Custom.txt in this sample installation.
Click on the new indicator name. CS_Custom in this example.

Swordfish Custom Indicator Editor

Open the downloaded script file.
Select and copy the code.
Use CTRL-V on your keyboard to paste the code into the Script area.

Swordfish Custom Indicator Editor

Click Check Script to compile the indicator.
Look for the OK! to ensure that the script compiled successfully.
If any errors occurred during the compilation process, they will be listed instead of the OK!. In this case you need to retrace your steps to find where you deviated from the instructions.

Swordfish Custom Indicator Editor

Click Close.
Click Yes when prompted to save the script.

Swordfish Custom Indicator Editor

The Indicator Manager dialog now shows the Main, Custom.MyInd0() and CS_Custom indicators listed as Current Indicators.
Select Custom.MyInd0() and click Delete to remove.
Remove any other indicators or duplicates not required.

Swordfish Custom Indicator Manager

Click OK to return to the chart.

Swordfish Custom Indicator Manager

The displayed Swordfish chart will now include the newly created custom indicator.

Swordfish Custom Indicator Chart

The new custom indicator will also be available to include with other charts when the Select Indicator dialog is displayed.

Swordfish Custom Indicator