To create a Custom Indicator, create a System Scoped Auto-Indexed Instrument Permanent Variable of type Series. Then assign this value in the Update Indicators script.

 

An example of a custom indicator might be the average close since trade entry. This value cannot be determined pre test, so it cannot be a calculated indicator and must be a custom indicator.

 

Create a new Auxiliary Block. Create a system scoped auto indexed IPV series variable. Set it to plot. Let's call it averageClose.

 

averageCloseIndicator

 

Now in the Update Indicators script section set the created averageClose series value like this:

Example:

'  We can only compute this value when we are in a position
IF instrument.position <> OUT THEN
 
  '  Compute the number of bars in the trade including the entry bar.
  bars = instrument.unitBarsSinceEntry[1] + 1
 
  '  Compute the average close over the last 'bars' number of bars
  averageClose = Average( instrument.close, bars )
ENDIF

 

This value will be set everyday of the test. It will be set at the start of the instrument bar, so it can be used as part of the order fill process, stop adjustment, risk adjustment, after trading day work as well as entry and exit signals for the next trading day.

 

Links:

Calculated Indicators, Creating Indicators, Custom Indicators, Indicator Access, Indicator Reference

See Also:

Data Groups and Types, Indicator Pack 1 Indicators

 


Edit Time: 9/25/2017 09:09:54 AM


Topic ID#: 246

 

Created with Help & Manual 7 and styled with Premium Pack Version 2.80 © by EC Software