phantom (int Dir, int FastPeriod, int SlowPeriod) : int
Indicator for 'equity curve trading'. Detects from the equity curve if the market has changed
and trading with the current asset/algo combination is not advised. Can be used
to switch from live trading to phantom trading by setting the
TR_PHANTOM flag.
Parameters:
| Dir |
1 for long trading, -1 for
short trading, 0 for both. |
| TimeFrame |
The number of bars in the series to be compared, or 0 for using the length of the pattern. Determines the horizontal size of the pattern. |
| Scale |
The vertical size of the pattern (f.i. 10*PIP for detecting a 10 pips tall pattern). Use a negative scale for inverting the pattern. |
| Pattern |
The pattern shape to be detected in the series, given by an array of positive values that starts with the oldest value and ends with 0 as an end mark. |
Returns
Similarity between Data and Pattern in percent, normally in the 20..80 range.
Remarks:
- This function creates series and thus
must be called in a fixed order in the script.
- The source code can be found in indicators.c.
Example:
//detect 10-pip 10-bar cup formations in the price curve
function run()
{
vars Price = series(price());
static var cup[10] = { 6,3,2,1,1,1,2,3,6,0 };
plot("Cup Similarity",frechet(Price, 0, 10*PIP, cup),NEW,RED);
}
See also:
predict, Phantom Trading
► latest
version online