Pattern
Pattern functions are mostly used for detecting patterns and accessing pattern script instances. For performance reasons patterns should only be created from the OnInitialize function and never from the OnBarUpdate function or any other frequently called function.
Read more: Pattern Scripts
Sections
Name |
Description |
Determines whether a specified pattern that ends with the specified bar of the underlying symbol was found, which is equivalent to patternIdentifier[barshift]. |
|
Removes a specified pattern so that it no longer takes up memory. Note that calling this function is rarely required since memory will be freed when the script shuts down. |
|
Creates a copy of a specified OnInitialize pattern parameter while assigning the copy an underlying symbol. Note that this is required since the OnInitialize pattern parameter in a Multi-Symbol Trading Strategy doesn't have an underlying symbol assigned to it by default. |
|
Gets the underlying symbol index of a specified pattern. |
|
Gets the number of bars processed so far by the pattern. |
int PatternMatch(Pattern pattern, int barShift) |
|||||||||
Determines whether a specified pattern that ends with the specified bar of the underlying symbol was found, which is equivalent to patternIdentifier[barshift]. Returns The number of bars in the pattern that ends with the specified bar of the underlying symbol, zero if the pattern was not found. Parameters
Scripts TradeManagementStrategy, Drawing, Indicator, MultiSymbolTradingStrategy, Pattern, PositionSizing, Signal, TradingStrategy |
PatternRemove(Pattern pattern) |
||||||
Removes a specified pattern so that it no longer takes up memory. Note that calling this function is rarely required since memory will be freed when the script shuts down. Parameters
Scripts TradeManagementStrategy, Drawing, Indicator, MultiSymbolTradingStrategy, Pattern, PositionSizing, Signal, TradingStrategy |
Pattern PatternSetSymbol(Pattern pattern, int symbolIndex) |
|||||||||
Creates a copy of a specified OnInitialize pattern parameter while assigning the copy an underlying symbol. Note that this is required since the OnInitialize pattern parameter in a Multi-Symbol Trading Strategy doesn't have an underlying symbol assigned to it by default. Returns The pattern of the new pattern copy. Parameters
Scripts MultiSymbolTradingStrategy |
int PatternSymbolIndex(Pattern pattern) |
||||||
Gets the underlying symbol index of a specified pattern. Returns The underlying symbol index of the specified pattern. Parameters
Scripts TradeManagementStrategy, Drawing, Indicator, MultiSymbolTradingStrategy, Pattern, PositionSizing, Signal, TradingStrategy |
int PatternValueCount() |
||||||
Gets the number of bars processed so far by the pattern. Returns The number of bars processed so far by the pattern. Parameters
Scripts Pattern |