INVITE-ONLY SCRIPT

Liquidity Trading Algorithm (LTA)


The Liquidity Trading Algorithm is an algorithm designed to provide trade signals based on
liquidity conditions in the market. The underlying algorithm is based on the Liquidity
Dependent Price Movement (LDPM) metric and the Liquidity Dependent Price Stability (LDPS)
algorithm.

Together, LDPM and LDPS demonstrate statistically significant forecasting capabilities for price-
action on equities, cryptocurrencies, and futures. LTA takes these liquidity measurements and
translates them into actionable insights by way of entering or exiting a position based
on the future outlooks, as measured by the current liquidity status.

The benefit of LTA is that it can incorporate these powerful liquidity measurements into
actionable insights with several features designed to help you tailor LTA's behavior and
measurements to your desired vantage point. These customizable features come by the way of determining LTA's assessment style, and additional monitoring systems for avoiding bear and bull traps, along with various other quality of life features, discussed in more detail below.

First, a few quick facts:

- LTA is compatible on a wide array of instruments, including Equities, Futures, Cryptocurrencies, and Forex.
- LTA is compatible on most intervals in so long as the data can be calculated appropriately,
(be sure to do a backtest on timescales less than 1-minue to ensure the data can be computed).
- LTA only measures liquidity at the end of the interval of the chart chosen, and does not respond to conditions during the candle interval, unless specified (such as with `Stops`).
- LTA is interval-dependent, this means it will measure and behave differently on different
intervals as the underlying algorithms are dependent on the interval chosen.
- LTA can utilize fractional share sizing for cryptocurrencies.
- LTA can be restricted to either bullish or bearish indications.
- Additional Monitoring Systems are available for additional risk mitigation.

In short, LTA is a widely applicable, unique algorithm designed to translate liquidity measurements into liquidity insights.

Before getting more into the details, here is a quick list of the main features and settings
available for customization:
- Backtesting Start Date: Manual selection of the start date for the algorithm during backtesting.
- Assessment Style: adjust how LDPM and LDPS measure and respond to changes in liquidity.
- Impose Wait: force LTA to wait before entering or exiting a position to ensure conditions have remained conducive.
- Trade Direction Allowance: Restrict LTA to only long or only short, if desired.
- Position Sizing Method: determine how LTA calculates position sizing.
- Fractional Share Sizing: allow LTA to calculate fractional share sizes for cryptocurrencies
- Max Size Limit: Impose a maximum size on LTA's positions.
- Initial Capital: Indicate how much capital LTA should stat with.
- Portfolio Allotment: Indicate to LTA how much (in percentages) of the available balance should be considered when calculating position size.
- Enact Additional Monitoring Systems: Indicate if LTA should impose additional safety criteria when monitoring liquidity.
- Configure Take Profit, Stop-Loss, Trailing Stop Loss
- Display Information tables on the current position, overall strategy performance, along
with a text output showing LTA's processes.
- Real-time text output and updates on LTA's inner workings.

Let's get into some more of the details.

LTA's Assessment Style

LTA's assessment style determines how LTA collects and responds to changing data. In traditional terms, this is akin to (but not quite exactly the same as) the sensitivity versus specificity spectrum, whereby on one end (the sensitive end), an algorithm responds to changes in data in a reactive manner (which tends to lower its specificity, or how often it is correct in its indications), and on the other end, the opposite one, the algorithm foresakes quick changes for longevity of outlook.

While this is in part true, it is not a full view of the underlying mechanisms that changing the assessment style augments. A better analogy would be that the sensitive end of the spectrum (`Aggressive`) is in a state such that the algorithm wants to changing its outlooks, and as such, with changes in data, the algorithm has to be convinced as to why that is not a good idea to change outlooks, whereas the the more specific states (`Conservative`, `Diamond`) must be convinced that their view is no longer valid and that it needs to be changed.

This means the `Aggressive` and the `Diamond` settings fundamentally differ not just in their
data collection, but also in the data processing such that the `Aggressive` decision tree has to
be convinced that the data [/bold] is [/bold] the same (as its defualt is that it has changed),
and the `Diamond` decision tree has to be convinced that the data [/bold] is not [/bold] the same, and as such, the outlook need changed.

From there, the algorithm cooks through the data and determines to what the outlook should be changed to, given the current state of liquidity.

`Balanced` lies in the middle of this balance, attempting to balance being open to new ideas while not removing the wisdom of the past, as it were.

On a scale of most `sensitive` to most `specific`, it is as follows: `Aggressive`, `Balanced`,
`Conservative`, `Diamond`.

Functionally, these different modes can help in different liquidity environments, as certain
environments are more conducive to an eager approach (such as found near `Aggressive`) or are more conducive to a more conservative approach, where sudden changes in liquidity are known to be short-lived and unremarkable (such as many previously identified bull or bear traps).

For instance, on low interval views, it can often-times be beneficial to keep the algorithm towards the `Sensitive` end, since on the lower-timeframes, the crosswinds can change quite dramatically; whereas on the longer intervals, it may be useful to maintain a more `Specific` algorithm (such as found near `Diamond` mode) setting since longer intervals typically lend themselves to longer time-horizons, which themselves typically lend themselves to "weathering the storm", as it were.

LTA's Assessment Style is also supported by the Additional Monitoring Systems which works
to add sensitivity without sacrificing specificity by enacting a separate monitoring system, as described below.

Additional Monitoring Systems

The Additional Monitoring System (AMS) attempts to add more context to any changes in liquidity conditions as measured, such that LTA as a whole will have an expanded view into any rapidly changing liquidity conditions before these changes manifest in the traditional data streams. The ideal is that this allows for early exits or early entrances to positions "a head of time".

The traditional use of this system is to indicate when liquidity is suggestive of the end of a particular run (be it a bear run or a bull run), so an early exit can be initiated (and thus,
downside averted) even before the data officially showcase such changes. In such cases (when AMS becomes activated), the algorithm will signal to exit any open positions, and will restrict the opening of any new positions.

When a position is exited because of AMS, it is denoted as an `Early Exit` and if a position is prevented from being entered, the text output will display `AM prevented entry...` to indicate that conditions are not meeting AMS' additional standards.

The algorithm will wait to make any actions while `AMS` is `active` and will only enter into a new position once `AMS` has been `deactivated` and overall liquidity conditions are appropriate.

Functionally, the benefits of AMS translate to:
- Toggeling AMS on will typically see a net reduction in overall profitability, but
- AMS will typically (almost always) reduce max drawdown,
an increases in max runup, and increase return-over-maxdrawdown, and
- AMS can provide benefit for equities that experience a lot of "traps" by navigating early
entrance and early exits.

So in short, AMS is way of adding an additional level of liquidity monitoring that attempts to
exit positions if conditions look to be deteriorating, and to enter conditions if they look to be
improving. The cost of this additional monitoring, however, is a greater number of trades indicated, and a lower overall profitability.

Impose Wait

Note: `Impose Wait` will not force Take Profit, Stop Loss, or Trailing Stop Loss to
wait.

LTA can be indicated to `wait` before entering or exiting a position if desired. This means that if conditions change, whereas without a `wait` imposed, the algorithm would immediately indicate this change via a signal to alter the strategy's position, with a `wait` imposed, the algorithm will `wait` the indicated number of bars, and then re-check conditions before proceeding.

If, while waiting, conditions change to a state that is no longer compatible with the "order-in-
waiting", then the order-in-waiting is removed, and the counts reset (i.e.: conditions must remain favorable to the intended positional change throughout the wait period).

Since LTA works at the end-of-intervals, there is an inherently "built-in" wait of 1 bar when
switching directly from long to short (i.e.: if a full switch is indicated, then it is indicated as
conditions change -> exit new position <new candle starts> -> wait until -> check conditions ->
enter new position as indicated). Thus, to impose a wait of `1 bar` would be to effectively have a total of two candles' ends prior to the entrance of the new position).

There are two main styles of `Impose Wait` that you can utilize:

- `Wait` : this mode will cause LTA to `wait` when both entering and exiting a position (in so long as it is not an exit signaled via a Take Profit, Stop Loss or Trailing Stop Loss).
- `Exit-Wait` : This mode will >not< cause LTA to `wait` if conditions require the closing of a position, but will force LTA to wait before entering into a position.

Position:

In addition to the availability to restrict LTA to either a long-only or short-only strategy, LTA
also comprises additional flexibility when deciding on how it should navigate the markets with
regards to sizing. Notably, this flexibility benefits several aspects of LTA's existence, namely the ability to determine the `Sizing Method`, or if `Fractional Share Sizing` should be employed, and more, as discussed below.

Position Sizing Method

There are two main ways LTA can determine the size of a position. Either via the `Fixed-Share` choice, or the `Fixed-Percentage` choice.

- `Fixed-Share` will use the amount indicated in the `Max Sizing Limit` field as the position size, always.
Note: With `Fixed-Share` sizing, LTA will >not< check if the balance is sufficient
prior to signaling an entrance.

- `Fixed-Percentage` will use the percentage amount indicated in the `Portfolio Allotment` field as the percentage of available funds to use when calculating the position size. Additionally, with the `Fixed-Percentage` choice, you can set the `Max Sizing Limit` if desired, which will ensure that no position will be entered greater than the amount indicated in the field.

Fractional Share Sizing

If the underlying instrument supports it (typically only cryptocurrencies), share sizing can be
fractionalized. If this is done, the resulting positin size is rounded to `4 digits`. This means any
position with a size less than `0.00005` will be rounded to `0.0000`

Note: Ensure that the underlying instrument supports fractional share sizing prior
to initiating.

Max Sizing Limit
As discussed above, the `Max Sizing Limit` will determine:

- The position size for every position, if `Sizing Method : Fixed-Share` is utilized, or
- The maximum allowed size, regardless of available capital, if `Sizing Method : Fixed-Percentage` is utilized.

Note: There is an internal maximum of 100,000 units.

Initial Capital

Note: There are 2 `Initial Capital` settings; one in LTA's settings and one in the
`Properties` tab. Ensure these two are the same when doing backtesting.

The initial capital field will be used to determine the starting balanace of the strategy, and
is used to calculate the internal data reporting (the data tables).

Portfolio Allotment

You can specify how much of the total available balance should be used when calculating the share size. The default is 100%.

Stops

Note: Stops over-ride `AMS` and `Impose Wait`, and are not restricted to only the
end-of-candle and will occur instantaneously upon their activation. Neither `AMS` nor `Impose Wait` can over-ride a signal from a `Take-Profit`, `Stop-Loss`, or a `Trailing-Stop Loss`.

LTA enhouses three stops that can be configured, a `Take-Profit`, a `Stop-Loss` and a `Trailing-Stop Loss`. The configurations can be set in the settings in percent terms. These exit signals will always over-ride AMS or any other restrictions on position exit.

Their configuration is rather standard; set the percentages you want the signal to be sent at and so it will be done.

Some quick notes on the `Trailing-Stop Loss`:
- The activation percentage must be reached (in profits) prior to the `Traililng-Stop Loss`
from activating the downside protection. For example, if the `Activation Percentage` is 10%, then unless the position reaches (at any point) a 10% profit, then it will not signal any exits on the downside, should it occur.
- The downside price-point is continuously updated and is calculated from the maximum profit reached in the given position and the loss percentage placed in the appropriate field.

Data Tables and Data Output

LTA provides real-time data output through a variety of mechanisms:

- `Position Table`
The `Position Table` displays information about the current position, including:
> Position Duration : how long the position has been open for.
> Indicates if the side is Long or Short, depending on if it is long or short.
> Entry Price: the price the position was entered at.
> Current Price (% Dif): the current price of the underlying and the %-difference between the entry price and the current price.
> Max Profit ($/%): the maximum profit reached in $ and % terms.
> Current PnL ($/%) : the current PnL for the open position.

- `Performance Table`
The `Performance Table` displays information regarding the overall performance of the algorithm since its `Start Date`. These data include:
> Initial Equity ($): The initial equity the algorithm started with.
> Current Equity ($): The current total equity of the account (including open positions)
> Net Profits ($|%) : The overall net profit in $ and % terms.
> Long / Short Trade Counts: The respective trade counts for the positions entered.
> Total Closed Trades: The running sum of the number of trades closed.
> Profitability: The calculation of the number of profitable trades over the total number of
trades.
> Avg. Profit / Trade: The calculation of the average profit per trade in both $ and % terms.
> Avg. Loss / Trade: The calculation of the average loss per trade in both $ and % terms.
> Max Run-Up: The maximum run-up the algorithm has seen in both $ and % terms.
> Max Drawdown: The maximum draw-down the algorithm has seen in both $ and % terms.
> Return-Over-Max-Drawdown: the ratio of the maximum drawdown against the current net profits.

- `Text Output`
LTA will output, if desired, signals to the text output field every time it analysis or performs and action. These messages can include information such as:

"
08:00:00 >> AM Protocol activated ... exiting position ...
08:00:00 >> Exit Order Created for qty: 2, profit: 380 (4.34%)
...
09:30:00 >> Checking conditions ...
09:30:00 >> AM protocol prevented entry ... waiting ...
"
This way, you can keep an eye out on what is happening "under the hood", as it were.
LTA will produce a message at the end of its assessment at the end of each candle interval, as well as when a position is exited due to a `Stop` or due to `AMS` being activated.

Additionally, the `Text Output` includes a initial message, but for space-constraints, this
can be toggled off with the `Blank Text Output` option within LTA's configurations.


For additional information, please refer to the Author's Instructions below.

Clause de non-responsabilité