Using ShareScripts in ShareScope Part 1: Column Scripts and ShareScript Tools

ShareScripts are files which can be used to provide additional functionality in ShareScope Plus and ShareScope Pro.

You can use ShareScripts to draw analytics and other useful items on the charts. They can be used to create custom columns, filters and alarms, and can also be used to export data.

For more information about coding ShareScripts have a look at our ShareScript documentation available here.

If you would like to view the ShareScript library outside of ShareScope you can locate it here.

Column ShareScripts

These types of scripts can be used as:

Using scripts as columns

Column scripts can be written so that they output either text or a number. Both types can be used when using the script as a column in a table.

To add a script to your table:

  1. Right click on the grey column heading bar at the top of the table and select Add ShareScript Column... from the menu.
  2. If the column script you wish to add is in the list of scripts on your computer select it and click on OK. Otherwise click on the Script Library button on the right-hand side of the dialog window.
  3. The ShareScript Library dialog window has a Search box you can use to quickly find the script you are looking for.
  4. Input your search term, select the correct script and click on Download & Install.
  5. Then click on OK.
  6. If the script requires you to set or accept parameters, a dialog box will open where you can adjust the values as required. Once you are happy with the values entered click on OK.
  7. The script will then be added to the table.

When sorting a table by a script column the process may run for a long period of time. This is due to the way ShareScope has to run the additional code. The dialog may show 'Not responding'. However, that just means that ShareScope is working its hardest to complete the sort.

In some cases you may be warned that the Script has been running for a long time. Generally you should just click Ignore. If you see these messages too often you can disable the notifications.

To do so:

  1. Select the Tools menu, then Options and then the ShareScript tab.
  2. Deselect the option 'Prompt me if scripts run for a long time without terminating' and click on OK.

To remove a ShareScript column, right click on the column heading and select Remove column from the menu.

Using column scripts as Data Mining criteria

Only column scripts written to output a number can be used as Data Mining criteria.

In addition to this, Data Mining does not refresh on an intraday basis.

Most column scripts designed to use intraday data will have an option to include intraday data, this option should not be selected. Intraday bar sizes, where available, should not be used either.

If you wish to use intraday data in conjunction with a script you should consider using the script as a column or as an alarm.

To add a sharescript as a Data Mining criterion do the following:

  1. In Data Mining select or create a new filter using the Select Filter button.
  2. Click on the Add Criterion button.
  3. Select the ShareScript option in the Data Mining Wizard and click on Next.
  4. Click on the Select ShareScript file... button.
  5. If the column script you wish to add is in the list of scripts on your computer select it and click on OK. Otherwise use the Script library to install the script you wish to use as a criterion. Details on how to use the library can be found in the section on Column Scripts above.
  6. Click on Finish and the script will be added as a criterion to the filter.
  7. This will cause the script to run. If the script has a dialog box included as part of its code then this will open and you will be able to make whatever choices you require. Once complete click on OK.
  8. ShareScope will pause while it determines values for the Script you have just selected. Once complete a criterion will be added to the filter.
  9. You will then need to adjust the values on the criterion to limit the list of shares returned by the filter.
  10. Scripts used as filters will generally output data in one of the following three ways:
  1. A range of values - an example would be the RSI value script. This outputs the RSI value and the criterion values need to be adjusted to restrict the list in some way. For example to show any shares where the RSI is above 70, you change the left-hand value on the criterion to 70.
  2. 0 or 1 - Often called a bit filter. 1 represents a positive outcome so both values on the criterion need to be set to 1.00 to restrict the list to show only those shares that meet the criterion.
  3. -1, 0 or 1 - Like a bit filter but allows for positive or negative outcomes. Both values on the criterion will be set to either 1.00 or -1.00

To delete a ShareScript criterion, click on the little cross at the top right of the criterion box or right click on the criterion heading and select Delete this criterion... from the menu.

Using column scripts in conjunction with the Details screen

Column ShareScripts can be added to the Details screen as List box items.

Column scripts that output text or numbers and those that use intraday data can all be applied to the Details screen.

To do so:

  1. Create a new list box and right click on it or right click on an existing list box.
  2. Move the mouse over Add list box item and then select Add ShareScript item... from the sub-menu.
  3. If the column script you wish to add is in the list of scripts on your computer select it and click on OK. Otherwise use the Script library to install the script you wish to use as a criterion. Details on how to you the library can be found in the section on Column Scripts above.
  4. This will cause the script to run. If the script has a dialog box included as part of its code then this will open and you will be able to make any changes you require.
  5. Click on OK and the script will then be added to the List box.

To remove the item from the list box right click on the item and select Delete (<Script Title<) from the menu.

Using column scripts as Alarms

Column ShareScripts can be used as either end-of-day or intraday alarms.

Column scripts that output text or numbers and those that use intraday data can be used as alarms.

There is a specific set of code that needs to be applied when using scripts as alarms. It is usually made clear in the description and/or name of a script if it can be used as an alarm. However, if there is any doubt double check with the support team.

It should be noted that part of the ShareScript code determines whether an alarm acts as an intraday alarm or an end-of-day alarm. The alarms dialog will, therefore, change according to the code in the script.

To use a ShareScript as an alarm:

  1. Select the share or list you wish to alarm
  2. Select the Edit menu and then any of the four Alarm options:
    1. Set an end-of-day alarm for 'share name'
    2. Set an end-of-day alarm for 'list'
    3. Set an intraday alarm for 'share name'
    4. Set an intraday alarm for 'list'
  3. Select the ShareScript option and click on Next.
  4. Click on the Choose Script button.
  5. If the column script you wish to add is in the list of scripts on your computer select it and click on OK. Otherwise use the Script library to install the script you wish to use as a criterion. Details on how to you the library can be found in the section on Column Scripts above.
  6. This will cause the script to run. If the script has a dialog box included as part of its code then this will open and you will be able to make whatever choices you wish. Then click on OK.
  7. Some scripts have predefined outputs while others will allow you to set the range of values which cause the alarm to trigger.

    If the alarm has a predefined output this will be shown in the dialog box. If not then you will need to enter the values which will trigger the alarm

    In the above case if the intraday volume grows to a value which is at least 75% of the 25 day average volume then the alarm is set to trigger.

    You will then be able to click on Next, for intraday alarms, or Finish, for end-of-day alarms.
  8. For intraday alarms click when you click on Next you will be prompted to select the notification method/s for the alarm. Once done click on Finish.

To delete a ShareScript alarm you need to first open the Alarms view.

Select the View menu, New Window and then Alarms.

In the Alarms view you will be able to right click on the Alarm and select Delete alarm.

ShareScript Tools

A ShareScript Tool is a script which is run once. This is usually used to export data to a .csv file which can then be opened by any spreadsheet program you may be using.

To use a ShareScript Tool:

  1. Select the Tools menu and then Use ShareScript tool...
  2. If the ShareScript Tool you wish to add is in the list of scripts on your computer select it and click on OK. Otherwise use the Script library to install the script you wish to use as a criterion. Details on how to use the library can be found in the section on Column Scripts above.
  3. The script may have a dialog box built into its code. If so this will open and you will be required complete this and then click on OK.
  4. The exact result will depend on the script but any file the script outputs will be saved in C:\ShareScope\ShareScript\Output\

As ShareScript tools are designed to only be run once there is no need to delete them.

To learn more about using ShareScripts on graphs click here.