UTBotLibrary   "UTBot" 
is a powerful and flexible trading toolkit implemented in Pine Script. Based on the widely recognized UT Bot strategy originally developed by Yo_adriiiiaan with important enhancements by HPotter, this library provides users with customizable functions for dynamic trailing stop calculations using ATR (Average True Range), trend detection, and signal generation. It enables developers and traders to seamlessly integrate UT Bot logic into their own indicators and strategies without duplicating code.
Key features include:
 
 Accurate ATR-based trailing stop and reversal detection
 Multi-timeframe support for enhanced signal reliability
 Clean and efficient API for easy integration and customization
 Detailed documentation and examples for quick adoption
 Open-source and community-friendly, encouraging collaboration and improvements
 
 We sincerely thank Yo_adriiiiaan for the original UT Bot concept and HPotter for valuable improvements that have made this strategy even more robust. This library aims to honor their work by making the UT Bot methodology accessible to Pine Script developers worldwide.
 This library is designed for Pine Script programmers looking to leverage the proven UT Bot methodology to build robust trading systems with minimal effort and maximum maintainability.
 UTBot(h, l, c, multi, leng) 
  Parameters:
     h (float) - high 
     l (float) - low 
     c (float)-close  
     multi (float)- multi for ATR  
     leng (int)-length for ATR 
  Returns:
     xATRTS - ATR Based TrailingStop Value
     pos - pos==1, long position, pos==-1, shot position
     signal - 0 no signal, 1 buy, -1 sell
Strategies
AlertSenderLibrary_TradingFinderLibrary   "AlertSenderLibrary_TradingFinder" 
TODO: add library description here
 AlertSender(Condition, Alert, AlertName, AlertType, DetectionType, SetupData, Frequncy, UTC, MoreInfo, Message, o, h, l, c, Entry, TP, SL, Distal, Proximal) 
  Parameters:
     Condition (bool) 
     Alert (string) 
     AlertName (string) 
     AlertType (string) 
     DetectionType (string) 
     SetupData (string) 
     Frequncy (string) 
     UTC (string) 
     MoreInfo (string) 
     Message (string) 
     o (float) 
     h (float) 
     l (float) 
     c (float) 
     Entry (float) 
     TP (float) 
     SL (float) 
     Distal (float) 
     Proximal (float)
ApicodeLibrary   "Apicode" 
 percentToTicks(percent, from) 
  Converts a percentage of the average entry price or a specified price to ticks when the
strategy has an open position.
  Parameters:
     percent (float) : (series int/float) The percentage of the `from` price to express in ticks, e.g.,
a value of 50 represents 50% (half) of the price.
     from (float) : (series int/float) Optional. The price from which to calculate a percentage and convert
to ticks. The default is `strategy.position_avg_price`.
  Returns: (float) The number of ticks within the specified percentage of the `from` price if
the strategy has an open position. Otherwise, it returns `na`.
 percentToPrice(percent, from) 
  Calculates the price value that is a specific percentage distance away from the average
entry price or a specified price when the strategy has an open position.
  Parameters:
     percent (float) : (series int/float) The percentage of the `from` price to use as the distance. If the value
is positive, the calculated price is above the `from` price. If negative, the result is
below the `from` price. For example, a value of 10 calculates the price 10% higher than
the `from` price.
     from (float) : (series int/float) Optional. The price from which to calculate a percentage distance.
The default is `strategy.position_avg_price`.
  Returns: (float) The price value at the specified `percentage` distance away from the `from` price
if the strategy has an open position. Otherwise, it returns `na`.
 percentToCurrency(price, percent) 
  Parameters:
     price (float) : (series int/float) The price from which to calculate the percentage.
     percent (float) : (series int/float) The percentage of the `price` to calculate.
  Returns: (float) The amount of the symbol's currency represented by the percentage of the specified
`price`.
 percentProfit(exitPrice) 
  Calculates the expected profit/loss of the open position if it were to close at the
specified `exitPrice`, expressed as a percentage of the average entry price.
NOTE: This function may not return precise values for positions with multiple open trades
because it only uses the average entry price.
  Parameters:
     exitPrice (float) : (series int/float) The position's hypothetical closing price.
  Returns: (float) The expected profit percentage from exiting the position at the `exitPrice`. If
there is no open position, it returns `na`.
 priceToTicks(price) 
  Converts a price value to ticks.
  Parameters:
     price (float) : (series int/float) The price to convert.
  Returns: (float) The value of the `price`, expressed in ticks.
 ticksToPrice(ticks, from) 
  Calculates the price value at the specified number of ticks away from the average entry
price or a specified price when the strategy has an open position.
  Parameters:
     ticks (float) : (series int/float) The number of ticks away from the `from` price. If the value is positive,
the calculated price is above the `from` price. If negative, the result is below the `from`
price.
     from (float) : (series int/float) Optional. The price to evaluate the tick distance from. The default is
`strategy.position_avg_price`.
  Returns: (float) The price value at the specified number of ticks away from the `from` price if
the strategy has an open position. Otherwise, it returns `na`.
 ticksToCurrency(ticks) 
  Converts a specified number of ticks to an amount of the symbol's currency.
  Parameters:
     ticks (float) : (series int/float) The number of ticks to convert.
  Returns: (float) The amount of the symbol's currency represented by the tick distance.
 ticksToStopLevel(ticks) 
  Calculates a stop-loss level using a specified tick distance from the position's average
entry price. A script can plot the returned value and use it as the `stop` argument in a
`strategy.exit()` call.
  Parameters:
     ticks (float) : (series int/float) The number of ticks from the position's average entry price to the
stop-loss level. If the position is long, the value represents the number of ticks *below*
the average entry price. If short, it represents the number of ticks *above* the price.
  Returns: (float) The calculated stop-loss value for the open position. If there is no open position,
it returns `na`.
 ticksToTpLevel(ticks) 
  Calculates a take-profit level using a specified tick distance from the position's average
entry price. A script can plot the returned value and use it as the `limit` argument in a
`strategy.exit()` call.
  Parameters:
     ticks (float) : (series int/float) The number of ticks from the position's average entry price to the
take-profit level. If the position is long, the value represents the number of ticks *above*
the average entry price. If short, it represents the number of ticks *below* the price.
  Returns: (float) The calculated take-profit value for the open position. If there is no open
position, it returns `na`.
 calcPositionSizeByStopLossTicks(stopLossTicks, riskPercent) 
  Calculates the entry quantity required to risk a specified percentage of the strategy's
current equity at a tick-based stop-loss level.
  Parameters:
     stopLossTicks (float) : (series int/float) The number of ticks in the stop-loss distance.
     riskPercent (float) : (series int/float) The percentage of the strategy's equity to risk if a trade moves
`stopLossTicks` away from the entry price in the unfavorable direction.
  Returns: (int) The number of contracts/shares/lots/units to use as the entry quantity to risk the
specified percentage of equity at the stop-loss level.
 calcPositionSizeByStopLossPercent(stopLossPercent, riskPercent, entryPrice) 
  Calculates the entry quantity required to risk a specified percentage of the strategy's
current equity at a percent-based stop-loss level.
  Parameters:
     stopLossPercent (float) : (series int/float) The percentage of the `entryPrice` to use as the stop-loss distance.
     riskPercent (float) : (series int/float) The percentage of the strategy's equity to risk if a trade moves
`stopLossPercent` of the `entryPrice` in the unfavorable direction.
     entryPrice (float) : (series int/float) Optional. The entry price to use in the calculation. The default is
`close`.
  Returns: (int) The number of contracts/shares/lots/units to use as the entry quantity to risk the
specified percentage of equity at the stop-loss level.
 exitPercent(id, lossPercent, profitPercent, qty, qtyPercent, comment, alertMessage) 
  A wrapper for the `strategy.exit()` function designed for creating stop-loss and
take-profit orders at percentage distances away from the position's average entry price.
NOTE: This function calls `strategy.exit()` without a `from_entry` ID, so it creates exit
orders for *every* entry in an open position until the position closes. Therefore, using
this function when the strategy has a pyramiding value greater than 1 can lead to
unexpected results. See the "Exits for multiple entries" section of our User Manual's
"Strategies" page to learn more about this behavior.
  Parameters:
     id (string) : (series string) Optional. The identifier of the stop-loss/take-profit orders, which
corresponds to an exit ID in the strategy's trades after an order fills. The default is
`"Exit"`.
     lossPercent (float) : (series int/float) The percentage of the position's average entry price to use as the
stop-loss distance. The function does not create a stop-loss order if the value is `na`.
     profitPercent (float) : (series int/float) The percentage of the position's average entry price to use as the
take-profit distance. The function does not create a take-profit order if the value is `na`.
     qty (float) : (series int/float) Optional. The number of contracts/lots/shares/units to close when an
exit order fills. If specified, the call uses this value instead of `qtyPercent` to
determine the order size. The exit orders reserve this quantity from the position, meaning
other orders from `strategy.exit()` cannot close this portion until the strategy fills or
cancels those orders. The default is `na`, which means the order size depends on the
`qtyPercent` value.
     qtyPercent (float) : (series int/float) Optional. A value between 0 and 100 representing the percentage of the
open trade quantity to close when an exit order fills. The exit orders reserve this
percentage from the open trades, meaning other calls to this command cannot close this
portion until the strategy fills or cancels those orders. The percentage calculation
depends on the total size of the applicable open trades without considering the reserved
amount from other `strategy.exit()` calls. The call ignores this parameter if the `qty`
value is not `na`. The default is 100.
     comment (string) : (series string) Optional. Additional notes on the filled order. If the value is specified
and not an empty "string", the Strategy Tester and the chart show this text for the order
instead of the specified `id`. The default is `na`.
     alertMessage (string) : (series string) Optional. Custom text for the alert that fires when an order fills. If the
value is specified and not an empty "string", and the "Message" field of the "Create Alert"
dialog box contains the `{{strategy.order.alert_message}}` placeholder, the alert message
replaces the placeholder with this text. The default is `na`.
  Returns: (void) The function does not return a usable value.
 closeAllAtEndOfSession(comment, alertMessage) 
  A wrapper for the `strategy.close_all()` function designed to close all open trades with a
market order when the last bar in the current day's session closes. It uses the command's
`immediately` parameter to exit all trades at the last bar's `close` instead of the `open`
of the next session's first bar.
  Parameters:
     comment (string) : (series string) Optional. Additional notes on the filled order. If the value is specified
and not an empty "string", the Strategy Tester and the chart show this text for the order
instead of the automatically generated exit identifier. The default is `na`.
     alertMessage (string) : (series string) Optional. Custom text for the alert that fires when an order fills. If the
value is specified and not an empty "string", and the "Message" field of the "Create Alert"
dialog box contains the `{{strategy.order.alert_message}}` placeholder, the alert message
replaces the placeholder with this text. The default is `na`.
  Returns: (void) The function does not return a usable value.
 closeAtEndOfSession(entryId, comment, alertMessage) 
  A wrapper for the `strategy.close()` function designed to close specific open trades with a
market order when the last bar in the current day's session closes. It uses the command's
`immediately` parameter to exit the trades at the last bar's `close` instead of the `open`
of the next session's first bar.
  Parameters:
     entryId (string) 
     comment (string) : (series string) Optional. Additional notes on the filled order. If the value is specified
and not an empty "string", the Strategy Tester and the chart show this text for the order
instead of the automatically generated exit identifier. The default is `na`.
     alertMessage (string) : (series string) Optional. Custom text for the alert that fires when an order fills. If the
value is specified and not an empty "string", and the "Message" field of the "Create Alert"
dialog box contains the `{{strategy.order.alert_message}}` placeholder, the alert message
replaces the placeholder with this text. The default is `na`.
  Returns: (void) The function does not return a usable value.
 sortinoRatio(interestRate, forceCalc) 
  Calculates the Sortino ratio of the strategy based on realized monthly returns.
  Parameters:
     interestRate (simple float) : (simple int/float) Optional. The *annual* "risk-free" return percentage to compare against
strategy returns. The default is 2, meaning it uses an annual benchmark of 2%.
     forceCalc (bool) : (series bool) Optional. A value of `true` forces the function to calculate the ratio on the
current bar. If the value is `false`, the function calculates the ratio only on the latest
available bar for efficiency. The default is `false`.
  Returns: (float) The Sortino ratio, which estimates the strategy's excess return per unit of
downside volatility.
 sharpeRatio(interestRate, forceCalc) 
  Calculates the Sharpe ratio of the strategy based on realized monthly returns.
  Parameters:
     interestRate (simple float) : (simple int/float) Optional. The *annual* "risk-free" return percentage to compare against
strategy returns. The default is 2, meaning it uses an annual benchmark of 2%.
     forceCalc (bool) : (series bool) Optional. A value of `true` forces the function to calculate the ratio on the
current bar. If the value is `false`, the function calculates the ratio only on the latest
available bar for efficiency. The default is `false`.
  Returns: (float) The Sortino ratio, which estimates the strategy's excess return per unit of
total volatility.
WCWebLibLibrary   "WCWebLib" 
 method buildWebhookJson(msg, constants) 
  Builds the final JSON payload from a webhookMessage type.
  Namespace types: webhookMessage
  Parameters:
     msg (webhookMessage) : (webhookMessage) A prepared webhookMessage.
     constants (CONSTANTS) 
  Returns:  A JSON Payload.
 method buildTakeProfitJson(msg) 
  Builds the takeProfit JSON message to be used in a webhook message.
  Namespace types: takeProfitMessage
  Parameters:
     msg (takeProfitMessage) 
 method buildStopLossJson(msg, constants) 
  Builds the stopLoss JSON message to be used in a webhook message.
  Namespace types: stopLossMessage
  Parameters:
     msg (stopLossMessage) 
     constants (CONSTANTS) 
 CONSTANTS 
  Constants for payload values.
  Fields:
     ACTION_BUY (series string) 
     ACTION_SELL (series string) 
     ACTION_EXIT (series string) 
     ACTION_CANCEL (series string) 
     ACTION_ADD (series string) 
     SENTIMENT_BULLISH (series string) 
     SENTIMENT_BEARISH (series string) 
     SENTIMENT_LONG (series string) 
     SENTIMENT_SHORT (series string) 
     SENTIMENT_FLAT (series string) 
     STOP_LOSS_TYPE_STOP (series string) 
     STOP_LOSS_TYPE_STOP_LIMIT (series string) 
     STOP_LOSS_TYPE_TRAILING_STOP (series string) 
     EXTENDEDHOURS (series bool) 
     ORDER_TYPE_LIMIT (series string) 
     ORDER_TYPE_MARKET (series string) 
     TIF_DAY (series string) 
 webhookMessage 
  Final webhook message.
  Fields:
     ticker (series string) 
     action (series string) 
     sentiment (series string) 
     price (series float) 
     quantity (series int) 
     takeProfit (series string) 
     stopLoss (series string) 
     extendedHours (series bool) 
     type (series string) 
     timeInForce (series string) 
 takeProfitMessage 
  Take profit message.
  Fields:
     limitPrice (series float) 
     percent (series float) 
     amount (series float) 
 stopLossMessage 
  Stop loss message.
  Fields:
     type (series string) 
     percent (series float) 
     amount (series float) 
     stopPrice (series float) 
     limitPrice (series float) 
     trailPrice (series float) 
     trailPercent (series float)
RifleShooterLibLibrary   "RifleShooterLib" 
Provides a collection of helper functions in support of the Rifle Shooter Indicators.
Functions support the key components of the Rifle Trade algorithm including
* measuring momentum
* identifying paraboloic price action (to disable the algorthim during such time)
* determine the lookback criteria of X point movement in last N minutes
* processing and navigating between the 23/43/73 levels
* maintaining a status table of algorithm progress
 toStrRnd(val, digits) 
  Parameters:
     val (float) 
     digits (int) 
 _isValidTimeRange(startTimeInput, endTimeInput) 
  Parameters:
     startTimeInput (string) 
     endTimeInput (string) 
 _normalize(_src, _min, _max) 
  _normalize Normalizes series with unknown min/max using historical min/max.
  Parameters:
     _src (float) : Source series to normalize
     _min (float) : minimum value of the rescaled series
     _max (float) : maximum value of the rescaled series
  Returns: The series scaled with values between min and max
 arrayToSeries(arrayInput) 
  arrayToSeries Return an array from the provided series.
  Parameters:
     arrayInput (array) : Source array to convert to a series
  Returns: The array as a series datatype
 f_parabolicFiltering(_activeCount, long, shooterRsi, shooterRsiLongThreshold, shooterRsiShortThreshold, fiveMinuteRsi, fiveMinRsiLongThreshold, fiveMinRsiShortThreshold, shooterRsiRoc, shooterRsiRocLongThreshold, shooterRsiRocShortThreshold, quickChangeLookbackBars, quckChangeThreshold, curBarChangeThreshold, changeFromPrevBarThreshold, maxBarsToholdParabolicMoveActive, generateLabels) 
  f_parabolicFiltering Return true when price action indicates a parabolic active movement based on the provided inputs and thresholds.
  Parameters:
     _activeCount (int) 
     long (bool) 
     shooterRsi (float) 
     shooterRsiLongThreshold (float) 
     shooterRsiShortThreshold (float) 
     fiveMinuteRsi (float) 
     fiveMinRsiLongThreshold (float) 
     fiveMinRsiShortThreshold (float) 
     shooterRsiRoc (float) 
     shooterRsiRocLongThreshold (float) 
     shooterRsiRocShortThreshold (float) 
     quickChangeLookbackBars (int) 
     quckChangeThreshold (int) 
     curBarChangeThreshold (int) 
     changeFromPrevBarThreshold (int) 
     maxBarsToholdParabolicMoveActive (int) 
     generateLabels (bool) 
 rsiValid(rsi, buyThreshold, sellThreshold) 
  rsiValid Returns true if the provided RSI value is withing the associated threshold. For the unused threshold set it to na
  Parameters:
     rsi (float) 
     buyThreshold (float) 
     sellThreshold (float) 
 squezeBands(source, length) 
  squezeBands Returns the squeeze bands momentum color of current source series input
  Parameters:
     source (float) 
     length (int) 
 f_momentumOscilator(source, length, transperency) 
  f_momentumOscilator Returns the squeeze pro momentum value and bar color states of the series input
  Parameters:
     source (float) 
     length (int) 
     transperency (int) 
 f_getLookbackExtreme(lowSeries, highSeries, lbBars, long) 
  f_getLookbackExtreme Return the highest high or lowest low over the look back window
  Parameters:
     lowSeries (float) 
     highSeries (float) 
     lbBars (int) 
     long (bool) 
 f_getInitialMoveTarget(lbExtreme, priveMoveOffset, long) 
  f_getInitialMoveTarget Return the point delta required to achieve an initial rifle move (X points over Y lookback)
  Parameters:
     lbExtreme (float) 
     priveMoveOffset (int) 
     long (bool) 
 isSymbolSupported(sym) 
  isSymbolSupported Return true if provided symbol is one of the supported DOW Rifle Indicator symbols
  Parameters:
     sym (string) 
 getBasePrice(price) 
  getBasePrice Returns integer portion of provided float
  Parameters:
     price (float) 
 getLastTwoDigitsOfPrice(price) 
  getBasePrice Returns last two integer numerals of provided float value
  Parameters:
     price (float) 
 getNextLevelDown(price, lowestLevel, middleLevel, highestLevel) 
  getNextLevelDown Returns the next level above the provided price value
  Parameters:
     price (float) 
     lowestLevel (float) 
     middleLevel (float) 
     highestLevel (float) 
 getNextLevelUp(price, lowestLevel, middleLevel, highestLevel) 
  getNextLevelUp Returns the next level below the provided price value
  Parameters:
     price (float) 
     lowestLevel (float) 
     middleLevel (float) 
     highestLevel (float) 
 isALevel(price, lowestLevel, middleLevel, highestLevel) 
  isALevel Returns true if the provided price is onve of the specified levels
  Parameters:
     price (float) 
     lowestLevel (float) 
     middleLevel (float) 
     highestLevel (float) 
 getClosestLevel(price, lowestLevel, middleLevel, highestLevel) 
  getClosestLevel Returns the level closest to the price value provided
  Parameters:
     price (float) 
     lowestLevel (float) 
     middleLevel (float) 
     highestLevel (float) 
 f_fillSetupTableCell(_table, _col, _row, _text, _bgcolor, _txtcolor, _text_size) 
  f_fillSetupTableCell Helper function to fill a setup table celll
  Parameters:
     _table (table) 
     _col (int) 
     _row (int) 
     _text (string) 
     _bgcolor (color) 
     _txtcolor (color) 
     _text_size (string) 
 f_fillSetupTableRow(_table, _row, _col0Str, _col1Str, _col2Str, _bgcolor, _textColor, _textSize) 
  f_fillSetupTableRow Helper function to fill a setup table row
  Parameters:
     _table (table) 
     _row (int) 
     _col0Str (string) 
     _col1Str (string) 
     _col2Str (string) 
     _bgcolor (color) 
     _textColor (color) 
     _textSize (string) 
 f_addBlankRow(_table, _row) 
  f_addBlankRow Helper function to fill a setup table row with empty values
  Parameters:
     _table (table) 
     _row (int) 
 f_updateVersionTable(versionTable, versionStr, versionDateStr) 
  f_updateVersionTable Helper function to fill the version table with provided values
  Parameters:
     versionTable (table) 
     versionStr (string) 
     versionDateStr (string) 
 f_updateSetupTable(_table, parabolicMoveActive, initialMoveTargetOffset, initialMoveAchieved, shooterRsi, shooterRsiValid, rsiRocEnterThreshold, shooterRsiRoc, fiveMinuteRsi, fiveMinuteRsiValid, requireValid5MinuteRsiForEntry, stallLevelOffset, stallLevelExceeded, stallTargetOffset, recoverStallLevelValid, curBarChangeValid, volumeRoc, volumeRocThreshold, enableVolumeRocForTrigger, tradeActive, entryPrice, curCloseOffset, curSymCashDelta, djiCashDelta, showDjiDelta, longIndicator, fontSize) 
  f_updateSetupTable Manages writing current data to the setup table
  Parameters:
     _table (table) 
     parabolicMoveActive (bool) 
     initialMoveTargetOffset (float) 
     initialMoveAchieved (bool) 
     shooterRsi (float) 
     shooterRsiValid (bool) 
     rsiRocEnterThreshold (float) 
     shooterRsiRoc (float) 
     fiveMinuteRsi (float) 
     fiveMinuteRsiValid (bool) 
     requireValid5MinuteRsiForEntry (bool) 
     stallLevelOffset (float) 
     stallLevelExceeded (bool) 
     stallTargetOffset (float) 
     recoverStallLevelValid (bool) 
     curBarChangeValid (bool) 
     volumeRoc (float) 
     volumeRocThreshold (float) 
     enableVolumeRocForTrigger (bool) 
     tradeActive (bool) 
     entryPrice (float) 
     curCloseOffset (float) 
     curSymCashDelta (float) 
     djiCashDelta (float) 
     showDjiDelta (bool) 
     longIndicator (bool) 
     fontSize (string)
BackTestLibLibrary   "BackTestLib" 
Allows backtesting indicator performance. Tracks typical metrics such as won/loss, profit factor, draw down, etc. Trading View strategy library provides similar (and more comprehensive)
functionality but only works with strategies. This libary was created to address performance tracking within indicators.
Two primary outputs are generated:
1. Summary Table: Displays overall performance metrics for the indicator over the chart's loaded timeframe and history
2. Details Table: Displays a table of individual trade entries and exits. This table can grow larger than the available chart space. It does have a max number of rows supported. I haven't
found a way to add scroll bars or scroll bar equivalents yet.
 f_init(data, _defaultStopLoss, _defaultTakeProfit, _useTrailingStop, _useTraingStopToBreakEven, _trailingStopActivation, _trailingStopOffset) 
  f_init Initialize the backtest data type. Called prior to using the backtester functions
  Parameters:
     data (backtesterData) : backtesterData to initialize
     _defaultStopLoss (float) : Default trade stop loss to apply
     _defaultTakeProfit (float) : Default trade take profit to apply
     _useTrailingStop (bool) : Trailing stop enabled
     _useTraingStopToBreakEven (bool) : When trailing stop active, trailing stop will increase no further than the entry price
     _trailingStopActivation (int) : When trailing stop active, trailing will begin once price exceeds base stop loss by this number of points
     _trailingStopOffset (int) : When trailing stop active, it will trail the max price achieved by this number of points
  Returns: Initialized data set
 f_buildResultStr(_resultType, _price, _resultPoints, _numWins, _pointsWon, _numLoss, _pointsLost) 
  f_buildResultStr Helper function to construct a string of resutling data for exit tooltip labels
  Parameters:
     _resultType (string) 
     _price (float) 
     _resultPoints (float) 
     _numWins (int) 
     _pointsWon (float) 
     _numLoss (int) 
     _pointsLost (float) 
 f_buildResultLabel(data, labelVertical, labelOffset, long) 
  f_buildResultLabel Helper function to construct an Exit label for display on the chart
  Parameters:
     data (backtesterData) 
     labelVertical (bool) 
     labelOffset (int) 
     long (bool) 
 f_updateTrailingStop(_entryPrice, _curPrice, _sl, _tp, trailingStopActivationInput, trailingStopOffsetInput, useTrailingStopToBreakEven) 
  f_updateTrailingStop Helper function to advance the trailing stop as price action dictates
  Parameters:
     _entryPrice (float) 
     _curPrice (float) 
     _sl (float) 
     _tp (float) 
     trailingStopActivationInput (float) 
     trailingStopOffsetInput (float) 
     useTrailingStopToBreakEven (bool) 
  Returns: Updated stop loss for current price action
 f_enterShort(data, entryPrice, fixedStopLoss) 
  f_enterShort Helper function to enter a short and collect data necessary for tracking the trade entry
  Parameters:
     data (backtesterData) 
     entryPrice (float) 
     fixedStopLoss (float) 
  Returns: Updated backtest data
 f_enterLong(data, entryPrice, fixedStopLoss) 
  f_enterLong Helper function to enter a long and collect data necessary for tracking the trade entry
  Parameters:
     data (backtesterData) 
     entryPrice (float) 
     fixedStopLoss (float) 
  Returns: Updated backtest data
 f_exitTrade(data) 
  f_enterLong Helper function to exit a trade and update/reset tracking data
  Parameters:
     data (backtesterData) 
  Returns: Updated backtest data
 f_checkTradeConditionForExit(data, condition, curPrice, enableRealTime) 
  f_checkTradeConditionForExit Helper function to determine if provided condition indicates an exit
  Parameters:
     data (backtesterData) 
     condition (bool) : When true trade will exit
     curPrice (float) 
     enableRealTime (bool) : When true trade will evaluate if barstate is relatime or barstate is confirmed; otherwise just checks on is confirmed
  Returns: Updated backtest data
 f_checkTrade(data, curPrice, curLow, curHigh, enableRealTime) 
  f_checkTrade Helper function to determine if current price action dictates stop loss or take profit exit
  Parameters:
     data (backtesterData) 
     curPrice (float) 
     curLow (float) 
     curHigh (float) 
     enableRealTime (bool) : When true trade will evaluate if barstate is relatime or barstate is confirmed; otherwise just checks on is confirmed
  Returns: Updated backtest data
 f_fillCell(_table, _column, _row, _title, _value, _bgcolor, _txtcolor, _text_size) 
  f_fillCell Helper function to construct result table cells
  Parameters:
     _table (table) 
     _column (int) 
     _row (int) 
     _title (string) 
     _value (string) 
     _bgcolor (color) 
     _txtcolor (color) 
     _text_size (string) 
  Returns: Table cell
 f_prepareStatsTable(data, drawTesterSummary, drawTesterDetails, summaryTableTextSize, detailsTableTextSize, displayRowZero, summaryTableLocation, detailsTableLocation) 
  f_fillCell Helper function to populate result table
  Parameters:
     data (backtesterData) 
     drawTesterSummary (bool) 
     drawTesterDetails (bool) 
     summaryTableTextSize (string) 
     detailsTableTextSize (string) 
     displayRowZero (bool) 
     summaryTableLocation (string) 
     detailsTableLocation (string) 
  Returns: Updated backtest data
 backtesterData 
  backtesterData - container for backtest performance metrics
  Fields:
     tradesArray (array) : Array of strings with entries for each individual trade and its results
     pointsBalance (series float) : Running sum of backtest points won/loss results
     drawDown (series float) : Running sum of backtest total draw down points
     maxDrawDown (series float) : Running sum of backtest total draw down points
     maxRunup (series float) : Running sum of max points won over the backtest
     numWins (series int) : Number of wins of current backtes set
     numLoss (series int) : Number of losses of current backtes set
     pointsWon (series float) : Running sum of points won to date
     pointsLost (series float) : Running sum of points lost to date
     entrySide (series string) : Current entry long/short
     tradeActive (series bool) : Indicates if a trade is currently active
     tradeComplete (series bool) : Indicates if a trade just exited (due to stop loss or take profit)
     entryPrice (series float) : Current trade entry price
     entryTime (series int) : Current trade entry time
     sl (series float) : Current trade stop loss
     tp (series float) : Current trade take profit
     defaultStopLoss (series float) : Default trade stop loss to apply
     defaultTakeProfit (series float) : Default trade take profit to apply
     useTrailingStop (series bool) : Trailing stop enabled
     useTrailingStopToBreakEven (series bool) : When trailing stop active, trailing stop will increase no further than the entry price
     trailingStopActivation (series int) : When trailing stop active, trailing will begin once price exceeds base stop loss by this number of points
     trailingStopOffset (series int) : When trailing stop active, it will trail the max price achieved by this number of points
     resultType (series string) : Current trade won/lost
     exitPrice (series float) : Current trade exit price
     resultPoints (series float) : Current trade points won/lost
     summaryTable (series table) : Table to deisplay summary info
     tradesTable (series table) : Table to display per trade info
TradersPostDeluxeLibrary   "TradersPostDeluxe" 
TradersPost integration. It's currently not very deluxe
 SendEntryAlert(ticker, action, quantity, orderType, takeProfit, stopLoss, id, price, timestamp, timezone) 
  Sends an alert to TradersPost to trigger an Entry
  Parameters:
     ticker (string) : Symbol to trade. Default is syminfo.ticker
     action (series Action) : TradersPostAction (.buy, .sell) default = buy
     quantity (float) : Amount to trade, default = 1
     orderType (series OrderType) : TradersPostOrderType, default =e TradersPostOrderType.market
     takeProfit (float) : Take profit limit price
     stopLoss (float) : Stop loss price
     id (string) : id for the trade
     price (float) : Expected price
     timestamp (int) : Time of the trade for reporting, defaults to timenow
     timezone (string) : associated with the time, defaults to syminfo.timezone
  Returns: Nothing
 SendExitAlert(ticker, price, timestamp, timezone) 
  Sends an alert to TradersPost to trigger an Exit
  Parameters:
     ticker (string) : Symbol to flatten
     price (float) : Documented planned price
     timestamp (int) : Time of the trade for reporting, defaults to timenow
     timezone (string) : associated with the time, defaults to syminfo.timezone
  Returns: Nothing
WeightedVolumeUtilsLibrary   "WeightedVolumeUtils" 
 fun(x) 
  Returns the input value (placeholder function).
  Parameters:
     x (float) : A float value.
  Returns: The same float value passed as input.
 weightedBSEVolume() 
  Calculates the weighted volume for BSE index based on top constituent stocks.
  Returns: Weighted volume value based on fixed weights for BSE SENSEX stocks.
 getAdjustedVolume() 
  Returns the adjusted volume for SENSEX or regular volume otherwise.
  Returns: Weighted BSE volume if current symbol is SENSEX, else raw volume.
StrategyUtilsLibrary   "StrategyUtils" 
 getHeikinAshi(open, high, low, close) 
  getHeikinAshi
  Parameters:
     open (float) : float: Raw open price
     high (float) : float: Raw high price
     low (float) : float: Raw low price
     close (float) : float: Raw close price
  Returns: tuple of haOpen, haClose, haHigh, haLow
 getFibExtensions(high, low) 
  getFibExtensions
  Parameters:
     high (float) : float: Highest point before trade
     low (float) : float: Lowest point before trade
  Returns: tuple of extension levels
 inBacktestWindow(time, start, end) 
  inBacktestWindow
  Parameters:
     time (int) : int: Current bar time
     start (int) : int: Start timestamp
     end (int) : int: End timestamp
  Returns: bool: true if within Fbrange
 getCurrentState(buy, sell) 
  getCurrentState
  Parameters:
     buy (bool) : bool: Buy signal condition
     sell (bool) : bool: Sell signal condition
  Returns: string: "Buy", "Sell", or "None"
 formatPrice(price) 
  formatPrice
  Parameters:
     price (float) : float: Input price value
  Returns: string: Formatted price string
 getColorByProfit(netprofit, initial, green, red) 
  getColorByProfit
  Parameters:
     netprofit (float) : float: Strategy net profit
     initial (float) : float: Initial capital
     green (color) : color: Positive color
     red (color) : color: Negative color
  Returns: color: Display color based on PnL
UTSStrategyHelperLibrary   "UTSStrategyHelper" 
TODO: add library description here
 stopLossPrice(sig, atr, factor, isLong) 
  Calculates the stop loss price using a distance determined by ATR multiplied by a factor. Example for Long trade SL: PRICE - (ATR * factor).
  Parameters:
     sig (float) 
     atr (float) : (float): The value of the atr.
     factor (float) 
     isLong (bool) : (bool): The current trade direction.
  Returns: (bool): A boolean value.
 takeProfitPrice(sig, atr, factor, isLong) 
  Calculates the take profit price using a distance determined by ATR multiplied by a factor. Example for Long trade TP: PRICE + (ATR * factor). When take profit price is reached usually 50 % of the position is closed and the other 50 % get a trailing stop assigned.
  Parameters:
     sig (float) 
     atr (float) : (float): The value of the atr.
     factor (float) 
     isLong (bool) : (bool): The current trade direction.
  Returns: (bool): A boolean value.
 trailingStopPrice(initialStopPrice, atr, factor, priceSource, isLong) 
  Calculates a trailing stop price using a distance determined by ATR multiplied by a factor. It takes an initial price and follows the price closely if it changes in a favourable way.
  Parameters:
     initialStopPrice (float) : (float): The initial stop price which, for consistency also should be ATR * factor behind price: e.g. Long trade: PRICE - (ATR * factor)
     atr (float) : (float): The value of the atr. Ideally the ATR value at trade open is taken and used for subsequent calculations.
     factor (float) 
     priceSource (float) : (float): The current price.
     isLong (bool) : (bool): The current trade direction.
  Returns: (bool): A boolean value.
 hasGreaterPositionSize(positionSize) 
  Determines if the strategy's position size has grown since the last bar.
  Parameters:
     positionSize (float) : (float): The size of the position.
  Returns: (bool): A boolean value.
 hasSmallerPositionSize(positionSize) 
  Determines if the strategy's position size has decreased since the last bar.
  Parameters:
     positionSize (float) : (float): The size of the position.
  Returns: (bool): A boolean value.
 hasUnchangedPositionSize(positionSize) 
  Determines if the strategy's position size has changed since the last bar.
  Parameters:
     positionSize (float) : (float): The size of the position.
  Returns: (bool): A boolean value.
 exporthasLongPosition(positionSize) 
  Determines if the strategy has an open long position.
  Parameters:
     positionSize (float) : (float): The size of the position.
  Returns: (bool): A boolean value.
 hasShortPosition(positionSize) 
  Determines if the strategy has an open short position.
  Parameters:
     positionSize (float) : (float): The size of the position.
  Returns: (bool): A boolean value.
 hasAnyPosition(positionSize) 
  Determines if the strategy has any open position, regardless of short or long.
  Parameters:
     positionSize (float) : (float): The size of the position.
  Returns: (bool): A boolean value.
 hasSignal(value) 
  Determines if the given argument contains a valid value (means not 'na').
  Parameters:
     value (float) : (float): The actual value.
  Returns: (bool): A boolean value.
TUF_LOGICTUF_LOGIC: Three-Value Logic for Pine Script v6 
The TUF_LOGIC library implements a robust three-valued logic system (trilean logic) for Pine Script v6, providing a formal framework for reasoning about uncertain or incomplete information in financial markets. By extending beyond binary True/False states to include an explicit "Uncertain" state, this library enables more nuanced algorithmic decision-making, particularly valuable in environments characterized by imperfect information.
 Core Architecture 
TUF_LOGIC offers two complementary interfaces for working with trilean values:
 
   Enum-Based API (Recommended):  Leverages Pine Script v6's enum capabilities with  Trilean.True ,  Trilean.Uncertain , and  Trilean.False  for improved type safety and performance.
   Integer-Based API (Legacy Support):  Maintains compatibility with existing code using integer values 1 (True), 0 (Uncertain), and -1 (False).
 
 Fundamental Operations 
The library provides type conversion methods for seamless interaction between integer representation and enum types ( to_trilean() ,  to_int() ), along with validation functions to maintain trilean invariants.
 Logical Operators 
TUF_LOGIC extends traditional boolean operators to the trilean domain with  NOT ,  AND ,  OR ,  XOR , and  EQUALITY  functions that properly handle the Uncertain state according to the principles of three-valued logic.
The library implements three different implication operators providing flexibility for different logical requirements:  IMP_K  (Kleene's approach),  IMP_L  (Łukasiewicz's approach), and  IMP_RM3  (Relevant implication under RM3 logic).
Inspired by Tarski-Łukasiewicz's modal logic formulations, TUF_LOGIC includes modal operators:  MA  (Modal Assertion) evaluates whether a state is possibly true;  LA  (Logical Assertion) determines if a state is necessarily true; and  IA  (Indeterminacy Assertion) identifies explicitly uncertain states.
The  UNANIMOUS  operator evaluates trilean values for complete agreement, returning the consensus value if one exists or Uncertain otherwise. This function is available for both pairs of values and arrays of trilean values.
 Practical Applications 
TUF_LOGIC excels in financial market scenarios where decision-making must account for uncertainty. It enables technical indicator consensus by combining signals with different confidence levels, supports multi-timeframe analysis by reconciling potentially contradictory signals, enhances risk management by explicitly modeling uncertainty, and handles partial information systems where some data sources may be unreliable.
By providing a mathematically sound framework for reasoning about uncertainty, TUF_LOGIC elevates trading system design beyond simplistic binary logic, allowing for more sophisticated decision-making that better reflects real-world market complexity.
Library   "TUF_LOGIC" 
  Three-Value Logic (TUF: True, Uncertain, False) implementation for Pine Script.
This library provides a comprehensive set of logical operations supporting trilean logic systems,
including Kleene, Łukasiewicz, and RM3 implications. Compatible with Pine v6 enums.
 method validate(self) 
  Ensures a valid trilean integer value by clamping to the appropriate range  .
  Namespace types: series int, simple int, input int, const int
  Parameters:
     self (int) : The integer value to validate.
  Returns: An integer value guaranteed to be within the valid trilean range.
 method to_trilean(self) 
  Converts an integer value to a Trilean enum value.
  Namespace types: series int, simple int, input int, const int
  Parameters:
     self (int) : The integer to convert (typically -1, 0, or 1).
  Returns: A Trilean enum value: True (1), Uncertain (0), or False (-1).
 method to_int(self) 
  Converts a Trilean enum value to its corresponding integer representation.
  Namespace types: series Trilean
  Parameters:
     self (series Trilean) : The Trilean enum value to convert.
  Returns: Integer value: 1 (True), 0 (Uncertain), or -1 (False).
 method NOT(self) 
  Negates a trilean integer value (NOT operation).
  Namespace types: series int, simple int, input int, const int
  Parameters:
     self (int) : The integer value to negate.
  Returns: Negated integer value: 1 -> -1, 0 -> 0, -1 -> 1.
 method NOT(self) 
  Negates a Trilean enum value (NOT operation).
  Namespace types: series Trilean
  Parameters:
     self (series Trilean) : The Trilean enum value to negate.
  Returns: Negated Trilean: True -> False, Uncertain -> Uncertain, False -> True.
 method AND(self, comparator) 
  Logical AND operation for trilean integer values.
  Namespace types: series int, simple int, input int, const int
  Parameters:
     self (int) : The first integer value.
     comparator (int) : The second integer value to compare with.
  Returns: Integer result of the AND operation (minimum value).
 method AND(self, comparator) 
  Logical AND operation for Trilean enum values following three-valued logic.
  Namespace types: series Trilean
  Parameters:
     self (series Trilean) : The first Trilean enum value.
     comparator (series Trilean) : The second Trilean enum value to compare with.
  Returns: Trilean result of the AND operation.
 method OR(self, comparator) 
  Logical OR operation for trilean integer values.
  Namespace types: series int, simple int, input int, const int
  Parameters:
     self (int) : The first integer value.
     comparator (int) : The second integer value to compare with.
  Returns: Integer result of the OR operation (maximum value).
 method OR(self, comparator) 
  Logical OR operation for Trilean enum values following three-valued logic.
  Namespace types: series Trilean
  Parameters:
     self (series Trilean) : The first Trilean enum value.
     comparator (series Trilean) : The second Trilean enum value to compare with.
  Returns: Trilean result of the OR operation.
 method EQUALITY(self, comparator) 
  Logical EQUALITY operation for trilean integer values.
  Namespace types: series int, simple int, input int, const int
  Parameters:
     self (int) : The first integer value.
     comparator (int) : The second integer value to compare with.
  Returns: Integer representation (1/-1) indicating if values are equal.
 method EQUALITY(self, comparator) 
  Logical EQUALITY operation for Trilean enum values.
  Namespace types: series Trilean
  Parameters:
     self (series Trilean) : The first Trilean enum value.
     comparator (series Trilean) : The second Trilean enum value to compare with.
  Returns: Trilean.True if both values are equal, Trilean.False otherwise.
 method XOR(self, comparator) 
  Logical XOR (Exclusive OR) operation for trilean integer values.
  Namespace types: series int, simple int, input int, const int
  Parameters:
     self (int) : The first integer value.
     comparator (int) : The second integer value to compare with.
  Returns: Integer result of the XOR operation.
 method XOR(self, comparator) 
  Logical XOR (Exclusive OR) operation for Trilean enum values.
  Namespace types: series Trilean
  Parameters:
     self (series Trilean) : The first Trilean enum value.
     comparator (series Trilean) : The second Trilean enum value to compare with.
  Returns: Trilean result of the XOR operation.
 method IMP_K(self, comparator) 
  Material implication using Kleene's logic for trilean integer values.
  Namespace types: series int, simple int, input int, const int
  Parameters:
     self (int) : The antecedent integer value.
     comparator (int) : The consequent integer value.
  Returns: Integer result of Kleene's implication operation.
 method IMP_K(self, comparator) 
  Material implication using Kleene's logic for Trilean enum values.
  Namespace types: series Trilean
  Parameters:
     self (series Trilean) : The antecedent Trilean enum value.
     comparator (series Trilean) : The consequent Trilean enum value.
  Returns: Trilean result of Kleene's implication operation.
 method IMP_L(self, comparator) 
  Logical implication using Łukasiewicz's logic for trilean integer values.
  Namespace types: series int, simple int, input int, const int
  Parameters:
     self (int) : The antecedent integer value.
     comparator (int) : The consequent integer value.
  Returns: Integer result of Łukasiewicz's implication operation.
 method IMP_L(self, comparator) 
  Logical implication using Łukasiewicz's logic for Trilean enum values.
  Namespace types: series Trilean
  Parameters:
     self (series Trilean) : The antecedent Trilean enum value.
     comparator (series Trilean) : The consequent Trilean enum value.
  Returns: Trilean result of Łukasiewicz's implication operation.
 method IMP_RM3(self, comparator) 
  Logical implication using RM3 logic for trilean integer values.
  Namespace types: series int, simple int, input int, const int
  Parameters:
     self (int) : The antecedent integer value.
     comparator (int) : The consequent integer value.
  Returns: Integer result of the RM3 implication operation.
 method IMP_RM3(self, comparator) 
  Logical implication using RM3 logic for Trilean enum values.
  Namespace types: series Trilean
  Parameters:
     self (series Trilean) : The antecedent Trilean enum value.
     comparator (series Trilean) : The consequent Trilean enum value.
  Returns: Trilean result of the RM3 implication operation.
 method MA(self) 
  Modal Assertion (MA) operation for trilean integer values.
  Namespace types: series int, simple int, input int, const int
  Parameters:
     self (int) : The integer value to evaluate.
  Returns: 1 if the value is 1 or 0, -1 if the value is -1.
 method MA(self) 
  Modal Assertion (MA) operation for Trilean enum values.
  Namespace types: series Trilean
  Parameters:
     self (series Trilean) : The Trilean enum value to evaluate.
  Returns: Trilean.True if value is True or Uncertain, Trilean.False if value is False.
 method LA(self) 
  Logical Assertion (LA) operation for trilean integer values.
  Namespace types: series int, simple int, input int, const int
  Parameters:
     self (int) : The integer value to evaluate.
  Returns: 1 if the value is 1, -1 otherwise.
 method LA(self) 
  Logical Assertion (LA) operation for Trilean enum values.
  Namespace types: series Trilean
  Parameters:
     self (series Trilean) : The Trilean enum value to evaluate.
  Returns: Trilean.True if value is True, Trilean.False otherwise.
 method IA(self) 
  Indeterminacy Assertion (IA) operation for trilean integer values.
  Namespace types: series int, simple int, input int, const int
  Parameters:
     self (int) : The integer value to evaluate.
  Returns: 1 if the value is 0, -1 otherwise.
 method IA(self) 
  Indeterminacy Assertion (IA) operation for Trilean enum values.
  Namespace types: series Trilean
  Parameters:
     self (series Trilean) : The Trilean enum value to evaluate.
  Returns: Trilean.True if value is Uncertain, Trilean.False otherwise.
 method UNANIMOUS(self, comparator) 
  Evaluates the unanimity between two trilean integer values.
  Namespace types: series int, simple int, input int, const int
  Parameters:
     self (int) : The first integer value.
     comparator (int) : The second integer value.
  Returns: Integer value of self if both values are equal, 0 (Uncertain) otherwise.
 method UNANIMOUS(self, comparator) 
  Evaluates the unanimity between two Trilean enum values.
  Namespace types: series Trilean
  Parameters:
     self (series Trilean) : The first Trilean enum value.
     comparator (series Trilean) : The second Trilean enum value.
  Returns: Value of self if both values are equal, Trilean.Uncertain otherwise.
 method UNANIMOUS(self) 
  Evaluates the unanimity among an array of trilean integer values.
  Namespace types: array
  Parameters:
     self (array) : The array of integer values.
  Returns: First value if all values are identical, 0 (Uncertain) otherwise.
 method UNANIMOUS(self) 
  Evaluates the unanimity among an array of Trilean enum values.
  Namespace types: array
  Parameters:
     self (array) : The array of Trilean enum values.
  Returns: First value if all values are identical, Trilean.Uncertain otherwise.
UtilLibrary   "Util" 
defines commonly used utility functions and constants
 calc_shares(entry_price, stop, fund, riskPerc) 
  Calculate number of shares for a trade
  Parameters:
     entry_price (float) 
     stop (float) : stop loss price
     fund (float) : amount of fund to put in this trade
     riskPerc (float) : percentage of fund to be risked in this trade. Default is 5%
  Returns: number of shares
 trade_exist(trade_id) 
  Returns if a trade with the specific ID is already open
  Parameters:
     trade_id (string) 
  Returns: true/false
 trade 
  Fields:
     id (series string) 
     direction (series TradeDir) 
     entry_price (series float) 
     shares (series float) 
     bars_open (series int)
Cometreon_Public📚 Cometreon Public Library – Advanced Functions for Pine Script 
This library contains advanced functions used in my public indicators on TradingView. The goal is to make the code more modular and efficient, allowing users to call pre-built functions for complex calculations without rewriting them from scratch.
 🔹 Currently Available Functions: 
 1️⃣ Moving Average Function  – Provides multiple types of moving averages to choose from, including:
 
 SMA  (Simple Moving Average)
 EMA  (Exponential Moving Average)
 WMA  (Weighted Moving Average)
 RMA  (Smoothed Moving Average)
 HMA  (Hull Moving Average)
 JMA  (Jurik Moving Average)
 DEMA  (Double Exponential Moving Average)
 TEMA  (Triple Exponential Moving Average)
 LSMA  (Least Squares Moving Average)
 VWMA  (Volume-Weighted Moving Average)
 SMMA  (Smoothed Moving Average)
 KAMA  (Kaufman’s Adaptive Moving Average)
 ALMA  (Arnaud Legoux Moving Average)
 FRAMA  (Fractal Adaptive Moving Average)
 VIDYA  (Variable Index Dynamic Average)
 
 2️⃣ Custom RSI  – Uses the Moving Average function to modify the calculation method, with an additional option for a dynamic version.
 3️⃣ Custom MACD  – Uses the Moving Average function to modify the calculation method, with an additional option for a dynamic version.
 4️⃣ Custom Alligator  – Uses the Moving Average function to modify generic calculations, allowing users to change the calculation method.
CapitalManagementLibrary   "CapitalManagement" 
TODO: Manage the capital
 order_volume(percent_risk, order_entry_price, stop_loss_price) 
  : Function to calculate order volume according to give risk percent_risk
  Parameters:
     percent_risk (float) 
     order_entry_price (float) 
     stop_loss_price (float) 
 calculate_takeprofit_price(entry_price, stop_loss_price, risk_reward) 
  : Function to calculate take profit price according to given risk:reward ratio
  Parameters:
     entry_price (float) 
     stop_loss_price (float) 
     risk_reward (float) 
  Returns: Return take profit value according to given risk:reward ratio
capital_managementLibrary   "capital_management" 
TODO: add library description here
 Volume_calculation(precent_risk, order_entry_price, stop_loss_price) 
  TODO: Volume calculation function by placing orders with fiven % risk
  Parameters:
     precent_risk (float) 
     order_entry_price (float) 
     stop_loss_price (float) 
  Returns: stop_loss_price: Price that place stop loss order
KalmanfilterLibrary   "Kalmanfilter" 
A sophisticated Kalman Filter implementation for financial time series analysis
@author Rocky-Studio
@version 1.0
 initialize(initial_value, process_noise, measurement_noise) 
  Initializes Kalman Filter parameters
  Parameters:
     initial_value (float) : (float) The initial state estimate
     process_noise (float) : (float) The process noise coefficient (Q)
     measurement_noise (float) : (float) The measurement noise coefficient (R)
  Returns:   A tuple containing  
 update(prev_state, prev_covariance, measurement, process_noise, measurement_noise) 
  Update Kalman Filter state
  Parameters:
     prev_state (float) 
     prev_covariance (float) 
     measurement (float) 
     process_noise (float) 
     measurement_noise (float) 
 calculate_measurement_noise(price_series, length) 
  Adaptive measurement noise calculation
  Parameters:
     price_series (array) 
     length (int) 
 calculate_measurement_noise_simple(price_series) 
  Parameters:
     price_series (array) 
 update_trading(prev_state, prev_velocity, prev_covariance, measurement, volatility_window) 
  Enhanced trading update with velocity
  Parameters:
     prev_state (float) 
     prev_velocity (float) 
     prev_covariance (float) 
     measurement (float) 
     volatility_window (int) 
 model4_update(prev_mean, prev_speed, prev_covariance, price, process_noise, measurement_noise) 
  Kalman Filter Model 4 implementation (Benhamou 2018)
  Parameters:
     prev_mean (float) 
     prev_speed (float) 
     prev_covariance (array) 
     price (float) 
     process_noise (array) 
     measurement_noise (float) 
 model4_initialize(initial_price) 
  Initialize Model 4 parameters
  Parameters:
     initial_price (float) 
 model4_default_process_noise() 
  Create default process noise matrix for Model 4
 model4_calculate_measurement_noise(price_series, length) 
  Adaptive measurement noise calculation for Model 4
  Parameters:
     price_series (array) 
     length (int)
lib_statemachine_modifiedLibrary   "lib_statemachine_modified" 
Modified to fix bugs and create getState and priorState methods.
 method step(this, before, after, condition) 
  Namespace types: StateMachine
  Parameters:
     this (StateMachine) 
     before (int) : (int): Current state before transition
     after (int) : (int): State to transition to
     condition (bool) : (bool): Condition to trigger the transition
  Returns: (bool): True if the state changed, else False
 method step(this, after, condition) 
  Namespace types: StateMachine
  Parameters:
     this (StateMachine) 
     after (int) : (int): State to transition to
     condition (bool) : (bool): Condition to trigger the transition
  Returns: (bool): True if the state changed, else False
 method currentState(this) 
  Namespace types: StateMachine
  Parameters:
     this (StateMachine) 
 method previousState(this) 
  Namespace types: StateMachine
  Parameters:
     this (StateMachine) 
 method changed(this, within_bars) 
  Namespace types: StateMachine
  Parameters:
     this (StateMachine) 
     within_bars (int) : (int): Number of bars to look back for a state change
  Returns: (bool): True if a state change occurred within the timeframe, else False
 method reset(this, condition, min_occurrences) 
  Namespace types: StateMachine
  Parameters:
     this (StateMachine) 
     condition (bool) : (bool): Condition to trigger the reset
     min_occurrences (int) : (int): Minimum number of times the condition must be true to reset
  Returns: (bool): True if the state was reset, else False
 StateMachine 
  Fields:
     state (series int) 
     neutral (series int) 
     enabled (series bool) 
     reset_counter (series int) 
     prior_state (series int) 
     last_change_bar (series int)
Milvetti_Pineconnector_LibraryLibrary   "Milvetti_Pineconnector_Library" 
This library has methods that provide practical signal transmission for Pineconnector.Developed By Milvetti
 buy(licenseId, symbol, risk, sl, tp, beTrigger, beOffset, trailTrig, trailDist, trailStep, atrTimeframe, atrTrigger, atrPeriod, atrMultiplier, atrShift, spread, accFilter, secret, comment) 
  Create a buy order message
  Parameters:
     licenseId (string) : License Id. This is a unique identifier found in the Pineconnector Licensing Dashboard.
     symbol (string) : Symbol. Default is syminfo.ticker
     risk (float) : Risk. Function depends on the “Volume Type” selected in the EA
     sl (float) : StopLoss. Place stop-loss. Computation is based on the Target Type selected in the EA. Default is 0(inactive)
     tp (float) : TakeProfit. Place take-profit. Computation is based on the Target Type selected in the EA. Default is 0(inactive)
     beTrigger (float) : Breakeven will be activated after the position gains this number of pips. Ensure > 0
     beOffset (float) : Offset from entry price. 0 means the SL will be placed exactly at entry price. 1 means 1 pip above the entry price for buy trades and 1 pip below for sell trades.
     trailTrig (int) : Trailing stop-loss will be activated after a trade gains this number of pips. Default is 0(inactive)
     trailDist (int) : SL will be opened at traildist after trailtrig is met, even if you do not have a SL placed.. Default is 0(inactive)
     trailStep (int) : Moves trailing stop-loss once price moves to favourable by a specified number of pips. Default is 0(inactive)
     atrTimeframe (string) : ATR Trailing Stop will be based on the specified timeframe in minutes and will only update once per bar close. Default is Timeframe.Period
     atrTrigger (float) : Activate the trigger of ATR Trailing after market moves favourably by a number of pips. Default is 0(inactive)
     atrPeriod (int) : ATR averaging period. Default is 0
     atrMultiplier (float) : Multiple of ATR to utilise in the new SL computation. Default is 1
     atrShift (float) : Relative shift of price information, 0 uses latest candle, 1 uses second last, etc. Default is 0
     spread (float) : Enter the position only if the spread is equal or less than the specified value in pips. Default is 0(inactive)
     accFilter (float) : Enter the position only if the account requirement is met. Default is 0(inactive)
     secret (string) 
     comment (string) : Comment. Add a string into the order’s comment section. Default is "Symbol+Timeframe"
 sell(licenseId, symbol, risk, sl, tp, beTrigger, beOffset, trailTrig, trailDist, trailStep, atrTimeframe, atrTrigger, atrPeriod, atrMultiplier, atrShift, spread, accFilter, secret, comment) 
  Create a buy order message
  Parameters:
     licenseId (string) : License Id. This is a unique identifier found in the Pineconnector Licensing Dashboard.
     symbol (string) : Symbol. Default is syminfo.ticker
     risk (float) : Risk. Function depends on the “Volume Type” selected in the EA
     sl (float) : StopLoss. Place stop-loss. Computation is based on the Target Type selected in the EA. Default is 0(inactive)
     tp (float) : TakeProfit. Place take-profit. Computation is based on the Target Type selected in the EA. Default is 0(inactive)
     beTrigger (float) : Breakeven will be activated after the position gains this number of pips. Ensure > 0
     beOffset (float) : Offset from entry price. 0 means the SL will be placed exactly at entry price. 1 means 1 pip above the entry price for buy trades and 1 pip below for sell trades.
     trailTrig (int) : Trailing stop-loss will be activated after a trade gains this number of pips. Default is 0(inactive)
     trailDist (int) : SL will be opened at traildist after trailtrig is met, even if you do not have a SL placed.. Default is 0(inactive)
     trailStep (int) : Moves trailing stop-loss once price moves to favourable by a specified number of pips. Default is 0(inactive)
     atrTimeframe (string) : ATR Trailing Stop will be based on the specified timeframe in minutes and will only update once per bar close. Default is Timeframe.Period
     atrTrigger (float) : Activate the trigger of ATR Trailing after market moves favourably by a number of pips. Default is 0(inactive)
     atrPeriod (int) : ATR averaging period. Default is 0
     atrMultiplier (float) : Multiple of ATR to utilise in the new SL computation. Default is 1
     atrShift (float) : Relative shift of price information, 0 uses latest candle, 1 uses second last, etc. Default is 0
     spread (float) : Enter the position only if the spread is equal or less than the specified value in pips. Default is 0(inactive)
     accFilter (float) : Enter the position only if the account requirement is met. Default is 0(inactive)
     secret (string) 
     comment (string) : Comment. Add a string into the order’s comment section. Default is "Symbol+Timeframe"
 buyLimit(licenseId, symbol, pending, risk, sl, tp, beTrigger, beOffset, trailTrig, trailDist, trailStep, atrTimeframe, atrTrigger, atrPeriod, atrMultiplier, atrShift, spread, accFilter, secret, comment) 
  Create a buy limit order message
  Parameters:
     licenseId (string) : License Id. This is a unique identifier found in the Pineconnector Licensing Dashboard.
     symbol (string) : Symbol. Default is syminfo.ticker
     pending (float) : Computing pending order entry price. EA Options: Pips, Specified Price, Percentage
     risk (float) : Risk. Function depends on the “Volume Type” selected in the EA
     sl (float) : StopLoss. Place stop-loss. Computation is based on the Target Type selected in the EA. Default is 0(inactive)
     tp (float) : TakeProfit. Place take-profit. Computation is based on the Target Type selected in the EA. Default is 0(inactive)
     beTrigger (float) : Breakeven will be activated after the position gains this number of pips. Ensure > 0
     beOffset (float) : Offset from entry price. 0 means the SL will be placed exactly at entry price. 1 means 1 pip above the entry price for buy trades and 1 pip below for sell trades.
     trailTrig (int) : Trailing stop-loss will be activated after a trade gains this number of pips. Default is 0(inactive)
     trailDist (int) : SL will be opened at traildist after trailtrig is met, even if you do not have a SL placed.. Default is 0(inactive)
     trailStep (int) : Moves trailing stop-loss once price moves to favourable by a specified number of pips. Default is 0(inactive)
     atrTimeframe (string) : ATR Trailing Stop will be based on the specified timeframe in minutes and will only update once per bar close. Default is Timeframe.Period
     atrTrigger (float) : Activate the trigger of ATR Trailing after market moves favourably by a number of pips. Default is 0(inactive)
     atrPeriod (int) : ATR averaging period. Default is 0
     atrMultiplier (float) : Multiple of ATR to utilise in the new SL computation. Default is 1
     atrShift (float) : Relative shift of price information, 0 uses latest candle, 1 uses second last, etc. Default is 0
     spread (float) : Enter the position only if the spread is equal or less than the specified value in pips. Default is 0(inactive)
     accFilter (float) : Enter the position only if the account requirement is met. Default is 0(inactive)
     secret (string) 
     comment (string) : Comment. Add a string into the order’s comment section. Default is "Symbol+Timeframe"
 buyStop(licenseId, symbol, pending, risk, sl, tp, beTrigger, beOffset, trailTrig, trailDist, trailStep, atrTimeframe, atrTrigger, atrPeriod, atrMultiplier, atrShift, spread, accFilter, secret, comment) 
  Create a buy stop order message
  Parameters:
     licenseId (string) : License Id. This is a unique identifier found in the Pineconnector Licensing Dashboard.
     symbol (string) : Symbol. Default is syminfo.ticker
     pending (float) : Computing pending order entry price. EA Options: Pips, Specified Price, Percentage
     risk (float) : Risk. Function depends on the “Volume Type” selected in the EA
     sl (float) : StopLoss. Place stop-loss. Computation is based on the Target Type selected in the EA. Default is 0(inactive)
     tp (float) : TakeProfit. Place take-profit. Computation is based on the Target Type selected in the EA. Default is 0(inactive)
     beTrigger (float) : Breakeven will be activated after the position gains this number of pips. Ensure > 0
     beOffset (float) : Offset from entry price. 0 means the SL will be placed exactly at entry price. 1 means 1 pip above the entry price for buy trades and 1 pip below for sell trades.
     trailTrig (int) : Trailing stop-loss will be activated after a trade gains this number of pips. Default is 0(inactive)
     trailDist (int) : SL will be opened at traildist after trailtrig is met, even if you do not have a SL placed.. Default is 0(inactive)
     trailStep (int) : Moves trailing stop-loss once price moves to favourable by a specified number of pips. Default is 0(inactive)
     atrTimeframe (string) : ATR Trailing Stop will be based on the specified timeframe in minutes and will only update once per bar close. Default is Timeframe.Period
     atrTrigger (float) : Activate the trigger of ATR Trailing after market moves favourably by a number of pips. Default is 0(inactive)
     atrPeriod (int) : ATR averaging period. Default is 0
     atrMultiplier (float) : Multiple of ATR to utilise in the new SL computation. Default is 1
     atrShift (float) : Relative shift of price information, 0 uses latest candle, 1 uses second last, etc. Default is 0
     spread (float) : Enter the position only if the spread is equal or less than the specified value in pips. Default is 0(inactive)
     accFilter (float) : Enter the position only if the account requirement is met. Default is 0(inactive)
     secret (string) 
     comment (string) : Comment. Add a string into the order’s comment section. Default is "Symbol+Timeframe"
 sellLimit(licenseId, symbol, pending, risk, sl, tp, beTrigger, beOffset, trailTrig, trailDist, trailStep, atrTimeframe, atrTrigger, atrPeriod, atrMultiplier, atrShift, spread, accFilter, secret, comment) 
  Create a sell limit order message
  Parameters:
     licenseId (string) : License Id. This is a unique identifier found in the Pineconnector Licensing Dashboard.
     symbol (string) : Symbol. Default is syminfo.ticker
     pending (float) : Computing pending order entry price. EA Options: Pips, Specified Price, Percentage
     risk (float) : Risk. Function depends on the “Volume Type” selected in the EA
     sl (float) : StopLoss. Place stop-loss. Computation is based on the Target Type selected in the EA. Default is 0(inactive)
     tp (float) : TakeProfit. Place take-profit. Computation is based on the Target Type selected in the EA. Default is 0(inactive)
     beTrigger (float) : Breakeven will be activated after the position gains this number of pips. Ensure > 0
     beOffset (float) : Offset from entry price. 0 means the SL will be placed exactly at entry price. 1 means 1 pip above the entry price for buy trades and 1 pip below for sell trades.
     trailTrig (int) : Trailing stop-loss will be activated after a trade gains this number of pips. Default is 0(inactive)
     trailDist (int) : SL will be opened at traildist after trailtrig is met, even if you do not have a SL placed.. Default is 0(inactive)
     trailStep (int) : Moves trailing stop-loss once price moves to favourable by a specified number of pips. Default is 0(inactive)
     atrTimeframe (string) : ATR Trailing Stop will be based on the specified timeframe in minutes and will only update once per bar close. Default is Timeframe.Period
     atrTrigger (float) : Activate the trigger of ATR Trailing after market moves favourably by a number of pips. Default is 0(inactive)
     atrPeriod (int) : ATR averaging period. Default is 0
     atrMultiplier (float) : Multiple of ATR to utilise in the new SL computation. Default is 1
     atrShift (float) : Relative shift of price information, 0 uses latest candle, 1 uses second last, etc. Default is 0
     spread (float) : Enter the position only if the spread is equal or less than the specified value in pips. Default is 0(inactive)
     accFilter (float) : Enter the position only if the account requirement is met. Default is 0(inactive)
     secret (string) 
     comment (string) : Comment. Add a string into the order’s comment section. Default is "Symbol+Timeframe"
 sellStop(licenseId, symbol, pending, risk, sl, tp, beTrigger, beOffset, trailTrig, trailDist, trailStep, atrTimeframe, atrTrigger, atrPeriod, atrMultiplier, atrShift, spread, accFilter, secret, comment) 
  Create a sell stop order message
  Parameters:
     licenseId (string) : License Id. This is a unique identifier found in the Pineconnector Licensing Dashboard.
     symbol (string) : Symbol. Default is syminfo.ticker
     pending (float) : Computing pending order entry price. EA Options: Pips, Specified Price, Percentage
     risk (float) : Risk. Function depends on the “Volume Type” selected in the EA
     sl (float) : StopLoss. Place stop-loss. Computation is based on the Target Type selected in the EA. Default is 0(inactive)
     tp (float) : TakeProfit. Place take-profit. Computation is based on the Target Type selected in the EA. Default is 0(inactive)
     beTrigger (float) : Breakeven will be activated after the position gains this number of pips. Ensure > 0
     beOffset (float) : Offset from entry price. 0 means the SL will be placed exactly at entry price. 1 means 1 pip above the entry price for buy trades and 1 pip below for sell trades.
     trailTrig (int) : Trailing stop-loss will be activated after a trade gains this number of pips. Default is 0(inactive)
     trailDist (int) : SL will be opened at traildist after trailtrig is met, even if you do not have a SL placed.. Default is 0(inactive)
     trailStep (int) : Moves trailing stop-loss once price moves to favourable by a specified number of pips. Default is 0(inactive)
     atrTimeframe (string) : ATR Trailing Stop will be based on the specified timeframe in minutes and will only update once per bar close. Default is Timeframe.Period
     atrTrigger (float) : Activate the trigger of ATR Trailing after market moves favourably by a number of pips. Default is 0(inactive)
     atrPeriod (int) : ATR averaging period. Default is 0
     atrMultiplier (float) : Multiple of ATR to utilise in the new SL computation. Default is 1
     atrShift (float) : Relative shift of price information, 0 uses latest candle, 1 uses second last, etc. Default is 0
     spread (float) : Enter the position only if the spread is equal or less than the specified value in pips. Default is 0(inactive)
     accFilter (float) : Enter the position only if the account requirement is met. Default is 0(inactive)
     secret (string) 
     comment (string) : Comment. Add a string into the order’s comment section. Default is "Symbol+Timeframe"
BacktestLibraryLibrary   "BacktestLibrary" 
A library providing functions for equity calculation and performance metrics.
 since(date, active) 
  : Calculates the number of candles since a specified date.
  Parameters:
     date (simple float) : (simple float): The starting date in timestamp format (e.g., input.time(timestamp()))
     active (simple bool) : (simple bool): If true, counts the number of candles since the date; if false, returns 0.
  Returns: (int): The number of candles since the specified date.
 buy_and_hold(r, startDate) 
  : Calculates the Buy and Hold Equity from a specified date.
  Parameters:
     r (float) : (series float): Daily returns of the asset (e.g., 0.02 for 2% move).
     startDate (simple float) : (simple float): Timestamp of the starting date for the equity calculation.
  Returns: (float): Buy and Hold Equity of the asset from the specified date.
 equity(sig, threshold, r, startDate, signals) 
  : Calculates the strategy's equity on a candle-by-candle basis.
  Parameters:
     sig (float) : (series float): Signal values; positive for long, negative for short.
     threshold (simple float) : (simple float): Signal threshold for entering trades.
     r (float) : (series float): Daily returns of the asset (e.g., 0.02 for 2% move).
     startDate (simple float) : (simple float): Timestamp of the starting date for the equity calculation.
     signals (simple string) : (simple string): Type of signals to backtest ("Long & Short", "Long Only", "Short Only").
  Returns: (float): Strategy equity on a candle-by-candle basis.
 PerformanceMetrics(base, Lookback, startDate) 
  : Calculates performance metrics of a strategy from a specified date.
  Parameters:
     base (float) : (series float): Equity values of the strategy or Buy and Hold equity.
     Lookback (int) : (series int): Number of periods since the start date; recommended to use the 'since' function.
     startDate (simple float) : (simple float): Timestamp of the starting date for the equity calculation.
  Returns: (float ): Array of performance metrics.
 PerfMetricTable(buy_and_hold, strategy) 
  : Plots a table comparing performance metrics of Buy and Hold and Strategy equity.
  Parameters:
     buy_and_hold (array) : (float ): Metrics from the PerformanceMetrics() function for Buy and Hold.
     strategy (array) : (float ): Metrics from the PerformanceMetrics() function for the strategy.
  Returns: : Table displaying the performance metrics comparison.
SnowdexUtilsLibrary   "SnowdexUtils" 
the various function that often use when create a strategy trading.
 f_backtesting_date(train_start_date, train_end_date, test_date, deploy_date) 
  Backtesting within a specific window based on deployment and testing dates.
  Parameters:
     train_start_date (int) : the start date for training the strategy.
     train_end_date (int) : the end date for training the strategy.
     test_date (bool) : if true, backtests within the period from `train_end_date` to the current time.
     deploy_date (bool) : if true, the strategy backtests up to the current time.
  Returns: given time falls within the specified window for backtesting.
 f_init_ma(ma_type, source, length) 
  Initializes a moving average based on the specified type.
  Parameters:
     ma_type (simple string) : the type of moving average (e.g., "RMA", "EMA", "SMA", "WMA").
     source (float) : the input series for the moving average calculation.
     length (simple int) : the length of the moving average window.
  Returns: the calculated moving average value.
 f_init_tp(side, entry_price, rr, sl_open_position) 
  Calculates the target profit based on entry price, risk-reward ratio, and stop loss. The formula is `tp = entry price + (rr * (entry price - stop loss))`.
  Parameters:
     side (bool) : the trading side (true for long, false for short).
     entry_price (float) : the entry price of the position.
     rr (float) : the risk-reward ratio.
     sl_open_position (float) : the stop loss price for the open position.
  Returns: the calculated target profit value.
 f_round_up(number, decimals) 
  Rounds up a number to a specified number of decimals.
  Parameters:
     number (float) 
     decimals (int) 
  Returns: The rounded-up number.
 f_get_pip_size() 
  Calculates the pip size for the current instrument.
  Returns: Pip size adjusted for Forex instruments or 1 for others.
 f_table_get_position(value) 
  Maps a string to a table position constant.
  Parameters:
     value (string) : String representing the desired position (e.g., "Top Right").
  Returns: The corresponding position constant or `na` for invalid values.
Trading IQ - ICT LibraryLibrary   "ICTlibrary" 
Used to calculate various ICT related price levels and strategies. An ongoing project.
Hello Coders!
This library is meant for sourcing ICT related concepts. While some functions might generate more output than you require, you can specify "Lite Mode" as "true" in applicable functions to slim down necessary inputs.
 isLastBar(userTF) 
  Identifies the last bar on the chart before a timeframe change
  Parameters:
     userTF (simple int) : the timeframe you wish to calculate the last bar for, must be converted to integer using 'timeframe.in_seconds()'
  Returns: bool true if bar on chart is last bar of higher TF, dalse if bar on chart is not last bar of higher TF
 necessaryData(atrTF) 
  returns necessaryData UDT for historical data access
  Parameters:
     atrTF (float) : user-selected timeframe ATR value.
  Returns: logZ. log return Z score, used for calculating order blocks.
 method gradBoxes(gradientBoxes, idColor, timeStart, bottom, top, rightCoordinate) 
  creates neon like effect for box drawings
  Namespace types: array
  Parameters:
     gradientBoxes (array) : an array.new() to store the gradient boxes
     idColor (color) 
     timeStart (int) : left point of box
     bottom (float) : bottom of box price point
     top (float) : top of box price point
     rightCoordinate (int) : right point of box
  Returns: void
 checkIfTraded(tradeName) 
  checks if recent trade is of specific name
  Parameters:
     tradeName (string) 
  Returns: bool true if recent trade id matches target name, false otherwise
 checkIfClosed(tradeName) 
  checks if recent closed trade is of specific name
  Parameters:
     tradeName (string) 
  Returns: bool true if recent closed trade id matches target name, false otherwise
 IQZZ(atrMult, finalTF) 
  custom ZZ to quickly determine market direction.
  Parameters:
     atrMult (float) : an atr multiplier used to determine the required price move for a ZZ direction change
     finalTF (string) : the timeframe used for the atr calcuation
  Returns: dir market direction. Up => 1, down => -1
 method drawBos(id, startPoint, getKeyPointTime, getKeyPointPrice, col, showBOS, isUp) 
  calculates and draws Break Of Structure
  Namespace types: array
  Parameters:
     id (array) 
     startPoint (chart.point) 
     getKeyPointTime (int) : the actual time of startPoint, simplystartPoint.time
     getKeyPointPrice (float) : the actual time of startPoint, simplystartPoint.price
     col (color) : color of the BoS line / label
     showBOS (bool) : whether to show label/line. This function still calculates internally for other ICT related concepts even if not drawn.
     isUp (bool) : whether BoS happened during price increase or price decrease.
  Returns: void
 method drawMSS(id, startPoint, getKeyPointTime, getKeyPointPrice, col, showMSS, isUp, upRejections, dnRejections, highArr, lowArr, timeArr, closeArr, openArr, atrTFarr, upRejectionsPrices, dnRejectionsPrices) 
  calculates and draws Market Structure Shift. This data is also used to calculate Rejection Blocks.
  Namespace types: array
  Parameters:
     id (array) 
     startPoint (chart.point) 
     getKeyPointTime (int) : the actual time of startPoint, simplystartPoint.time
     getKeyPointPrice (float) : the actual time of startPoint, simplystartPoint.price
     col (color) : color of the MSS line / label
     showMSS (bool) : whether to show label/line. This function still calculates internally for other ICT related concepts even if not drawn.
     isUp (bool) : whether MSS happened during price increase or price decrease.
     upRejections (array) 
     dnRejections (array) 
     highArr (array) : array containing historical highs, should be taken from the UDT "necessaryData" defined above
     lowArr (array) : array containing historical lows, should be taken from the UDT "necessaryData" defined above
     timeArr (array) : array containing historical times, should be taken from the UDT "necessaryData" defined above
     closeArr (array) : array containing historical closes, should be taken from the UDT "necessaryData" defined above
     openArr (array) : array containing historical opens, should be taken from the UDT "necessaryData" defined above
     atrTFarr (array) : array containing historical atr values (of user-selected TF), should be taken from the UDT "necessaryData" defined above
     upRejectionsPrices (array) : array containing up rejections prices. Is sorted and used to determine selective looping for invalidations.
     dnRejectionsPrices (array) : array containing down rejections prices. Is sorted and used to determine selective looping for invalidations.
  Returns: void
 method getTime(id, compare, timeArr) 
  gets time of inputted price (compare) in an array of data
this is useful when the user-selected timeframe for ICT concepts is greater than the chart's timeframe
  Namespace types: array
  Parameters:
     id (array) : the array of data to search through, to find which index has the same value as "compare"
     compare (float) : the target data point to find in the array
     timeArr (array) : array of historical times
  Returns: the time that the data point in the array was recorded
 method OB(id, highArr, signArr, lowArr, timeArr, sign) 
  store bullish orderblock data
  Namespace types: array
  Parameters:
     id (array) 
     highArr (array) : array of historical highs
     signArr (array) : array of historical price direction "math.sign(close - open)"
     lowArr (array) : array of historical lows
     timeArr (array) : array of historical times
     sign (int) : orderblock direction, -1 => bullish, 1 => bearish
  Returns: void
 OTEstrat(OTEstart, future, closeArr, highArr, lowArr, timeArr, longOTEPT, longOTESL, longOTElevel, shortOTEPT, shortOTESL, shortOTElevel, structureDirection, oteLongs, atrTF, oteShorts) 
  executes the OTE strategy
  Parameters:
     OTEstart (chart.point) 
     future (int) : future time point for drawings
     closeArr (array) : array of historical closes
     highArr (array) : array of historical highs
     lowArr (array) : array of historical lows
     timeArr (array) : array of historical times
     longOTEPT (string) : user-selected long OTE profit target, please create an input.string() for this using the example below
     longOTESL (int) : user-selected long OTE stop loss, please create an input.string() for this using the example below
     longOTElevel (float) : long entry price of selected retracement ratio for OTE
     shortOTEPT (string) : user-selected short OTE profit target, please create an input.string() for this using the example below
     shortOTESL (int) : user-selected short OTE stop loss, please create an input.string() for this using the example below
     shortOTElevel (float) : short entry price of selected retracement ratio for OTE
     structureDirection (string) : current market structure direction, this should be "Up" or "Down". This is used to cancel pending orders if market structure changes
     oteLongs (bool) : input.bool() for whether OTE longs can be executed
     atrTF (float) : atr of the user-seleceted TF
     oteShorts (bool) : input.bool() for whether OTE shorts can be executed
@exampleInputs
oteLongs        = input.bool(defval = false, title = "OTE Longs", group = "Optimal Trade Entry")
longOTElevel    = input.float(defval = 0.79, title = "Long Entry Retracement Level", options =  , group = "Optimal Trade Entry")
longOTEPT       = input.string(defval = "-0.5", title = "Long TP", options =  , group = "Optimal Trade Entry")
longOTESL       = input.int(defval = 0, title = "How Many Ticks Below Swing Low For Stop Loss", group = "Optimal Trade Entry")
oteShorts       = input.bool(defval = false, title = "OTE Shorts", group = "Optimal Trade Entry")
shortOTElevel   = input.float(defval = 0.79, title = "Short Entry Retracement Level", options =  , group = "Optimal Trade Entry")
shortOTEPT      = input.string(defval = "-0.5", title = "Short TP", options =  , group = "Optimal Trade Entry")
shortOTESL      = input.int(defval = 0, title = "How Many Ticks Above Swing Low For Stop Loss", group = "Optimal Trade Entry")
  Returns: void (0)
 displacement(logZ, atrTFreg, highArr, timeArr, lowArr, upDispShow, dnDispShow, masterCoords, labelLevels, dispUpcol, rightCoordinate, dispDncol, noBorders) 
  calculates and draws dispacements
  Parameters:
     logZ (float) : log return of current price, used to determine a "significant price move" for a displacement
     atrTFreg (float) : atr of user-seleceted timeframe
     highArr (array) : array of historical highs
     timeArr (array) : array of historical times
     lowArr (array) : array of historical lows
     upDispShow (int) : amount of historical upside displacements to show
     dnDispShow (int) : amount of historical downside displacements to show
     masterCoords (map) : a  map to push the most recent displacement prices into, useful for having key levels in one data structure
     labelLevels (string) : used to determine label placement for the displacement, can be inside box, outside box, or none, example below
     dispUpcol (color) : upside displacement color
     rightCoordinate (int) : future time for displacement drawing, best is "last_bar_time"
     dispDncol (color) : downside displacement color
     noBorders (bool) : input.bool() to remove box borders, example below
@exampleInputs
labelLevels     = input.string(defval = "Inside" , title = "Box Label Placement", options =  )
noBorders       = input.bool(defval = false, title = "No Borders On Levels")
  Returns: void
 method getStrongLow(id, startIndex, timeArr, lowArr, strongLowPoints) 
  unshift strong low data to array id
  Namespace types: array
  Parameters:
     id (array) 
     startIndex (int) : the starting index for the timeArr array of the UDT "necessaryData".
this point should start from at least 1 pivot prior to find the low before an upside BoS
     timeArr (array) : array of historical times
     lowArr (array) : array of historical lows
     strongLowPoints (array) : array of strong low prices. Used to retrieve highest strong low price and see if need for
removal of invalidated strong lows
  Returns: void
 method getStrongHigh(id, startIndex, timeArr, highArr, strongHighPoints) 
  unshift strong high data to array id
  Namespace types: array
  Parameters:
     id (array) 
     startIndex (int) : the starting index for the timeArr array of the UDT "necessaryData".
this point should start from at least 1 pivot prior to find the high before a downside BoS
     timeArr (array) : array of historical times
     highArr (array) : array of historical highs
     strongHighPoints (array) 
  Returns: void
 equalLevels(highArr, lowArr, timeArr, rightCoordinate, equalHighsCol, equalLowsCol, liteMode) 
  used to calculate recent equal highs or equal lows
  Parameters:
     highArr (array) : array of historical highs
     lowArr (array) : array of historical lows
     timeArr (array) : array of historical times
     rightCoordinate (int) : a future time (right for boxes, x2 for lines)
     equalHighsCol (color) : user-selected color for equal highs drawings
     equalLowsCol (color) : user-selected color for equal lows drawings
     liteMode (bool) : optional for a lite mode version of an ICT strategy. For more control over drawings leave as "True", "False" will apply neon effects
  Returns: void
 quickTime(timeString) 
  used to quickly determine if a user-inputted time range is currently active in NYT time
  Parameters:
     timeString (string) : a time range
  Returns: true if session is active, false if session is inactive
 macros(showMacros, noBorders) 
  used to calculate and draw session macros
  Parameters:
     showMacros (bool) : an input.bool() or simple bool to determine whether to activate the function
     noBorders (bool) : an input.bool() to determine whether the box anchored to the session should have borders
  Returns: void
 po3(tf, left, right, show) 
  use to calculate HTF po3 candle
@tip only call this function on "barstate.islast"
  Parameters:
     tf (simple string) 
     left (int) : the left point of the candle, calculated as bar_index + left,
     right (int) : :the right point of the candle, calculated as bar_index + right,
     show (bool) : input.bool() whether to show the po3 candle or not
  Returns: void
 silverBullet(silverBulletStratLong, silverBulletStratShort, future, userTF, H, L, H2, L2, noBorders, silverBulletLongTP, historicalPoints, historicalData, silverBulletLongSL, silverBulletShortTP, silverBulletShortSL) 
  used to execute the Silver Bullet Strategy
  Parameters:
     silverBulletStratLong (simple bool) 
     silverBulletStratShort (simple bool) 
     future (int) : a future time, used for drawings, example "last_bar_time"
     userTF (simple int) 
     H (float) : the high price of the user-selected TF
     L (float) : the low price of the user-selected TF
     H2 (float) : the high  price of the user-selected TF
     L2 (float) : the low  price of the user-selected TF
     noBorders (bool) : an input.bool() used to remove the borders from box drawings
     silverBulletLongTP (series silverBulletLevels) 
     historicalPoints (array) 
     historicalData (necessaryData) 
     silverBulletLongSL (series silverBulletLevels) 
     silverBulletShortTP (series silverBulletLevels) 
     silverBulletShortSL (series silverBulletLevels) 
  Returns: void
 method invalidFVGcheck(FVGarr, upFVGpricesSorted, dnFVGpricesSorted) 
  check if existing FVGs are still valid
  Namespace types: array
  Parameters:
     FVGarr (array) 
     upFVGpricesSorted (array) : an array of bullish FVG prices, used to selective search through FVG array to remove invalidated levels
     dnFVGpricesSorted (array) : an array of bearish FVG prices, used to selective search through FVG array to remove invalidated levels
  Returns: void (0)
 method drawFVG(counter, FVGshow, FVGname, FVGcol, data, masterCoords, labelLevels, borderTransp, liteMode, rightCoordinate) 
  draws FVGs on last bar
  Namespace types: map
  Parameters:
     counter (map) : a counter, as map, keeping count of the number of FVGs drawn, makes sure that there aren't more FVGs drawn
than int FVGshow
     FVGshow (int) : the number of FVGs to show. There should be a bullish FVG show and bearish FVG show. This function "drawFVG" is used separately
for bearish FVG and bullish FVG.
     FVGname (string) : the name of the FVG, "FVG Up" or "FVG Down"
     FVGcol (color) : desired FVG color
     data (FVG) 
     masterCoords (map) : a map containing the names and price points of key levels. Used to define price ranges.
     labelLevels (string) : an input.string with options "Inside", "Outside", "Remove". Determines whether FVG labels should be inside box, outside,
or na.
     borderTransp (int) 
     liteMode (bool) 
     rightCoordinate (int) : the right coordinate of any drawings. Must be a time point.
  Returns: void
 invalidBlockCheck(bullishOBbox, bearishOBbox, userTF) 
  check if existing order blocks are still valid
  Parameters:
     bullishOBbox (array) : an array declared using the UDT orderBlock that contains bullish order block related data
     bearishOBbox (array) : an array declared using the UDT orderBlock that contains bearish order block related data
     userTF (simple int) 
  Returns: void (0)
 method lastBarRejections(id, rejectionColor, idShow, rejectionString, labelLevels, borderTransp, liteMode, rightCoordinate, masterCoords) 
  draws rejectionBlocks on last bar
  Namespace types: array
  Parameters:
     id (array) : the array, an array of rejection block data declared using the UDT rejection block
     rejectionColor (color) : the desired color of the rejection box
     idShow (int) 
     rejectionString (string) : the desired name of the rejection blocks
     labelLevels (string) : an input.string() to determine if labels for the block should be inside the box, outside, or none.
     borderTransp (int) 
     liteMode (bool) : an input.bool(). True = neon effect, false = no neon.
     rightCoordinate (int) : atime for the right coordinate of the box
     masterCoords (map) : a map  that stores the price of key levels and assigns them a name, used to determine price ranges
  Returns: void
 method OBdraw(id, OBshow, BBshow, OBcol, BBcol, bullishString, bearishString, isBullish, labelLevels, borderTransp, liteMode, rightCoordinate, masterCoords) 
  draws orderblocks and breaker blocks for data stored in UDT array()
  Namespace types: array
  Parameters:
     id (array) : the array, an array of order block data declared using the UDT orderblock
     OBshow (int) : the number of order blocks to show
     BBshow (int) : the number of breaker blocks to show
     OBcol (color) : color of order blocks
     BBcol (color) : color of breaker blocks
     bullishString (string) : the title of bullish blocks, which is a regular bullish orderblock or a bearish orderblock that's converted to breakerblock
     bearishString (string) : the title of bearish blocks, which is a regular bearish orderblock or a bullish orderblock that's converted to breakerblock
     isBullish (bool) : whether the array contains bullish orderblocks or bearish orderblocks. If bullish orderblocks,
the array will naturally contain bearish BB, and if bearish OB, the array will naturally contain bullish BB
     labelLevels (string) : an input.string() to determine if labels for the block should be inside the box, outside, or none.
     borderTransp (int) 
     liteMode (bool) : an input.bool(). True = neon effect, false = no neon.
     rightCoordinate (int) : atime for the right coordinate of the box
     masterCoords (map) : a map  that stores the price of key levels and assigns them a name, used to determine price ranges
  Returns: void
 FVG 
  UDT for FVG calcualtions
  Fields:
     H (series float) : high price of user-selected timeframe
     L (series float) : low price of user-selected timeframe
     direction (series string) : FVG direction => "Up" or "Down"
     T (series int) : => time of bar on user-selected timeframe where FVG was created
     fvgLabel (series label) : optional label for FVG
     fvgLineTop (series line) : optional line for top of FVG
     fvgLineBot (series line) : optional line for bottom of FVG
     fvgBox (series box) : optional box for FVG
 labelLine 
  quickly pair a line and label together as UDT
  Fields:
     lin (series line) : Line you wish to pair with label
     lab (series label) : Label you wish to pair with line
 orderBlock 
  UDT for order block calculations
  Fields:
     orderBlockData (array) : array containing order block x and y points
     orderBlockBox (series box) : optional order block box
     vioCount (series int) : = 0    violation count of the order block. 0 = Order Block, 1 = Breaker Block
     traded (series bool) 
     status (series string) : = "OB"   status == "OB" => Level is order block. status == "BB" => Level is breaker block.
     orderBlockLab (series label) : options label for the order block / breaker block.
 strongPoints 
  UDT for strong highs and strong lows
  Fields:
     price (series float) : price of the strong high or strong low
     timeAtprice (series int) : time of the strong high or strong low
     strongPointLabel (series label) : optional label for strong point
     strongPointLine (series line) : optional line for strong point
     overlayLine (series line) : optional lines for strong point to enhance visibility
     overlayLine2 (series line) : optional lines for strong point to enhance visibility
 displacement 
  UDT for dispacements
  Fields:
     highPrice (series float) : high price of displacement
     lowPrice (series float) : low price of displacement
     timeAtPrice (series int) : time of bar where displacement occurred
     displacementBox (series box) : optional box to draw displacement
     displacementLab (series label) : optional label for displacement
 po3data 
  UDT for po3 calculations
  Fields:
     dHigh (series float) : higher timeframe high price
     dLow (series float) : higher timeframe low price
     dOpen (series float) : higher timeframe open price
     dClose (series float) : higher timeframe close price
     po3box (series box) : box to draw po3 candle body
     po3line (array) : line array to draw po3 wicks
     po3Labels (array) : label array to label price points of po3 candle
 macros 
  UDT for session macros
  Fields:
     sessions (array) : Array of sessions, you can populate this array using the "quickTime" function located above "export macros".
     prices (matrix) : Matrix of session data -> open, high, low, close, time
     sessionTimes (array) : Array of session names. Pairs with array sessions.
     sessionLines (matrix) : Optional array for sesion drawings.
 OTEtimes 
  UDT for data storage and drawings associated with OTE strategy
  Fields:
     upTimes (array) : time of highest point before trade is taken
     dnTimes (array) : time of lowest point before trade is taken
     tpLineLong (series line) : line to mark tp level long
     tpLabelLong (series label) : label to mark tp level long
     slLineLong (series line) : line to mark sl level  long
     slLabelLong (series label) : label to mark sl level long
     tpLineShort (series line) : line to mark tp level short
     tpLabelShort (series label) : label to mark tp level short
     slLineShort (series line) : line to mark sl level  short
     slLabelShort (series label) : label to mark sl level short
 sweeps 
  UDT for data storage and drawings associated with liquidity sweeps
  Fields:
     upSweeps (matrix) : matrix containing liquidity sweep price points and time points for up sweeps
     dnSweeps (matrix) : matrix containing liquidity sweep price points and time points for down sweeps
     upSweepDrawings (array) : optional up sweep box array. Pair the size of this array with the rows or columns,
     dnSweepDrawings (array) : optional up sweep box array. Pair the size of this array with the rows or columns,
 raidExitDrawings 
  UDT for drawings associated with the Liquidity Raid Strategy
  Fields:
     tpLine (series line) : tp line for the liquidity raid entry
     tpLabel (series label) : tp label for the liquidity raid entry
     slLine (series line) : sl line for the liquidity raid entry
     slLabel (series label) : sl label for the liquidity raid entry
 m2022 
  UDT for data storage and drawings associated with the Model 2022 Strategy
  Fields:
     mTime (series int) : time of the FVG where entry limit order is placed
     mIndex (series int) : array index of FVG where entry limit order is placed. This requires an array of FVG data, which is defined above.
     mEntryDistance (series float) : the distance of the FVG to the 50% range. M2022 looks for the fvg closest to 50% mark of range.
     mEntry (series float) : the entry price for the most eligible fvg
     fvgHigh (series float) : the high point of the eligible fvg
     fvgLow (series float) : the low point of the eligible fvg
     longFVGentryBox (series box) : long FVG box, used to draw the eligible FVG
     shortFVGentryBox (series box) : short FVG box, used to draw the eligible FVG
     line50P (series line) : line used to mark 50% of the range
     line100P (series line) : line used to mark 100% (top) of the range
     line0P (series line) : line used to mark 0% (bottom) of the range
     label50P (series label) : label used to mark 50% of the range
     label100P (series label) : label used to mark 100% (top) of the range
     label0P (series label) : label used to mark 0% (bottom) of the range
     sweepData (array) 
 silverBullet 
  UDT for data storage and drawings associated with the Silver Bullet Strategy
  Fields:
     session (series bool) 
     sessionStr (series string) : name of the session for silver bullet
     sessionBias (series string) 
     sessionHigh (series float) : = high   high of session // use math.max(silverBullet.sessionHigh, high)
     sessionLow (series float) : = low    low of session  // use math.min(silverBullet.sessionLow, low)
     sessionFVG (series float) : if applicable, the FVG created during the session
     sessionFVGdraw (series box) : if applicable, draw the FVG created during the session
     traded (series bool) 
     tp (series float) : tp of trade entered at the session FVG
     sl (series float) : sl of trade entered at the session FVG
     sessionDraw (series box) : optional draw session with box
     sessionDrawLabel (series label) : optional label session with label
 silverBulletDrawings 
  UDT for trade exit drawings associated with the Silver Bullet Strategy
  Fields:
     tpLine (series line) : tp line drawing for strategy
     tpLabel (series label) : tp label drawing for strategy
     slLine (series line) : sl line drawing for strategy
     slLabel (series label) : sl label drawing for strategy
 unicornModel 
  UDT for data storage and drawings associated with the Unicorn Model Strategy
  Fields:
     hPoint (chart.point) 
     hPoint2 (chart.point) 
     hPoint3 (chart.point) 
     breakerBlock (series box) : used to draw the breaker block required for the Unicorn Model
     FVG (series box) : used to draw the FVG required for the Unicorn model
     topBlock (series float) : price of top of breaker block, can be used to detail trade entry
     botBlock (series float) : price of bottom of breaker block, can be used to detail trade entry
     startBlock (series int) : start time of the breaker block, used to set the "left = " param for the box
     includes (array) : used to store the time of the breaker block, or FVG, or the chart point sequence that setup the Unicorn Model.
     entry (series float) : // eligible entry price, for longs"math.max(topBlock, FVG.get_top())",
     tpLine (series line) : optional line to mark PT
     tpLabel (series label) : optional label to mark PT
     slLine (series line) : optional line to mark SL
     slLabel (series label) : optional label to mark SL
 rejectionBlocks 
  UDT for data storage and drawings associated with rejection blocks
  Fields:
     rejectionPoint (chart.point) 
     bodyPrice (series float) : candle body price closest to the rejection point, for "Up" rejections => math.max(open, close),
     rejectionBox (series box) : optional box drawing of the rejection block
     rejectionLabel (series label) : optional label for the rejection block
 equalLevelsDraw 
  UDT for data storage and drawings associated with equal highs / equal lows
  Fields:
     connector (series line) : single line placed at the first high or low, y = avgerage of distinguished equal highs/lows
     connectorLab (series label) : optional label to be placed at the highs or lows
     levels (array) : array containing the equal highs or lows prices
     times (array) : array containing the equal highs or lows individual times
     startTime (series int) : the time of the first high or low that forms a sequence of equal highs or lows
     radiate (array) : options label to "radiate" the label in connector lab. Can be used for anything
 necessaryData 
  UDT for data storage of historical price points.
  Fields:
     highArr (array) : array containing historical high points
     lowArr (array) : array containing historical low points
     timeArr (array) : array containing historical time points
     logArr (array) : array containing historical log returns
     signArr (array) : array containing historical price directions
     closeArr (array) : array containing historical close points
     binaryTimeArr (array) : array containing historical time points, uses "push" instead of "unshift" to allow for binary search
     binaryCloseArr (array) : array containing historical close points, uses "push" instead of "unshift" to allow the correct
     binaryOpenArr (array) : array containing historical optn points, uses "push" instead of "unshift" to allow the correct
     atrTFarr (array) : array containing historical user-selected TF atr points
     openArr (array) : array containing historical open points
PubLibPatternLibrary   "PubLibPattern" 
pattern conditions for indicator and strategy development
 bear_5_0(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol) 
  bearish 5-0 harmonic pattern condition
  Parameters:
     ab_low_tol (float) 
     ab_up_tol (float) 
     bc_low_tol (float) 
     bc_up_tol (float) 
     cd_low_tol (float) 
     cd_up_tol (float) 
  Returns: bool
 bull_5_0(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol) 
  bullish 5-0 harmonic pattern condition
  Parameters:
     ab_low_tol (float) 
     ab_up_tol (float) 
     bc_low_tol (float) 
     bc_up_tol (float) 
     cd_low_tol (float) 
     cd_up_tol (float) 
  Returns: bool
 bear_abcd(bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol) 
  bearish abcd harmonic pattern condition
  Parameters:
     bc_low_tol (float) 
     bc_up_tol (float) 
     cd_low_tol (float) 
     cd_up_tol (float) 
  Returns: bool
 bull_abcd(bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol) 
  bullish abcd harmonic pattern condition
  Parameters:
     bc_low_tol (float) 
     bc_up_tol (float) 
     cd_low_tol (float) 
     cd_up_tol (float) 
  Returns: bool
 bear_alt_bat(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, ad_low_tol, ad_up_tol) 
  bearish alternate bat harmonic pattern condition
  Parameters:
     ab_low_tol (float) 
     ab_up_tol (float) 
     bc_low_tol (float) 
     bc_up_tol (float) 
     cd_low_tol (float) 
     cd_up_tol (float) 
     ad_low_tol (float) 
     ad_up_tol (float) 
  Returns: bool
 bull_alt_bat(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, ad_low_tol, ad_up_tol) 
  bullish alternate bat harmonic pattern condition
  Parameters:
     ab_low_tol (float) 
     ab_up_tol (float) 
     bc_low_tol (float) 
     bc_up_tol (float) 
     cd_low_tol (float) 
     cd_up_tol (float) 
     ad_low_tol (float) 
     ad_up_tol (float) 
  Returns: bool
 bear_bat(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, ad_low_tol, ad_up_tol) 
  bearish bat harmonic pattern condition
  Parameters:
     ab_low_tol (float) 
     ab_up_tol (float) 
     bc_low_tol (float) 
     bc_up_tol (float) 
     cd_low_tol (float) 
     cd_up_tol (float) 
     ad_low_tol (float) 
     ad_up_tol (float) 
  Returns: bool
 bull_bat(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, ad_low_tol, ad_up_tol) 
  bullish bat harmonic pattern condition
  Parameters:
     ab_low_tol (float) 
     ab_up_tol (float) 
     bc_low_tol (float) 
     bc_up_tol (float) 
     cd_low_tol (float) 
     cd_up_tol (float) 
     ad_low_tol (float) 
     ad_up_tol (float) 
  Returns: bool
 bear_butterfly(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, ad_low_tol, ad_up_tol) 
  bearish butterfly harmonic pattern condition
  Parameters:
     ab_low_tol (float) 
     ab_up_tol (float) 
     bc_low_tol (float) 
     bc_up_tol (float) 
     cd_low_tol (float) 
     cd_up_tol (float) 
     ad_low_tol (float) 
     ad_up_tol (float) 
  Returns: bool
 bull_butterfly(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, ad_low_tol, ad_up_tol) 
  bullish butterfly harmonic pattern condition
  Parameters:
     ab_low_tol (float) 
     ab_up_tol (float) 
     bc_low_tol (float) 
     bc_up_tol (float) 
     cd_low_tol (float) 
     cd_up_tol (float) 
     ad_low_tol (float) 
     ad_up_tol (float) 
  Returns: bool
 bear_cassiopeia_a(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol) 
  bearish cassiopeia a harmonic pattern condition
  Parameters:
     ab_low_tol (float) 
     ab_up_tol (float) 
     bc_low_tol (float) 
     bc_up_tol (float) 
     cd_low_tol (float) 
     cd_up_tol (float) 
  Returns: bool
 bull_cassiopeia_a(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol) 
  bullish cassiopeia a harmonic pattern condition
  Parameters:
     ab_low_tol (float) 
     ab_up_tol (float) 
     bc_low_tol (float) 
     bc_up_tol (float) 
     cd_low_tol (float) 
     cd_up_tol (float) 
  Returns: bool
 bear_cassiopeia_b(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol) 
  bearish cassiopeia b harmonic pattern condition
  Parameters:
     ab_low_tol (float) 
     ab_up_tol (float) 
     bc_low_tol (float) 
     bc_up_tol (float) 
     cd_low_tol (float) 
     cd_up_tol (float) 
  Returns: bool
 bull_cassiopeia_b(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol) 
  bullish cassiopeia b harmonic pattern condition
  Parameters:
     ab_low_tol (float) 
     ab_up_tol (float) 
     bc_low_tol (float) 
     bc_up_tol (float) 
     cd_low_tol (float) 
     cd_up_tol (float) 
  Returns: bool
 bear_cassiopeia_c(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol) 
  bearish cassiopeia c harmonic pattern condition
  Parameters:
     ab_low_tol (float) 
     ab_up_tol (float) 
     bc_low_tol (float) 
     bc_up_tol (float) 
     cd_low_tol (float) 
     cd_up_tol (float) 
  Returns: bool
 bull_cassiopeia_c(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol) 
  bullish cassiopeia c harmonic pattern condition
  Parameters:
     ab_low_tol (float) 
     ab_up_tol (float) 
     bc_low_tol (float) 
     bc_up_tol (float) 
     cd_low_tol (float) 
     cd_up_tol (float) 
  Returns: bool
 bear_crab(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, ad_low_tol, ad_up_tol) 
  bearish crab harmonic pattern condition
  Parameters:
     ab_low_tol (float) 
     ab_up_tol (float) 
     bc_low_tol (float) 
     bc_up_tol (float) 
     cd_low_tol (float) 
     cd_up_tol (float) 
     ad_low_tol (float) 
     ad_up_tol (float) 
  Returns: bool
 bull_crab(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, ad_low_tol, ad_up_tol) 
  bullish crab harmonic pattern condition
  Parameters:
     ab_low_tol (float) 
     ab_up_tol (float) 
     bc_low_tol (float) 
     bc_up_tol (float) 
     cd_low_tol (float) 
     cd_up_tol (float) 
     ad_low_tol (float) 
     ad_up_tol (float) 
  Returns: bool
 bear_deep_crab(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, ad_low_tol, ad_up_tol) 
  bearish deep crab harmonic pattern condition
  Parameters:
     ab_low_tol (float) 
     ab_up_tol (float) 
     bc_low_tol (float) 
     bc_up_tol (float) 
     cd_low_tol (float) 
     cd_up_tol (float) 
     ad_low_tol (float) 
     ad_up_tol (float) 
  Returns: bool
 bull_deep_crab(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, ad_low_tol, ad_up_tol) 
  bullish deep crab harmonic pattern condition
  Parameters:
     ab_low_tol (float) 
     ab_up_tol (float) 
     bc_low_tol (float) 
     bc_up_tol (float) 
     cd_low_tol (float) 
     cd_up_tol (float) 
     ad_low_tol (float) 
     ad_up_tol (float) 
  Returns: bool
 bear_cypher(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, xc_low_tol, xc_up_tol) 
  bearish cypher harmonic pattern condition
  Parameters:
     ab_low_tol (float) 
     ab_up_tol (float) 
     bc_low_tol (float) 
     bc_up_tol (float) 
     cd_low_tol (float) 
     cd_up_tol (float) 
     xc_low_tol (float) 
     xc_up_tol (float) 
  Returns: bool
 bull_cypher(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, xc_low_tol, xc_up_tol) 
  bullish cypher harmonic pattern condition
  Parameters:
     ab_low_tol (float) 
     ab_up_tol (float) 
     bc_low_tol (float) 
     bc_up_tol (float) 
     cd_low_tol (float) 
     cd_up_tol (float) 
     xc_low_tol (float) 
     xc_up_tol (float) 
  Returns: bool
 bear_gartley(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, ad_low_tol, ad_up_tol) 
  bearish gartley harmonic pattern condition
  Parameters:
     ab_low_tol (float) 
     ab_up_tol (float) 
     bc_low_tol (float) 
     bc_up_tol (float) 
     cd_low_tol (float) 
     cd_up_tol (float) 
     ad_low_tol (float) 
     ad_up_tol (float) 
  Returns: bool
 bull_gartley(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, ad_low_tol, ad_up_tol) 
  bullish gartley harmonic pattern condition
  Parameters:
     ab_low_tol (float) 
     ab_up_tol (float) 
     bc_low_tol (float) 
     bc_up_tol (float) 
     cd_low_tol (float) 
     cd_up_tol (float) 
     ad_low_tol (float) 
     ad_up_tol (float) 
  Returns: bool
 bear_shark(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, xc_low_tol, xc_up_tol) 
  bearish shark harmonic pattern condition
  Parameters:
     ab_low_tol (float) 
     ab_up_tol (float) 
     bc_low_tol (float) 
     bc_up_tol (float) 
     xc_low_tol (float) 
     xc_up_tol (float) 
  Returns: bool
 bull_shark(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, xc_low_tol, xc_up_tol) 
  bullish shark harmonic pattern condition
  Parameters:
     ab_low_tol (float) 
     ab_up_tol (float) 
     bc_low_tol (float) 
     bc_up_tol (float) 
     xc_low_tol (float) 
     xc_up_tol (float) 
  Returns: bool
 bear_three_drive(x1_low_tol, a1_low_tol, a1_up_tol, a2_low_tol, a2_up_tol, b2_low_tol, b2_up_tol, b3_low_tol, b3_upt_tol) 
  bearish three drive harmonic pattern condition
  Parameters:
     x1_low_tol (float) 
     a1_low_tol (float) 
     a1_up_tol (float) 
     a2_low_tol (float) 
     a2_up_tol (float) 
     b2_low_tol (float) 
     b2_up_tol (float) 
     b3_low_tol (float) 
     b3_upt_tol (float) 
  Returns: bool
 bull_three_drive(x1_low_tol, a1_low_tol, a1_up_tol, a2_low_tol, a2_up_tol, b2_low_tol, b2_up_tol, b3_low_tol, b3_upt_tol) 
  bullish three drive harmonic pattern condition
  Parameters:
     x1_low_tol (float) 
     a1_low_tol (float) 
     a1_up_tol (float) 
     a2_low_tol (float) 
     a2_up_tol (float) 
     b2_low_tol (float) 
     b2_up_tol (float) 
     b3_low_tol (float) 
     b3_upt_tol (float) 
  Returns: bool
 asc_broadening() 
  ascending broadening pattern condition
  Returns: bool
 broadening() 
  broadening pattern condition
  Returns: bool
 desc_broadening() 
  descending broadening pattern condition
  Returns: bool
 double_bot(low_tol, up_tol) 
  double bottom pattern condition
  Parameters:
     low_tol (float) 
     up_tol (float) 
  Returns: bool
 double_top(low_tol, up_tol) 
  double top pattern condition
  Parameters:
     low_tol (float) 
     up_tol (float) 
  Returns: bool
 triple_bot(low_tol, up_tol) 
  triple bottom pattern condition
  Parameters:
     low_tol (float) 
     up_tol (float) 
  Returns: bool
 triple_top(low_tol, up_tol) 
  triple top pattern condition
  Parameters:
     low_tol (float) 
     up_tol (float) 
  Returns: bool
 bear_elliot() 
  bearish elliot wave pattern condition
  Returns: bool
 bull_elliot() 
  bullish elliot wave pattern condition
  Returns: bool
 bear_alt_flag(ab_ratio, bc_ratio) 
  bearish alternate flag pattern condition
  Parameters:
     ab_ratio (float) 
     bc_ratio (float) 
  Returns: bool
 bull_alt_flag(ab_ratio, bc_ratio) 
  bullish alternate flag pattern condition
  Parameters:
     ab_ratio (float) 
     bc_ratio (float) 
  Returns: bool
 bear_flag(ab_ratio, bc_ratio, be_ratio) 
  bearish flag pattern condition
  Parameters:
     ab_ratio (float) 
     bc_ratio (float) 
     be_ratio (float) 
  Returns: bool
 bull_flag(ab_ratio, bc_ratio, be_ratio) 
  bullish flag pattern condition
  Parameters:
     ab_ratio (float) 
     bc_ratio (float) 
     be_ratio (float) 
  Returns: bool
 bear_asc_head_shoulders() 
  bearish ascending head and shoulders pattern condition
  Returns: bool
 bull_asc_head_shoulders() 
  bullish ascending head and shoulders pattern condition
  Returns: bool
 bear_desc_head_shoulders() 
  bearish descending head and shoulders pattern condition
  Returns: bool
 bull_desc_head_shoulders() 
  bullish descending head and shoulders pattern condition
  Returns: bool
 bear_head_shoulders() 
  bearish head and shoulders pattern condition
  Returns: bool
 bull_head_shoulders() 
  bullish head and shoulders pattern condition
  Returns: bool
 bear_pennant(ab_ratio, bc_ratio) 
  bearish pennant pattern condition
  Parameters:
     ab_ratio (float) 
     bc_ratio (float) 
  Returns: bool
 bull_pennant(ab_ratio, bc_ratio) 
  bullish pennant pattern condition
  Parameters:
     ab_ratio (float) 
     bc_ratio (float) 
  Returns: bool
 asc_wedge() 
  ascending wedge pattern condition
  Returns: bool
 desc_wedge() 
  descending wedge pattern condition
  Returns: bool
 wedge() 
  wedge pattern condition
  Returns: bool
PubLibTrendLibrary   "PubLibTrend" 
trend, multi-part trend, double trend and multi-part double trend conditions for indicator and strategy development
 rlut() 
  return line uptrend condition
  Returns: bool
 dt() 
  downtrend condition
  Returns: bool
 ut() 
  uptrend condition
  Returns: bool
 rldt() 
  return line downtrend condition
  Returns: bool
 dtop() 
  double top condition
  Returns: bool
 dbot() 
  double bottom condition
  Returns: bool
 rlut_1p() 
  1-part return line uptrend condition
  Returns: bool
 rlut_2p() 
  2-part return line uptrend condition
  Returns: bool
 rlut_3p() 
  3-part return line uptrend condition
  Returns: bool
 rlut_4p() 
  4-part return line uptrend condition
  Returns: bool
 rlut_5p() 
  5-part return line uptrend condition
  Returns: bool
 rlut_6p() 
  6-part return line uptrend condition
  Returns: bool
 rlut_7p() 
  7-part return line uptrend condition
  Returns: bool
 rlut_8p() 
  8-part return line uptrend condition
  Returns: bool
 rlut_9p() 
  9-part return line uptrend condition
  Returns: bool
 rlut_10p() 
  10-part return line uptrend condition
  Returns: bool
 rlut_11p() 
  11-part return line uptrend condition
  Returns: bool
 rlut_12p() 
  12-part return line uptrend condition
  Returns: bool
 rlut_13p() 
  13-part return line uptrend condition
  Returns: bool
 rlut_14p() 
  14-part return line uptrend condition
  Returns: bool
 rlut_15p() 
  15-part return line uptrend condition
  Returns: bool
 rlut_16p() 
  16-part return line uptrend condition
  Returns: bool
 rlut_17p() 
  17-part return line uptrend condition
  Returns: bool
 rlut_18p() 
  18-part return line uptrend condition
  Returns: bool
 rlut_19p() 
  19-part return line uptrend condition
  Returns: bool
 rlut_20p() 
  20-part return line uptrend condition
  Returns: bool
 rlut_21p() 
  21-part return line uptrend condition
  Returns: bool
 rlut_22p() 
  22-part return line uptrend condition
  Returns: bool
 rlut_23p() 
  23-part return line uptrend condition
  Returns: bool
 rlut_24p() 
  24-part return line uptrend condition
  Returns: bool
 rlut_25p() 
  25-part return line uptrend condition
  Returns: bool
 rlut_26p() 
  26-part return line uptrend condition
  Returns: bool
 rlut_27p() 
  27-part return line uptrend condition
  Returns: bool
 rlut_28p() 
  28-part return line uptrend condition
  Returns: bool
 rlut_29p() 
  29-part return line uptrend condition
  Returns: bool
 rlut_30p() 
  30-part return line uptrend condition
  Returns: bool
 dt_1p() 
  1-part downtrend condition
  Returns: bool
 dt_2p() 
  2-part downtrend condition
  Returns: bool
 dt_3p() 
  3-part downtrend condition
  Returns: bool
 dt_4p() 
  4-part downtrend condition
  Returns: bool
 dt_5p() 
  5-part downtrend condition
  Returns: bool
 dt_6p() 
  6-part downtrend condition
  Returns: bool
 dt_7p() 
  7-part downtrend condition
  Returns: bool
 dt_8p() 
  8-part downtrend condition
  Returns: bool
 dt_9p() 
  9-part downtrend condition
  Returns: bool
 dt_10p() 
  10-part downtrend condition
  Returns: bool
 dt_11p() 
  11-part downtrend condition
  Returns: bool
 dt_12p() 
  12-part downtrend condition
  Returns: bool
 dt_13p() 
  13-part downtrend condition
  Returns: bool
 dt_14p() 
  14-part downtrend condition
  Returns: bool
 dt_15p() 
  15-part downtrend condition
  Returns: bool
 dt_16p() 
  16-part downtrend condition
  Returns: bool
 dt_17p() 
  17-part downtrend condition
  Returns: bool
 dt_18p() 
  18-part downtrend condition
  Returns: bool
 dt_19p() 
  19-part downtrend condition
  Returns: bool
 dt_20p() 
  20-part downtrend condition
  Returns: bool
 dt_21p() 
  21-part downtrend condition
  Returns: bool
 dt_22p() 
  22-part downtrend condition
  Returns: bool
 dt_23p() 
  23-part downtrend condition
  Returns: bool
 dt_24p() 
  24-part downtrend condition
  Returns: bool
 dt_25p() 
  25-part downtrend condition
  Returns: bool
 dt_26p() 
  26-part downtrend condition
  Returns: bool
 dt_27p() 
  27-part downtrend condition
  Returns: bool
 dt_28p() 
  28-part downtrend condition
  Returns: bool
 dt_29p() 
  29-part downtrend condition
  Returns: bool
 dt_30p() 
  30-part downtrend condition
  Returns: bool
 ut_1p() 
  1-part uptrend condition
  Returns: bool
 ut_2p() 
  2-part uptrend condition
  Returns: bool
 ut_3p() 
  3-part uptrend condition
  Returns: bool
 ut_4p() 
  4-part uptrend condition
  Returns: bool
 ut_5p() 
  5-part uptrend condition
  Returns: bool
 ut_6p() 
  6-part uptrend condition
  Returns: bool
 ut_7p() 
  7-part uptrend condition
  Returns: bool
 ut_8p() 
  8-part uptrend condition
  Returns: bool
 ut_9p() 
  9-part uptrend condition
  Returns: bool
 ut_10p() 
  10-part uptrend condition
  Returns: bool
 ut_11p() 
  11-part uptrend condition
  Returns: bool
 ut_12p() 
  12-part uptrend condition
  Returns: bool
 ut_13p() 
  13-part uptrend condition
  Returns: bool
 ut_14p() 
  14-part uptrend condition
  Returns: bool
 ut_15p() 
  15-part uptrend condition
  Returns: bool
 ut_16p() 
  16-part uptrend condition
  Returns: bool
 ut_17p() 
  17-part uptrend condition
  Returns: bool
 ut_18p() 
  18-part uptrend condition
  Returns: bool
 ut_19p() 
  19-part uptrend condition
  Returns: bool
 ut_20p() 
  20-part uptrend condition
  Returns: bool
 ut_21p() 
  21-part uptrend condition
  Returns: bool
 ut_22p() 
  22-part uptrend condition
  Returns: bool
 ut_23p() 
  23-part uptrend condition
  Returns: bool
 ut_24p() 
  24-part uptrend condition
  Returns: bool
 ut_25p() 
  25-part uptrend condition
  Returns: bool
 ut_26p() 
  26-part uptrend condition
  Returns: bool
 ut_27p() 
  27-part uptrend condition
  Returns: bool
 ut_28p() 
  28-part uptrend condition
  Returns: bool
 ut_29p() 
  29-part uptrend condition
  Returns: bool
 ut_30p() 
  30-part uptrend condition
  Returns: bool
 rldt_1p() 
  1-part return line downtrend condition
  Returns: bool
 rldt_2p() 
  2-part return line downtrend condition
  Returns: bool
 rldt_3p() 
  3-part return line downtrend condition
  Returns: bool
 rldt_4p() 
  4-part return line downtrend condition
  Returns: bool
 rldt_5p() 
  5-part return line downtrend condition
  Returns: bool
 rldt_6p() 
  6-part return line downtrend condition
  Returns: bool
 rldt_7p() 
  7-part return line downtrend condition
  Returns: bool
 rldt_8p() 
  8-part return line downtrend condition
  Returns: bool
 rldt_9p() 
  9-part return line downtrend condition
  Returns: bool
 rldt_10p() 
  10-part return line downtrend condition
  Returns: bool
 rldt_11p() 
  11-part return line downtrend condition
  Returns: bool
 rldt_12p() 
  12-part return line downtrend condition
  Returns: bool
 rldt_13p() 
  13-part return line downtrend condition
  Returns: bool
 rldt_14p() 
  14-part return line downtrend condition
  Returns: bool
 rldt_15p() 
  15-part return line downtrend condition
  Returns: bool
 rldt_16p() 
  16-part return line downtrend condition
  Returns: bool
 rldt_17p() 
  17-part return line downtrend condition
  Returns: bool
 rldt_18p() 
  18-part return line downtrend condition
  Returns: bool
 rldt_19p() 
  19-part return line downtrend condition
  Returns: bool
 rldt_20p() 
  20-part return line downtrend condition
  Returns: bool
 rldt_21p() 
  21-part return line downtrend condition
  Returns: bool
 rldt_22p() 
  22-part return line downtrend condition
  Returns: bool
 rldt_23p() 
  23-part return line downtrend condition
  Returns: bool
 rldt_24p() 
  24-part return line downtrend condition
  Returns: bool
 rldt_25p() 
  25-part return line downtrend condition
  Returns: bool
 rldt_26p() 
  26-part return line downtrend condition
  Returns: bool
 rldt_27p() 
  27-part return line downtrend condition
  Returns: bool
 rldt_28p() 
  28-part return line downtrend condition
  Returns: bool
 rldt_29p() 
  29-part return line downtrend condition
  Returns: bool
 rldt_30p() 
  30-part return line downtrend condition
  Returns: bool
 dut() 
  double uptrend condition
  Returns: bool
 ddt() 
  double downtrend condition
  Returns: bool
 dut_1p() 
  1-part double uptrend condition
  Returns: bool
 dut_2p() 
  2-part double uptrend condition
  Returns: bool
 dut_3p() 
  3-part double uptrend condition
  Returns: bool
 dut_4p() 
  4-part double uptrend condition
  Returns: bool
 dut_5p() 
  5-part double uptrend condition
  Returns: bool
 dut_6p() 
  6-part double uptrend condition
  Returns: bool
 dut_7p() 
  7-part double uptrend condition
  Returns: bool
 dut_8p() 
  8-part double uptrend condition
  Returns: bool
 dut_9p() 
  9-part double uptrend condition
  Returns: bool
 dut_10p() 
  10-part double uptrend condition
  Returns: bool
 dut_11p() 
  11-part double uptrend condition
  Returns: bool
 dut_12p() 
  12-part double uptrend condition
  Returns: bool
 dut_13p() 
  13-part double uptrend condition
  Returns: bool
 dut_14p() 
  14-part double uptrend condition
  Returns: bool
 dut_15p() 
  15-part double uptrend condition
  Returns: bool
 dut_16p() 
  16-part double uptrend condition
  Returns: bool
 dut_17p() 
  17-part double uptrend condition
  Returns: bool
 dut_18p() 
  18-part double uptrend condition
  Returns: bool
 dut_19p() 
  19-part double uptrend condition
  Returns: bool
 dut_20p() 
  20-part double uptrend condition
  Returns: bool
 dut_21p() 
  21-part double uptrend condition
  Returns: bool
 dut_22p() 
  22-part double uptrend condition
  Returns: bool
 dut_23p() 
  23-part double uptrend condition
  Returns: bool
 dut_24p() 
  24-part double uptrend condition
  Returns: bool
 dut_25p() 
  25-part double uptrend condition
  Returns: bool
 dut_26p() 
  26-part double uptrend condition
  Returns: bool
 dut_27p() 
  27-part double uptrend condition
  Returns: bool
 dut_28p() 
  28-part double uptrend condition
  Returns: bool
 dut_29p() 
  29-part double uptrend condition
  Returns: bool
 dut_30p() 
  30-part double uptrend condition
  Returns: bool
 ddt_1p() 
  1-part double downtrend condition
  Returns: bool
 ddt_2p() 
  2-part double downtrend condition
  Returns: bool
 ddt_3p() 
  3-part double downtrend condition
  Returns: bool
 ddt_4p() 
  4-part double downtrend condition
  Returns: bool
 ddt_5p() 
  5-part double downtrend condition
  Returns: bool
 ddt_6p() 
  6-part double downtrend condition
  Returns: bool
 ddt_7p() 
  7-part double downtrend condition
  Returns: bool
 ddt_8p() 
  8-part double downtrend condition
  Returns: bool
 ddt_9p() 
  9-part double downtrend condition
  Returns: bool
 ddt_10p() 
  10-part double downtrend condition
  Returns: bool
 ddt_11p() 
  11-part double downtrend condition
  Returns: bool
 ddt_12p() 
  12-part double downtrend condition
  Returns: bool
 ddt_13p() 
  13-part double downtrend condition
  Returns: bool
 ddt_14p() 
  14-part double downtrend condition
  Returns: bool
 ddt_15p() 
  15-part double downtrend condition
  Returns: bool
 ddt_16p() 
  16-part double downtrend condition
  Returns: bool
 ddt_17p() 
  17-part double downtrend condition
  Returns: bool
 ddt_18p() 
  18-part double downtrend condition
  Returns: bool
 ddt_19p() 
  19-part double downtrend condition
  Returns: bool
 ddt_20p() 
  20-part double downtrend condition
  Returns: bool
 ddt_21p() 
  21-part double downtrend condition
  Returns: bool
 ddt_22p() 
  22-part double downtrend condition
  Returns: bool
 ddt_23p() 
  23-part double downtrend condition
  Returns: bool
 ddt_24p() 
  24-part double downtrend condition
  Returns: bool
 ddt_25p() 
  25-part double downtrend condition
  Returns: bool
 ddt_26p() 
  26-part double downtrend condition
  Returns: bool
 ddt_27p() 
  27-part double downtrend condition
  Returns: bool
 ddt_28p() 
  28-part double downtrend condition
  Returns: bool
 ddt_29p() 
  29-part double downtrend condition
  Returns: bool
 ddt_30p() 
  30-part double downtrend condition
  Returns: bool






















