GUIDES
Getting Started
Overview (LeafAlgo and TradingView)
LeafAlgo is dedicated to the consistent development of cutting-edge trading strategies and indicators for both discretionary and algorithmic traders. This is done through the widely used trading platform known as TradingView (www.tradingview.com). Currently, we offer three premium, invite-only strategies, and three premium, invite-only indicators, with more of each in various stages of development.
Additionally, we have a free suite of several less-intricate indicators and strategies available to the public. Everything can be found on our TradingView user page (https://www.tradingview.com/u/LeafAlgo/
#published-scripts).
Pro, Pro+, or Premium TradingView memberships are NOT required to access our indicators and strategies,
however, certain elements of our strategies can be optimized with Pro+ or Premium access. This includes the
“bar magnifier” function, “deep backtesting”, and unlimited TradingView alert lengths, among other quality of
life upgrades. All discretionary trading can be accomplished without these functions, however, algorithmic
trading through certain extensions will require Pro or higher.
Although our strategies are optimized for the cryptocurrency markets, forex and other traditional markets are
still viable, especially for discretionary methods
For more information, we also host a Discord community (https://discord.gg/rNQ2QW59Pn) for all
discussions regarding trading as well as help with understanding and implementing algorithmic and
discretionary methods utilizing our suite of indicators and strategies
Our current premium indicators can be found on TradingView as “LeafAgo Pro”, “Consensus Tables – Oscillators, Multi-MA, DFMA, and Ichimoku” and “Donchian Cloud Score w/ Table”.
The LeafAlgo Pro utilizes signals generated from a normalized consensus of one of the four following consensus strategies: Oscillator Consensus, Moving Average Consensus, Democratic Fib Consensus, and an Ichimoku Cloud Consensus. When the values of the individual consensus are normalized, they can be utilized as an oscillator with a range of 0-100. The range of 0-100 can be broken down into zones where if the oscillator breaks through the different thresholds and meets the directional filter requirements, a signal is generated for strong buy, buy, sell, and strong sell with respect to which underlying threshold is breached.
Oscillator:
The Oscillator setting consists of the Average Directional Index (ADX) set as a value instead of +/- and is not used in the scoring to gather consensus. Rather, a value of 25 or above is used to confirm the trend regardless of positive or negative. The Chande Momentum Oscillator (CMO), Detrended Price Oscillator (DPO), Momentum, Rate of Change (ROC), Relative Strength Index (RSI), True Strength Index (TSI), and Volume Oscillator are used in the Oscillator table for a consensus value and given a + or – depending on the condition being met. The conditions and weighting are as follows:
— CMO > or < 0, given a weight of +/- 2
— DPO > or < 0, given a weight of +/- 2
— Momentum > or < 0, given a weight of +/- 2
— ROC > or < 0, given a weight of +/- 2
— RSI > or < 50, given a weight of +/- 1
— TSI Value Line > or < 0, given a weight of +/- 1
— TSI Signal Line > or < 0, given a weight of +/- 1
— Volume Osc. > or < 0, given a weight of +/- 2
Moving Average:
For the Moving Average Ribbon/Multi-MA setting the user is able to determine the type of MA for 11 moving averages. The type selection consists of EMA, DEMA, TEMA, SMA, RMA, VWMA, WMA, SMMA, and a Hull MA. The preset values for the 11 moving averages are 5, 7, 10, 14, 21, 26, 50, 75, 100, 150, and 200. The consensus conditions and weighting are as follows:
— If MA(1 through 10) < or > the price source, given a weight of +/- 1
— If MA(11) < or > the price source, given a weight of +/- 2
DFMA:
The Democratic Fibonacci Moving Average setting is derived from our indicator of the same name. The source for the DFMA can be chosen by the user, but the SMA lengths are predetermined in Fibonacci intervals from 3 to 233. The DFMA line itself is determined by finding the average value of these 10 Fibonacci MA lengths. The consensus conditions and weighting are as follows:
— If Fib. MA (3-233) < or > the source, given a weight of +/- 1
— If DFMA value < or > the source, given a weight of +/- 2.
Ichimoku:
The Ichimoku setting values a handful of conditions using the Tenkan-sen/Conversion Line, Kijun-sen/Base Line, Senkou-span A and B, and the Chikou-span, each of which are given their standard values of 9, 26, 52, and 26, respectively, but can be changed in the user settings if desired. As opposed to the other tables, there are fewer conditions to be met and given values to. All of the conditions are given the same weighting (+/- 1). The conditions are as follows:
— Kijun-sen < or > the source
— Tenkan-sen < or > the source
— Kijun-sen > or < the Chikou-span
— Tenkan-sen > or < the Kijou-sen
— Senkou Span A > or < Senkou Span B
Dynamic Bar Coloring
The bar coloring is based on the values of the underlying consensus oscillator.
— If the consensus value >= 75 coloring= “Lime”
— If the consensus value is between 55 and 70, coloring= “Green”
— If the consensus value is between 45 and 55, coloring= “Yellow”
— If the consensus value is between 30 and 45, coloring= “Orange”
— If consensus value is <= 30, coloring= “Red”
Regression Channels
The visible channel utilizes a basis line of a quadratic regression line. The quadratic regression is well suited for determining (and predicting) trends. Calculating the regression involves five summation equations that utilize the bar index (x1), the price source (defaulted to ohlc4), the desired length, and the square of x1. Determining the coefficient values requires an additional step that factors in the simple moving average of the source, bar index, and squared bar index. The envelopes that are formed around the regression line are a multiple of that regression line using the high/low range of the price. This envelope can be used to determine points of interest where the price may break through, consolidate at, or reverse from. The channels should be used in conjunction with the signals generated to determine if the signal is valid.
Note past performance is not indicative of future results. This is meant to be used as a tool, and the signals generated by this script should be confirmed with other technical analysis.
Release Notes:
-Added a secondary channel setting to include an Adaptive Gaussian Channel. This channel is made using a adaptive gaussian moving average (AGMA) as the basis and creating deviation channels around that basis. This channel can be a great tool for identifying overbought and oversold conditions as seen below.
Consensus Tables
This indicator is a series of underlaid tables that determine a consensus value using a simple positive or negative score for a set signal. This consensus value is also shown as a histogram and reflected on the chart’s bar colors. There are a total of four different table options to choose from: a set of trend and volume oscillators, a set of 11 moving averages, a set of Fibonacci moving averages and their own consensus line, and a set of Ichimoku-based conditions. The type of table can be chosen from a drop-down menu at the top of the user settings, with settings for each of the table types grouped up respectively.
Oscillator Table
The Oscillator table consists of the Average Directional Index (ADX) set as a value instead of +/- and is not
used in the scoring to gather consensus. Rather, a value of 25 or above is used to confirm the trend regardless
of positive or negative. The Chande Momentum Oscillator (CMO), Detrended Price Oscillator (DPO),
Momentum, Rate of Change (ROC), Relative Strength Index (RSI), True Strength Index (TSI), and Volume
Oscillator are used in the Oscillator table for a consensus value and given a + or – depending on the condition
being met. The conditions and weighting are as follows:
— CMO > or < 0, given a weight of +/- 2
— DPO > or < 0, given a weight of +/- 2
— Momentum > or < 0, given a weight of +/- 2
— ROC > or < 0, given a weight of +/- 2
— RSI > or < 50, given a weight of +/- 1
— TSI Value Line > or < 0, given a weight of +/- 1
— TSI Signal Line > or < 0, given a weight of +/- 1
— Volume Osc. > or < 0, given a weight of +/- 2
The consensus value is determined by adding these values together and dividing by 13.
Multi-MA Table
For the Moving Average Ribbon/ Multi-MA table the user can determine the source, type, and lengths of 11
moving averages. The type of selection consists of EMA, DEMA, TEMA, SMA, RMA, VWMA, WMA,
SMMA, and a Hull MA. The preset values for the 11 moving averages are 5, 7, 10, 14, 21, 26, 50, 75, 100,
150, and 200. The consensus conditions and weighting are as follows:
— If MA(1 through 10) < or > the price source, given a weight of +/- 1
— If MA(11) < or > the price source, given a weight of +/- 2
The consensus value is determined by adding these values together and dividing them by 12.
DFMA Table
The Democratic Fibonacci Moving Average table is derived from our indicator of the same name. The source
for the DFMA can be chosen by the user, but the SMA lengths are predetermined in Fibonacci intervals from 3
to 233. The DFMA line itself is determined by finding the average value of these 10 Fibonacci MA lengths.
The consensus conditions and weighting are as follows:
— If Fib. MA (3-233) < or > the source, given a weight of +/- 1
— If DFMA value < or > the source, given a weight of +/- 2
The consensus value is determined by adding these values together and dividing by 12.
Ichimoku Table
The Ichimoku table values a handful of conditions using the Tenkan-sen/Conversion Line, Kijun-sen/Base
Line, Senkou-span A and B, and the Chikou-span, each of which are given their standard values of 9, 26, 52,
and 26, respectively, but can be changed in the user settings if desired. As opposed to the other tables, there are
fewer conditions to be met and given values to. All of the conditions are given the same weighting (+/- 1). The
conditions are as follows:
— Kijun-sen < or > the source
— Tenkan-sen < or > the source
— Kijun-sen > or < the Chikou-span
— Tenkan-sen > or < the Kijou-sen
— Senkou Span A > or < Senkou Span B
The consensus value is determined by dividing the total value by 5.
Understanding The Consensus Table
Overall consensus and overall trend values are given alongside each of these options. The overall consensus
value is determined by taking the average of the 4 respective consensus values. Trend values are determined as
such:
— If consensus value >= 0.75, considered a “Strong Buy”
— If consensus value is between 0.25 and 0.75, considered a “Buy”
— If consensus value is between 0.25 and -0.25, considered “Neutral”
— If consensus value is between -0.25 and -0.75, considered a “Sell”
— If consensus value is <= -0.75, considered a “Strong Sell”
Table colors are set as either green, red, or gray to reflect positive, negative, and neutral sentiment. Bar colors
reflect the consensus value and the determined table trend:
— If trend for the chosen table is “Strong Buy”, bar color is green
— If trend for the chosen table is “Buy”, bar color is lime
— If trend for the chosen table is “Neutral”, bar color is gray
— If trend for the chosen table is “Sell”, bar color is orange
— If trend for the chosen table is “Strong Sell”, bar color is red
A normalized z-score on a scale of –1 to +1 has been introduced across all four tables. The z-score is plotted as
a white histogram against the consensus score and is reflected in the bar color in the price chart (neutral
between –0.25 and 0.25, red under –0.25, and green above 0.25).
The Donchian Cloud contains a set of 5 Donchian channels (upper, lower, and basis plotted) defaulted to lengths of 25, 50, 100, 150, and 200. A set of conditions associated with the channels aims to determine ranging versus trending markets. Weights are given to these conditions accordingly, then tallied up to determine the “cloud score”, ranging between -25 and 25. For the purposes of this indicator, a ranging market is determined by a cloud score between -10 and 10, while a positive trending market has a score higher than 10 and a negative trending market has a score lower than -10. This score is accompanied by altered bar color to reflect the score – gray for ranging markets, green for positive trending markets, and red for negative trending markets. Breaking of upper or lower Donchian bands is typically a good indication of a potential breakout. Having a weighted system for these conditions will provide more insight and layers of confirmation into a Donchian breakout trading strategy. The table will reflect these values through positive, negative, and neutral coloration.
The list of conditions and their associated weights for this indicator are as follows:
– Broke the 25-length DC (DC(25)) upper band in the previous 3 bars – +1 if true, 0 if false
– Broke the DC(50) upper band in the previous 3 bars – +2 if true, 0 if false
– Broke the DC(100) upper band in the previous 3 bars – +3 if true, 0 if false
– Broke the DC(150) upper band in the previous 3 bars – +4 if true, 0 if false
– Broke the DC(200) upper band in the previous 3 bars – +5 if true, 0 if false
– Broke the DC(25) lower band in the previous 3 bars – -1 if true, 0 if false
– Broke the DC(50) lower band in the previous 3 bars – -2 if true, 0 if false
– Broke the DC(100) lower band in the previous 3 bars – -3 if true, 0 if false
– Broke the DC(150) lower band in the previous 3 bars – -4 if true, 0 if false
– Broke the DC(200) lower band in the previous 3 bars – -5 if true, 0 if false
– DC(25) basis line above the DC(50) basis line – +1 if true, -1 if false
– DC(25) basis line above the DC(100) basis line – +1 if true, -1 if false
– DC(25)basis line above the DC(150) basis line – +1 if true, -1 if false
– DC(25) basis line above the DC(200) basis line – +1 if true, -1 if false
– DC(50) basis line above the DC(100) basis line – +1 if true, -1 if false
– DC(50) basis line above the DC(150) basis line – +1 if true, -1 if false
– DC(50) basis line above the DC(200) basis line – +1 if true, -1 if false
– DC(100) basis line above the DC(150) basis line – +1 if true, -1 if false
– DC(100) basis line above the DC(200) basis line – +1 if true, -1 if false
– DC(150) basis line above the DC(200) basis line – +1 if true, -1 if false
Release Notes:
Release Notes:
Added a plotcandle() function in addition to the barcolor() function. To see the candle coloration properly, ensure that the indicator is “brought to front”.
Colors changed as well. Instead of green for above a score of 10, red below a score of -10, and grey in-between, the colors are now:
– Score >= 10 –> Lime
– Score between 7 and 10 –> Green
– Score between 7 and -7 –> Gray
– Score between -7 and -10 –> Orange
– Score <= -10 –> Red
Release Notes:
– Removed the barcolor() option and replaced with the plotcandle() function
– Added in a volume profile range in which the user can view a breakdown of volume across the previous x number of bars as a histogram with y number of sections. The number of bars back, the number of histogram sections, and the size of the histogram can be set individually.
Release Notes: Reduced number of bars back in default (250 from 300).
Our current premium strategies can be found on TradingView as “The Flower – Multiple Strategy Options in One”, “Macro Score – User-Customized Scores and Signals”, and “LeafAlgo Premium Macro Strategies”.
This strategy contains SIX different macro score strategies — “Base DFMA”, “Base DFMG”, “Ichimoku”, “TSI”, “Donchian DFMA”, and “Donchian DFMG”. These strategies have the signals and weights pre-determined in the code. The “Base DFMA” strategy is based on our Democratic Fibonacci Moving Average (DFMA) indicator; the “Donchian DFMA” is the same as the base DFMA strategy, but with a signal from our Donchian Cloud Score indicator as added confluence. The “Base DFMG” strategy is based on our Democratic Fibonacci McGinley Dynamics (DFMG) indicator; the “Donchian DFMG” is the same, but with the Donchian Cloud Score as added confluence. The “Ichimoku” strategy is based on the major sub-indicators found within an Ichimoku Cloud in addition to our Donchian Cloud Score. The “TSI” strategy is based on the True Strength Index.
The ability to select your strategy of choice can be found at the top of the strategy settings under “Strategy Options”, then in the drop-down menu labeled “Strategy Choice”.
The DFMA – Democratic Fibonacci Moving Average – is a separate indicator that we have released that takes 10 different Fibonacci MAs (lengths of 3 to 233, at Fibonacci intervals) and averages them to form the DFMA line. This helps by creating a consensus on the trend based on moving averages alone. Crossovers of the DFMA with the various Fib MA lengths as well as a cross of the price source and these lines can provide adequate long and short signals. In the two DFMA strategies, the heaviest weights have been given to crosses of the DFMA line/Fib MA (233) as well as the crosses of the Fib MA (3)/DFMA. Additionally, there are thresholds for DPO ( Detrended Price Oscillator , above or below 0), CMO ( Chande Momentum Oscillator , above or below 0), Jurik Volatility Bands (above or below 0), and Stoch RSI (above or below 50). These four signals hold a lighter weight than the MA cross signals. The macro score itself ranges between -10 and 10. In addition to the macro score line, a momentum line (sourced by the macro score itself) has been included. A crossover/crossunder of the macro score and the macro momentum line is included into the long/short signal syntax in addition to a threshold for the macro score.
The DFMG – Democratic Fibonacci McGinley Dynamics – is a separate indicator that we have released that takes 10 different Fibonacci McGinley Dynamic liness (lengths of 3 to 233, at Fibonacci intervals) and averages them to form the DFMG line. This helps by creating a consensus on the trend based on moving averages alone. Crossovers of the DFMG with the various Fib MG lengths as well as a cross of the price source and these lines can provide adequate long and short signals. This strategy has the signals and weights pre-determined in the code. Heaviest weights have been given to crosses of the DFMG line/ McGinley (233) as well as the crosses of the McGinley (3)/DFMG. Additionally, there are thresholds for DPO ( Detrended Price Oscillator , above or below 0), CMO ( Chande Momentum Oscillator , above or below 0), Jurik Volatility Bands (above or below 0), and Stoch RSI (above or below 50). These four signals hold a lighter weight than the McGinley cross signals. The macro score itself ranges between -10 and 10. In addition to the macro score line, a momentum line (sourced by the macro score itself) has been included. A crossover/crossunder of the macro score and the macro momentum line is included into the long/short signal syntax in addition to a threshold for the macro score.
For the Ichimoku macro score, five signals were considered and weighted equally:
– Kijun-sen < Ichimoku Source
– Tenkan-sen < Ichimoku Source
– Kijun-sen > Chikou-span
– Tenkan-sen > Kijun-sen
– Senkou Span A > Senkou Span B
In addition to these factors, the Ichimoku strategy utilizes the Donchian Cloud Score in the long and short entry signals. Thus, the Donchian Cloud settings are applicable to this strategy.
For the True Strength Index strategy, the heaviest weights have been given to various TSI signals, including a crossover/crossunder of TSI signal and TSI value, a threshold for the TSI Signal (above or below 0), and a crossover/crossunder of the CMO ( Chande Momentum Oscillator ) and the TSI signal line. Additionally, there are thresholds for DPO ( Detrended Price Oscillator , above or below 0), Jurik Volatility Bands (above or below 0), and Stoch RSI (above or below 50). These three signals hold a lighter weight than the three TSI signals. The macro score itself ranges between -10 and 10. In addition to the macro score line, a momentum line (sourced by the macro score itself) has been included. A crossover/crossunder of the macro score and the macro momentum line is included into the long/short signal syntax in addition to a threshold for the macro score.
The Donchian Cloud Score is derived from a set of 5 Donchian channels (upper, lower, and basis plotted) defaulted to lengths of 25, 50, 100, 150, and 200. A set of conditions associated with the channels aims to determine ranging versus trending markets. Weights are given to these conditions accordingly, then tallied up to determine the “cloud score”, ranging between -25 and 25. In general, a ranging market is determined by a cloud score between -10 and 10, while a positive trending market has a score higher than 10 and a negative trending market has a score lower than -10. That said, long and short thresholds similar to the macro score itself are included in the user settings and set to a default of 5 or -5. The cloud score is plotted as a line in the underlay with coloration reflecting ranging or trending markets (green color above the long threshold, gray between the thresholds, and red below the short threshold). The cloud score is incorporated into the strategy syntax for long and short positions in that the score must be above or below the set threshold for a trade to be placed. A breakdown for the Donchian scoring is as follows:
– Broke the 25-length DC (DC(25)) upper band in the previous 3 bars – +1 if true, 0 if false
– Broke the DC(50) upper band in the previous 3 bars – +2 if true, 0 if false
– Broke the DC(100) upper band in the previous 3 bars – +3 if true, 0 if false
– Broke the DC(150) upper band in the previous 3 bars – +4 if true, 0 if false
– Broke the DC(200) upper band in the previous 3 bars – +5 if true, 0 if false
– Broke the DC(25) lower band in the previous 3 bars – -1 if true, 0 if false
– Broke the DC(50) lower band in the previous 3 bars – -2 if true, 0 if false
– Broke the DC(100) lower band in the previous 3 bars – -3 if true, 0 if false
– Broke the DC(150) lower band in the previous 3 bars – -4 if true, 0 if false
– Broke the DC(200) lower band in the previous 3 bars – -5 if true, 0 if false
– DC(25) basis line above the DC(50) basis line – +1 if true, -1 if false
– DC(25) basis line above the DC(100) basis line – +1 if true, -1 if false
– DC(25)basis line above the DC(150) basis line – +1 if true, -1 if false
– DC(25) basis line above the DC(200) basis line – +1 if true, -1 if false
– DC(50) basis line above the DC(100) basis line – +1 if true, -1 if false
– DC(50) basis line above the DC(150) basis line – +1 if true, -1 if false
– DC(50) basis line above the DC(200) basis line – +1 if true, -1 if false
– DC(100) basis line above the DC(150) basis line – +1 if true, -1 if false
– DC(100) basis line above the DC(200) basis line – +1 if true, -1 if false
– DC(150) basis line above the DC(200) basis line – +1 if true, -1 if false
Thresholds for both the respective macro score and the Donchian Cloud score have been included. Entry signals for each strategy require the score to be >= the respective thresholds for longs and <= the respective thresholds for shorts.
Additionally, a normalized z-score has been included. The z-score does not affect the entry and exit signals, however, it is displayed on the chart in the form of bar coloration. The z-score has been normalized to a range of -1 to +1. A z-score under -0.60 is displayed as a red bar color, a score between -0.60 and -0.2 is displayed as an orange bar color, a score between -0.2 and 0.2 is displayed as a gray bar color, a score between 0.2 and 0.6 is displayed as a lime bar color, and a score over 0.6 is displayed in green.
Data for each respective strategy will be displayed in an overlaid table. This includes the factors that comprise the macro score of choice, the values of each signal that adds up to the macro score, the macro score itself, the value of the momentum line of the macro score, the normalized z-score value, and the Donchian Cloud score (if applicable). Green coloration notes bullish sentiment within the signals or values, gray coloration is neutral, and red coloration notes bearish sentiment.
Take profit, stop loss, and trailing percentages are also included, found at the bottom of the Input tab under “TT and TTP” as well as “Stop Loss”. The take profit and stop loss levels will be reflected as green and red lines respectively on the chart as they occur. Make sure to understand the TP/SL ratio that you desire before use, as the desired hit rate/profitability percentage will be affected accordingly. The option for adding in a trailing stop has also been included, with options to choose between an ATR-based trail or a percentage-based trail. This strategy does NOT guarantee future returns. Apply caution in trading regardless of discretionary or algorithmic. Understand the concepts of risk/reward and the intricacies of each strategy choice before utilizing them in your personal trading.
Profitview/Pineconnector Settings:
If you wish to utilize Profitview’s automation system, find the included “Profitview Settings” under the Input tab of the strategy settings menu. If not, skip this section entirely as it can be left blank. Options will be “OPEN LONG TITLE”, “OPEN SHORT TITLE”, “CLOSE LONG TITLE”, and “CLOSE SHORT TITLE”. If you wished to trade SOL, for example, you would put “SOL LONG”, “SOL SHORT”, “SOL CLOSE LONG”, and “SOL CLOSE SHORT” in these areas. Within your Profitview extension, ensure that your Alerts all match these titles. To set an alert for use with Profitview, go to the “Alerts” tab in TradingView, then create an alert. Make sure that your desired asset and timeframe are currently displayed on your screen when creating the alert. Under the “Condition” option of the alert, select the strategy, then select the expiration time. If using TradingView Premium, this can be open-ended. Otherwise, select your desired expiration time and date. This can be updated whenever desired to ensure the strategy does not expire. Under “Alert actions”, nothing necessarily needs to be selected unless so desired. Leave the “Alert name” option empty. For the “Message”, delete the generated message and replace it with {{strategy.order.alert_message}} and nothing else. If using Pineconnector, follow the same directions for setting up an alert, but use the “,buy,,risk=” syntax as noted in the tooltips.
The Flower
This strategy code currently includes four separate strategies to be used to either aid in discretionary trading or to be used algorithmically through the third-party system Profitview (or PineConnector). The strategies have to be used algorithmically through the third-party system Profitview (or PineConnector). The strategies have been designed with cryptocurrency trading in mind, however, the fundamentals apply to other assets.
The four strategies currently included are labeled “TSI Cross” (the default setting), “Oscillator Bands”, “Scalping”, and “McG/MA Cross”. Detailed information for each independent strategy can be found below, including sample settings configurations for each. A dropdown menu to select the strategy can be found under the “Strategy Options” set of settings under the Input tab of the strategy settings menu. Additionally, the option to receive only long or short signals can be found alongside the Strategy Choice menu.
Take profit, stop loss, and trailing percentages are also included, found at the bottom of the Input tab under “TT and TTP” as well as “Stop Loss”. Make sure to understand the TP/SL ratio that you desire before use, as the desired hit rate/profitability percentage will be affected accordingly.
The only visuals associated with the strategy are two McGinley Dynamic lines, red (slow length) and green (fast length). These are relevant to the McGinley Cross strategy but can be used alongside the other strategies if desired.
TSI Cross
Total Strength Index (TSI) Cross This strategy option is the default choice. The main signal involved in this strategy is a crossover or crossunder of the TSI value line and TSI signal line, however, there are a few other signals involved in the creation of a long or short entry. In addition to the TSI, the strategy includes an Average Directional Index (ADX) threshold value, Jurik Volatility Bands (JVB), a Stoch RSI threshold, and an oscillator of choice in conjunction with a threshold of 0. This oscillator choice can be selected under the “Signal Options” menu in the Input tab of the strategy settings. The default oscillator is the Detrended Price Oscillator (DPO), though the option for Chande Momentum (CMO) or Rate of Change ( RoC ) are both viable for this strategy.
Individual settings for these can be found in the Input tab under “Oscillator Settings” (TSI, Stoch RSI, DPO, CMO, ROC), “Band/Channel Settings” (Jurik Volatility Bands Length/Smoothing), and “Directional Settings” (ADX Smoothing Long, DI Length Short, ADX Threshold).
Oscillator Band
This strategy involves the usage of bands or channels that use oscillators as a source input. The main signal for this strategy derives from a cross of the band or channel and a hline of 0. Additionally, this includes a “Directional Filter” and a “MA Filter”. The selections for all of these can be found in the “Signal Options” section of the Input tab. First option is for Oscillator Choice and includes DPO, CMO, ROC, RSI, TSI, and the
Jurik price line. The individual settings for these can be found in the “Oscillator Settings” section. Different channels can be selected for the upper or lower bands, though it is not necessary for them to differ. These current options include Bollinger Bands and Jurik Volatility Bands, the individual settings for each found in the “Band/Channel Settings” section. Next is the MA Filter, from which you can select SMA, EMA, SMMA, WMA, VWMA, KAMA, JMA, or McGinley Dynamic. All options for these settings can be found in the “MA Filter Settings” section. Lastly, the = Directional Filters can be selected for either direction like the upper/lower
band selection. These filters include the ADX, Bull-Bear Power (BBP), Parabolic SAR (PSAR), or Jurik.
Scalping
This strategy heavily relies on the usage of Parabolic SAR, accompanied by a “Directional Filter” (as discussed in the previous section) other than PSAR. This strategy can provide a higher frequency of trades as opposed to the other strategies available, however, it comes with slightly higher risk inherently. A riskier take profit/stop loss spread is recommended here, though risk should always be managed. The settings required for this strategy are all found under the “Directional Settings” section of the strategy inputs.
McGinley Cross
This strategy revolves around the crossing of two McGinley Dynamic lines of varying lengths alongside an ADX filter as well as a DPO filter. McGinley is used as opposed to a standard moving average cross strategy as it adjusts for shifts in market speed and can better gauge market trends. The McGinley length settings can be found with the “MA Filter” settings, labeled as Fast Length and Slow Length. The fast length number should be smaller than the slow length.
Comprehensive Settings List:
Date and Time: From date and to date, adjustable for backtesting purposes. Signal Options: Oscillator Choices:
Chande Momentum Oscillator (CMO), Detrended Price Oscillator (DPO), Rate of Change (ROC), Relative
Strength Index (RSI), True Strength Index (TSI), Jurik Volatility Bands Priceline (JVB) – *** for use with TSI
Cross or Oscillator Bands strategies only *** Upper and Lower Band/Channel Choices: Bollinger Bands (BB)
or Jurik Volatility Bands (JVB) — *** for use with Oscillator Bands strategy only *** MA/ McG Filter: SMA ,
EMA , RMA, WMA , VWMA , Kaufmann MA, Jurik MA, McGinley Dynamic — *** for use with Oscillator
Bands strategy only *** Directional Filter Long/Short: Average Directional Index (ADX), Bull/Bear Power
(BBP), Parabolic SAR (PSAR), Jurik — *** for use with Oscillator Bands strategy only *** Profitview/
Pineconnector Settings: *** For use with ProfitView or PineConnector extensions only, otherwise ignore ***
Oscillator Settings: *** For use with TSI Cross, Oscillator Bands, and McGinley Cross strategies *** CMO
Length, CMO Source – for Chande Momentum Oscillator DPO Length, DPO Centered – for Detrended Price
Oscillator RoC Length, RoC Source – for Rate of Change RSI Length, RSI MA Length – for Relative Strength
Index RSI (Stoch) Length, Stochastic Length, Stoch RSI Source, K, D – for Stochastic RSI TSI Long Length,
TSI Short Length, TSI Signal Length – for True Strength Index Band/Channel Settings: *** For use with
Oscillator Bands strategy *** Jurik Volatility Bands Length, Jurik Volatility Bands Smoothing – for Jurik
Volatility Bands Bollinger Band Length, Bollinger Band Multiplier – for Bollinger Bands Directional Settings:
*** For use with Scalping and Oscillator Bands strategies *** JVB Price Threshold – for Jurik Volatility as a
directional setting ADX Smoothing Long, DI Length Short, ADX Threshold – for Average Directional Index
PSAR Start Value, PSAR Increment, PSAR Max Value, PSAR Source – for Parabolic SAR MA Filter
Settings: *** For use with Oscillator Bands and McGinley Cross strategies *** McGinley Fast/Slow Length –
for McGinley Dynamic MA Length, MA Source, MA Offset – for any other moving average TP and TTP /
Stop Loss: *** For use with ALL strategies *** Long/Short Take Profit % — for standard take profit settings
Enable Trailing, Trailing Take Profit % — for trailing settings Stop Loss % — for standard stop loss settings;
trailing can be enabled or disabled for stop loss
Custom Macro Score
A “macro score”, as defined here, is created by giving various weights to different signals and adding them together to get one smooth score. Positive or negative values are assigned to each of the signals depending on if the statement is true or false (e.g. DPO > 0: +1, DPO < 0: -1). This manner of strategy allows for a subset of the available signals to be present at one time as opposed to every technical signal having to be active in order for a long/short signal to trigger. This particular strategy allows the user to choose between 18 different signals to be used in scoring as well as allowing the user to determine the individual weights of each score as well as the overall threshold to determine long or short signals. Weights for each score range between 1 and 5, with 5 being the greatest weight. The overall threshold for long or short is dependent on the total possible weights added together (i.e. if your weights total -10 or +10, a threshold within this range must be used). The macro score itself is printed in an underlay as a white line that goes between the maximum positive and negative values for all weights added together for this strategy. In addition to the macro score line, a green momentum line (sourced by the macro score itself) has been included. A crossover/crossunder of the macro score and the macro momentum line is included into the long/short signal syntax in addition to a threshold for the macro score. The length of the Macro Score’s momentum line can be found in the settings. The current signals to choose from include: – ADX Threshold – if the Average Directional Index is above a set threshold, signal positive or negative – CMF Threshold – if the Chaikin Money Flow oscillator is above 0, signal positive; otherwise, signal negative – CMO > TSI Signal – signal positive if there is a cross of the Chande Momentum Oscillator and the True Strength Index signal line – CMO Threshold – if the Chande Momentum Oscillator is above 0, signal positive; otherwise, signal negative – DPO Threshold – if the Detrended Price Oscillator is above 0, signal positive; otherwise, signal negative – EOM Threshold – if the Ease of Money Oscillator is above 0, signal positive; otherwise, signal negative – Jurik Threshold – if the Jurik price line (from the Jurik Volatility Bands) is above 0, signal positive; otherwise, signal negative – MACD Threshold – if the MACD signal line is above 0, signal positive; otherwise, signal negative – McGinley Cross – a crossover of a fast McGinley Dynamic length line and a slow McGinley Dynamic line signals positive; otherwise, signal negative – PSAR – if the direction of the PSAR is heading long, signal positive; otherwise, signal negative – ROC Threshold – if the Rate of Change oscillator is above 0, signal positive; otherwise, signal negative – RSI Threshold – if the Relative Strength Index is above 50, signal positive; otherwise, signal negative – Stoch RSI Threshold – if the Stoch RSI is above 50, signal positive; otherwise, signal negative – Supertrend – if the Supertrend determines long, signal positive; otherwise, signal negative – TSI Cross – a crossover of the True Strength Index value line and the TSI signal line signals positive; otherwise, signal negative – TSI Signal Threshold – if the TSI signal line is above 0, signal positive; otherwise, signal negative – Williams Alligator Cross – if the Williams Alligator lips cross the teeth and jaw, signal positive; otherwise, signal negative – Williams %R – if the Williams %R is above -50, signal positive; otherwise, signal negative Take profit, stop loss, and trailing percentages are also included, found at the bottom of the Input tab under “TT and TTP” as well as “Stop Loss”. Make sure to understand the TP/SL ratio that you desire before use, as the desired hit rate/profitability percentage will be affected accordingly. This strategy does NOT guarantee future returns. Apply caution in trading regardless of discretionary or algorithmic. Understand the concepts of risk/reward and the intricacies of each strategy choice before utilizing them in your personal trading Sample setup for AVAXUSDT 20M: – Score 1 – Value 3, TSI Cross (Long Length 25, Short Length 16, Signal Length 17) – Score 2 – Value 2, TSI Signal Threshold (same settings as the TSI Cross) – Score 3 – Value 2, Jurik Threshold (JVB Length 20, JVB Smoothing 8, JVB Price Threshold 0) – Score 4 – Value 2, DPO Threshold ( DPO Length 40 , uncentered) – Score 5 – Value 1, Stoch Threshold (K/D 3, RSI ( Stoch ) Length 10, Stochastic Length 4, sourced open) – Macro Length 13 – Long Threshold – +5 – Short Threshold – -5 – Take Profit % – 1.2/1.2 – Trail % – 0.005 – Stop Loss % – 1.5Algorithmic Extensions (ProfitView and Pineconnector) and
TradingView Alert Setup
All our strategies are pre-set with the ability to use certain extensions for automating trades. To date, two of
these extensions, ProfitView (https://profitview.app/) and Pineconnector (https://www.pineconnector.com/),
have been successfully tested in conjunction with our strategies. Other extensions, particularly those that utilize
TradingView alerts via webhooks (more on this below) should also be compatible with our strategies. Please
note that these automation services are separate from LeafAlgo and require their own individual subscriptions.
ProfitView
To set up ProfitView, Google Chrome is recommended over other browsers. ProfitView is a Chrome extension
that connects to your Chrome account, your open TradingView tab (not the account itself), and whichever
broker you choose to utilize for your cryptocurrency or forex trading. A comprehensive list of available
brokers can be found in the ProfitView Wiki (https://wiki.profitview.app/) or within the extension itself. The
extension can be found in the drop-down menu of extensions next to the URL bar once installed.
Before the setup, ensure that you have created a TradingView account and have an open instance of
TradingView in at least one browser tab. The extension will automatically connect to this, as it will with your
Chrome account. Next, ensure that you have created an account with your desired broker (Binance, Kucoin,
etc.), and have your account menu pulled up on a separate browser tab. This will need to be accessed to create
an API key for connection to the ProfitView extension.
To set up Profitview for algorithmic trading post-installation, go to the extension menu and select “Options”,
then navigate the main ProfitView menu that pops up and select “Setup: Unlock PRO” from the left-hand
menu. If you intend to trade with live accounts
(Kucoin Futures, for example), you will need to unlock Pro features. Once unlocked, navigate to “Setup:
Permissions” from the ProfitView menu, where you will find a list of exchanges/brokers for permissions. Turn
on any relevant exchanges, then navigate to the relevant Accounts (e.g., if you turned on Kucoin Futures, select
Kucoin Futures from the “Accounts” list on the left-hand side of the menu). At the top of the screen, there will
be a button to “Add Account”. Select this, then navigate to your broker account menu, where an option to
create a new API key can be found.
Create a new API, giving it a unique API name, its own password (remember this), and select the relevant
restrictions (e.g., General and Trade, no Withdraw on Kucoin Futures). IP restrictions can be placed if desired.
Save and copy the API key, the API *secret* key, and the password used to create the specific API. Return to
the ProfitView Accounts screen and enter an Account Name, then copy and paste the API key, secret key, and
password. Press the “Save Accounts” button at the top of the screen. If done correctly, ProfitView should be
connected to your exchange or broker and ready to trade.
To start trading algorithmically with ProfitView, alerts need to be created (found in the “Setup: PV Alerts” tab
of the left-hand menu). If you intend to trade both buys and sells (long and short), we recommend creating four
alerts per asset. Otherwise, for just buys or just sells, two alerts will be required. Example code:
hese two alerts are used for the position opening syntax. “e=” refers to your exchange (Kucoin Futures in this
example; kucoinft). “a=” refers to your account name, which must match the name of the ProfitView account
in the API creation process. “s=” refers to the desired asset. For spot markets, the “M” at the end of
“BTCUSDTM” is not necessary; the “M” is only applicable for use with futures markets. The second line of
syntax is used to close any active positions that are in the other direction (closing on reverse). If there are no
active positions, the syntax will skip to line 6. The “quantity=” in line 2 will need to be double your desired
position amount to cancel the position of the opposite direction (e.g., a -$200 short position was active, but the
strategy calls for a new buy position with $400 to make the total +$200). “quantity=” is set as a dollar (or
USDT) amount in this instance, however, this can be altered with the “unit=currency” portion of the syntax.
“retries=3″ is the default number of retries, with a time-out of 3 seconds between retries. This can be changed
accordingly if more retries or a different amount of time between the retries are desired. The desired leverage
can be set using the “leverage=” portion of syntax. Market orders can be changed to limit orders with the
“type=” syntax. “side=” on line 6
will be set to the desired direction (e.g., the BTC Long open syntax will have “side=long” on line 6). The
closing syntax is less complex than the opening syntax:The names of the alerts do not need to match what we have in our examples; however, they will need to match
in the TradingView alert (more on this below). For more information on syntax and setting up ProfitView, visit
their Wiki page, the ProfitView Discord channel, or join our own Discord channel and inquire.
PineConnector
PineConnector is another automation option, differing from ProfitView in that it is an expert advisor (EA) for
use with MetaTrader 4/5 as opposed to a Chrome extension for standard exchanges. To utilize PineConnector,
a MetaTrader-compatible brokerage account (live or demo) is required, as is a Pro plan on TradingView. Many
brokers have their own MetaTrader version to install, with PineConnector viable across them all. Take note of
your Trading Account Number, located next to your Account under the Navigator tab in MetaTrader. When
creating a PineConnector account, this Trading Account Number will be tied to a preassigned license ID for
the PineConnector EA. The PineConnector Wiki page can be found at (https://docs.pineconnector.com/getting-
started).
Download the PineConnector EA for either MetaTrader 4 or 5, then access the experts folder in MetaTrader
and add the PineConnector EA to the folder. Proceed to allow DLL imports in the Tools menu, enable
AutoTrading at the top of the screen (ensure it is green), and attach the PineConnector EA to each of the
desired assets/charts. In the Inputs tab of the EA settings, copy and paste the preassigned PineConnector
license ID. For detailed instructions, refer to the PineConnector Wiki’s EA Setup tabs.
The syntax for PineConnector’s alerts requires less effort than ProfitView. This syntax is entered into the
TradingView strategy itself (more information below) as opposed to the extension menu used in ProfitView.
Detailed syntax information can be located at (https://docs.pineconnector.com/syntax). As with ProfitView, we
suggest two alerts per direction (two for buys, two for sells), one for opening syntax and one for closing
syntax. Example code:
The opening syntax here is noted as {license ID number} followed by buy or sell, followed by the asset as it is
shown on your MetaTrader terminal, and ended with the amount of risk desired. The risk format can be set in
the EA settings within MetaTrader, as a factor of lots, percentage, or currency amount. Closing syntax here is
noted as {license ID number}, followed by closelong or closeshort, and ended with the asset. Please note that
when writing this syntax there should be NO spaces in the syntax before or after the comma.
TradingView Alert Setup
Our strategies and several automation extensions (including, but not limited to, PineConnector or ProfitView)
utilize TradingView’s built-in alert system. To begin, enable one of the LeafAlgo strategies to your desired
chart. Each strategy will have a settings page,
accessed via the gear icon next to the strategy on-chart or in the Strategy Tester found at the bottom of the
TradingView chart. Locate a section labeled “ProfitView or PineConnector Settings” near the top of the
settings list
Options will be “OPEN LONG TITLE”, “OPEN SHORT TITLE”, “CLOSE LONG TITLE”, and “CLOSE
SHORT TITLE”. If you wished to trade SOL and you were using ProfitView, for example, you would put
“SOL LONG”, “SOL SHORT”, “SOL CLOSE LONG”, and “SOL CLOSE SHORT” in these areas. Within
your Profitview extension, ensure that your Alerts all match these titles.
To set an alert for use with Profitview or PineConnector, go to the “Alerts” tab in TradingView, then create an
alert. Make sure that your desired asset and timeframe are currently displayed on your screen when creating the
alert.
Under the “Condition” option of the alert, select the strategy, then select the expiration time. If using
TradingView Premium, this can be open-ended. Otherwise, select your desired expiration time and date. This
can be updated whenever desired to ensure the strategy does not expire. Under “Alert actions”, nothing
necessarily needs to be selected unless so desired. Leave the “Alert name” option empty. For the “Message”,
delete the generated message and replace it with {{strategy.order.alert_message}} and nothing else.
If using PineConnector, follow the same directions for setting up an alert, but use the “,buy,,risk=” syntax as
noted in the tooltips of the strategy’s settings. Additionally, in the Notifications tab of the TradingView alert, a
webhook for PineConnector is needed (https://pineconnector.net/webhook/).
Once the TradingView alert is set up, any entries and exits determined by the LeafAlgo strategy will go
through your automation extension and be submitted quickly to your exchange or broker. Errors the occur
using ProfitView can be monitored in the “Changelog” tab of the extension’s menu.
How do I get access to LeafAlgos indicators on TradingView?
Select your desired subscription and follow the steps to set up your account. Once the account setup up and transaction is complete, access will be granted within 24 hours to all LeafAlgo Premium Indicators.
How do I get access to LeafAlgo’s Discord community?
Getting access to LeafAlgos discord community is as is as following our link and following the prompted steps for access! link:https://www.discord.gg/rNQ2QW59Pn