Linear Cross Trading StrategyLinear Cross Trading Strategy
The Linear Cross trading strategy is a technical analysis strategy that uses linear regression to predict the future price of a stock. The strategy is based on the following principles:
The price of a stock tends to follow a linear trend over time.
The slope of the linear trend can be used to predict the future price of the stock.
The strategy enters a long position when the predicted price crosses above the current price, and exits the position when the predicted price crosses below the current price.
The Linear Cross trading strategy is implemented in the TradingView Pine script below. The script first calculates the linear regression of the stock price over a specified period of time. The script then plots the predicted price and the current price on the chart. The script also defines two signals:
Long signal: The long signal is triggered when the predicted price crosses above the current price.
Short signal: The short signal is triggered when the predicted price crosses below the current price.
The script enters a long position when the long signal is triggered and exits the position when the short signal is triggered.
Here is a more detailed explanation of the steps involved in the Linear Cross trading strategy:
Calculate the linear regression of the stock price over a specified period of time.
Plot the predicted price and the current price on the chart.
Define two signals: the long signal and the short signal.
Enter a long position when the long signal is triggered.
Exit the long position when the short signal is triggered.
The Linear Cross trading strategy is a simple and effective way to trade stocks. However, it is important to note that no trading strategy is guaranteed to be profitable. It is always important to do your own research and backtest the strategy before using it to trade real money.
Here are some additional things to keep in mind when using the Linear Cross trading strategy:
The length of the linear regression period is a key parameter that affects the performance of the strategy. A longer period will smooth out the noise in the price data, but it will also make the strategy less responsive to changes in the price.
The strategy is more likely to generate profitable trades when the stock price is trending. However, the strategy can also generate profitable trades in ranging markets.
The strategy is not immune to losses. It is important to use risk management techniques to protect your capital when using the strategy.
I hope this blog post helps you understand the Linear Cross trading strategy better. Booost and share with your friend, if you like.
Linear Regression
Advanced Trend Detection StrategyThe Advanced Trend Detection Strategy is a sophisticated trading algorithm based on the indicator "Percent Levels From Previous Close".
This strategy is based on calculating the Pearson's correlation coefficient of logarithmic-scale linear regression channels across a range of lengths from 50 to 1000. It then selects the highest value to determine the length for the channel used in the strategy, as well as for the computation of the Simple Moving Average (SMA) that is incorporated into the strategy.
In this methodology, a script is applied to an equity in which multiple length inputs are taken into consideration. For each of these lengths, the slope, average, and intercept are calculated using logarithmic values. Deviation, the Pearson's correlation coefficient, and upper and lower deviations are also computed for each length.
The strategy then selects the length with the highest Pearson's correlation coefficient. This selected length is used in the channel of the strategy and also for the calculation of the SMA. The chosen length is ultimately the one that best fits the logarithmic regression line, as indicated by the highest Pearson's correlation coefficient.
In short, this strategy leverages the power of Pearson's correlation coefficient in a logarithmic scale linear regression framework to identify optimal trend channels across a broad range of lengths, assisting traders in making more informed decisions.
MACD TrueLevel StrategyThis strategy uses the MACD indicator to determine buy and sell signals. In addition, the strategy employs the use of "TrueLevel Bands," which are essentially envelope bands that are calculated based on the linear regression and standard deviation of the price data over various lengths.
The TrueLevel Bands are calculated for 14 different lengths and are plotted on the chart as lines. The bands are filled with a specified color to make them more visible. The highest upper band and lowest lower band values are stored in variables for easy access.
The user can input the lengths for the TrueLevel Bands and adjust the multiplier for the standard deviation. They can also select the bands they want to use for entry and exit, and enable long and short positions.
The entry conditions for a long position are either a crossover of the MACD line over the signal line or a crossover of the price over the selected entry lower band. The entry conditions for a short position are either a crossunder of the MACD line under the signal line or a crossunder of the price under the selected exit upper band.
The exit conditions for both long and short positions are not specified in the code and are left to the user to define.
Overall, the strategy aims to capture trends by entering long or short positions based on the MACD and TrueLevel Bands, and exiting those positions when the trend reverses.
RSI TrueLevel StrategyThis strategy is a momentum-based strategy that uses the Relative Strength Index (RSI) indicator and a TrueLevel envelope to generate trade signals.
The strategy uses user-defined input parameters to calculate TrueLevel envelopes for 14 different lengths. The TrueLevel envelope is a volatility-based technical indicator that consists of upper and lower bands. The upper band is calculated by adding a multiple of the standard deviation to a linear regression line of the price data, while the lower band is calculated by subtracting a multiple of the standard deviation from the same regression line.
The strategy generates long signals when the RSI crosses above the oversold level or when the price crosses above the selected lower band of the TrueLevel envelope. It generates short signals when the RSI crosses below the overbought level or when the price crosses below the selected upper band of the TrueLevel envelope.
The strategy allows for long and short trades and sets the trade size as a percentage of the account equity. The colors of the bands and fills are also customizable through user-defined input parameters.
In this strategy, the 12th TrueLevel band was chosen due to its ability to capture significant price movements while still providing a reasonable level of noise reduction. The strategy utilizes a total of 14 TrueLevel bands, each with varying lengths. The 12th band, with a length of 2646, strikes a balance between sensitivity to market changes and reducing false signals, making it a suitable choice for this strategy.
RSI Parameters:
In this strategy, the RSI overbought and oversold levels are set at 65 and 40, respectively. These values were chosen to filter out more noise in the market and focus on stronger trends. Traditional RSI overbought and oversold levels are set at 70 and 30, respectively. By raising the oversold level and lowering the overbought level, the strategy aims to identify more significant trend reversals and potential trade opportunities.
Of course, the parameters can be adjusted to suit individual preferences.
ETHUSDT Long-Short using EMA,OBV,ADX,LinearReg,DXY(No repaint)This script strategy is used to follow the trending EMA with a delta difference (Price-EMA) to know when to enter and with 5 variables mentioned below, stop loss is below EMA line all the time in long and above EMA line in short, is like a trailing stop after candle is closed. Hard stop is also placed to prevent big candles movements, also correlation between VIX and ETH when the correlation is <-0.2 the position can be opened.
Indicators used:
EMA , OBV , ADX , Linear regression and Dollar Index trending, Leverage is available for Long and Short positions.
LONG
When Price is above EMA and price-ema difference is smaller than "Long delta Price/MA"
OBV(4hrs) is above OBV-EMA(110)
Linear regression is strong
ADX is strong >50
DXY is trending down
SHORT
When Price is below EMA and ema-price difference is smaller than "Long delta Price/MA"
OBV(4hrs) is below OBV-EMA(110)
Linear regression is weak
ADX is weak <50
DXY is trending up
BINANCE:ETHUSDT 30 minutes Timeframe
The Systems Lab: PRX StrategyLike the PRX Indicator (which is also available) this PRX Strategy includes all the elements necessary to run the PRX Trading System or to incorporate any of its elements into your own analysis. But since this is a strategy it also includes all of the system entry and exit orders which allows them to be displayed on the charts and backtested in different configurations to see how specific configurations of the system could have performed in the past.
The primary concept is the identification of trends by way of a customized PSAR (Parabolic Stop and Reverse) calculation that uses linear regression to reduce market noise and highlight trends for longer using a method pioneered by Dr Ken Long. This means that price can penetrate the PSAR dots without causing a trend reversal to occur (flipping the dots over to the opposing side) which would normally occur with the traditional PSAR idea.
The intent is to help identify and stick with trends longer, adapt to changes in volatility by using linear regression as a noise filter and potentially capture large outlier moves. A linear regression curve is plotted as well in order to help identify when a change in trend will occur by it crossing the PSAR dots.
In order to make the trend as clear as possible the bars can be colored as either up-trend or down-trend with user selectable colors.
A moving average filter is also included as a longer term market condition filter in order to avoid periods when the market is against this average which is an inherent part of the system.
The strategy is currently long only (though we’re working on the short side) and includes standard entries along with a trailing stop using the customized PSAR. It also includes multiple options to re-enter with an existing trend if the trailing stop is hit but the trend remains in place.
Multiple parameters are available for customisation including the Linear Regression length, the Moving Average Filter lookback, enabling of the re-entry and continuation entry signals as well as a date range filter for more specific and repeatable backtesting over different markets and timeframes.
Risk Management is at the core of our system design principles and as such we set and limit the loss for every trade (which is also configurable as a parameter that defaults to $100/trade) and also trail the stop to both reduce risk and capture profit. The position size is calculated automatically and is volatility adjusted based on the initial stop.
Finally, there is a custom dashboard which shows all the relevant details for the current trade at a glance on the chart such as entry, initial stop (size and price), current trailing stop level and P/L in units of R-multiples (’R’ being the initial risk on the trade).
[Fedra Algotrading Strategy 2tp+L&S] Futures Long or ShortStrategy for crypto market, designed for automatic algorithmic trading with bots.
Can place long and short orders
Calculates your entries based on the breakout of the simple deviation of the linear regression of the last X periods.
Configures TP (green line) and SL (red line) percentages, the TP is a trailing TP.
Optionally, you can set a first TP (white line) that sells half of the position.
Advanced trend filter to not open trades against the market. SMA (yellow line), WMA (blue line) and secret sauce
Includes an advanced system to control the backtest period (choose how many days to backtest).
Risk management by volume of capital or amount of losing trades (kill switches that will exit the trade and stop the script)
The script includes default commissions of 0.2% per trade (configurable).
- Dinamic table with Price positions to plan your limit orders if you are trading manually
- Highly customizable and optimizable.
If you want to trade longs and shorts, it is advisable to create 2 different alerts. In most cases, the optimal parameters for longs are not the same as for shorts. In a forthcoming update I will enable separate configurations.
For better performance the script uses real time price information, for this reason Tradingview may warn you that there is "repainting", as the backtest information does not contain the information of each tick but only the open, close, high and low values of each candle.
To avoid this, you can disable the "calculate on every tick" option from the strategy settings panel.
Trends_2022Hello everyone,
we are developing a strategy which is suited for people that likes to trade in small time frames.
Our strategy uses many indications for entries. These indicators can be used individually or better solution we combined them together for best prediction.
These indications like True Range, Average True Range , moving averages also previous bars highs, lows and closes values and finally mathematical equations to decide close price wave movement. Most of the work is in scaling price data and comparing them with the indicators to decide trend
The strategy is planned to go only long direction..
now we will discuss how each indicator is used to decide trend
* According to ATR trend prediction ...
it is up when the scaled bar price greater than ATR value
it turns down when the scaled bar price is less than ATR value
* According to MAs trend prediction ...
we use SMA and previous bar data averages then apply linReg ( Linear regression curve) this result in curve up and down zero
it is up when the value is up zero
it turns down when the value is down zero
* According to close price wave movement ...
we applied cos function on previous bars close data to get the sloping wave of close movement
If the slope is increasing ... this means the current wave value is greater than the previous value
If the slope is decreasing ... this means the current wave value is less than the previous value
Now as we mentioned before... The strategy goes only long direction.
LONG ENTRY Conditions (ANDing condition not ORing):
we can use any one of these indicators individually, or mix any two of them or use them all simultaneously
So... LONG ENTRY Conditions are as below:
if ATR trend is used .. it should be UP.
if MAs trend used .. it should be > 0.
if close wave slope is used .. it should be increasing.
On the other side… the Exit conditions are also (ANDing condition not ORing):
So... LONG Exit Conditions are as below:
if ATR trend is used .. it should be down.
if MAs trend used .. it should be < 0.
if close wave slope is used .. it should be decreasing.
Please send me private message for script authorization.
Happy trading everyone!
Pairs Trading (basic OLS regression)Pairs trading using hedge ratio.
Firstly, it calculates hedge ration using OLS linear regression.
Then it calculates spread and z-score of spread.
if spread in specific range (which it's possible to change in settings) it makes Long/Short orders.
The very basic script.
Profit Maxima: a crypto strategyThis strategy is designed for those who are looking for long-term positions with low risk and high profitability.
How does it work?
In short, the basis of this strategy is the frequent modeling of the price using regression equations and the estimation of the range of price movements.
The price modeling process starts from the first bars and will be repeated on each bar. This process is performed in each candle based on the data available up to that candle, and data for subsequent bars is not used.
There is also no fixed price model, but it will change from one candle to the next; Therefore, the more candles there are, the larger the statistical population and therefore the quality of the price model increases.
I have also used the concept of scarcity. Bitcoin is the first scarce digital object in the world. Once something becomes scarce enough, it can be used as money. This scarcity gradually increases and affects the price. The entire crypto market also follows Bitcoin.
However, always remember that past results in no way guarantee future performance.
Why this strategy generates a small number of trades?
Preston Pysh believed Bitcoin cycles happen in three phases: the Bull Run, the Correction, and the Reversion to the Mean. He estimates there are about 200,000 blocks per cycle and there are about 144 blocks per day.
Therefore, each cycle of Bitcoin lasts about four years. The entire crypto market follows bitcoin. On the other hand, cryptocurrency is a new phenomenon. They have a limited price history.
This strategy is designed to open a long position at the lowest possible price. In addition, due to the concept of scarcity and its continued impact on prices, trading in the “short” direction is avoided.
The combination of these factors leads to generate a small number of trades. However, you can test it on several different charts to make sure it works properly.
Default settings
{ default_qty_type } = strategy.percent_of_equity
{ default_qty_value } = 3.3
{ commission_value } = 0.1
{ pyramiding } = 3
{ close_entries_rule } = "ANY"
In a simple word, buy (Entry) and sell (take-profit) orders are each done at three different levels. At each level, 3.3% of equity is used (9.9% in total)
0.1% commission is considered for each transaction.
“close_entries_rule” determines the order in which orders are closed. The default is FIFO (first in, first out), but in this strategy, orders are executed in “first in, last out” order. In this way, the lowest buy (Entry) order corresponds to the lowest sell (take profit) order.
Choose the best chart
Charts have a significant impact on the performance of the strategy. As mentioned, the more historical bars there are, the larger the statistical population and therefore the quality of the price model increases.
You can use the Chart Quality panel to choose the appropriate chart:
The ‘Historical Bars’ field shows the number of candles in the chart. Choose the chart of an exchange that has the most historical bars.
The ‘Recommended Chart’ field shows the suggested chart for some symbols.
The “Predictability” field indicates to what extent price movements can be predicted using the model; the higher the “predictability”, the more credible the results of the strategy. "Predictability" indicates that the results of the strategy are reliable or not.
The image below shows the recommended chart for 20 different symbols:
How to use
You don't need automated trading platforms to use it. It can be used by placing simple buy and sell (take-profit) orders manually.
The green and red lines indicate the 'Entry' and 'Profit' levels respectively. If there is no order (buy / sell) active on one of these levels, it will be displayed in gray. The corresponding values are displayed in the Entry & Profit Limits table.
After choosing the appropriate chart, you can use this table to place your orders manually.
Note that trading in the "short" direction is not recommended at all.
Samples
US 10 Yr Yield Fair ValueI calculate a fair value of the US 10 year yield applying a rolling regression (default 15 periods) with 2 different ratios.
Entry of long and short are based on differ and exit are based if yield high/low price is below/above the fair value -/+ 1 std dev.
Exit when long is based on if short is indicated or yield is inside the boundary of the FV value (+/-5% of FV for example)
Exit when short is when long is indicated.
MACandles-LinearRegression-StrategyThis is combination of multiple indicators and strategies. Mainly useful for indexes and to time the entry and exits of indexes. No stoploss used - makes it less desirable for leveraged trades or trading individual stocks.
Let us rewind and look back at some of the indicators/strategies published earlier.
1. Moving Average Candles - this is one of my favourite tool for general trend filtering. Applying supertrend on moving average candles is one of the easiest ways to find reversal in trending market without exiting positions too early. Few scripts published on this basis are:
MA Candles Supertrend
MA Candles Supertrend Strategy
2. VixFix and Linear Regression - this itself is combination of two indicators.
Williams-Vix-Fix-Finds-Market-Bottoms - by @ChrisMoody
Squeeze-Momentum-Indicator - by @LazyBear
I have combined these two indicators to derive VIX-Fix linear regression to find absolute market bottoms. More description here:
VixFixLinReg-Strategy
VixFixLinReg-Indicator
Now, in this strategy, we combine all these together.
Derive moving average candles
Derive momentum of moving average candles
Derive Linear regression on momentum
Optionally, also calculate VIX Fix and Linear regression on VixFix momentum
To find market bottom:
There are two options
1. Use when momentum of MA candles hit bottom (red) and slowly turn up (orange). In aggressiveLong mode, signals are also generated when momentum starts going positive from negative.
2. Use Vix Fix linear regression of MA candles as described in the original script of VixFixLinReg-Strategy
To find market top
Here only Ma candles momentum decreasing is used as signal. If looking for longTrades , exit signal is generated only when momentum is turning negative extreme(orange). Or else, exit signal is generated when momentum has turned neutral.
At this stage, it is very much experimental - use it with caution :)
Multiband - Market TimerThis strategy is made for market timing in the bull markets. Hence, more ideal to use it with index ETFs or high conviction large caps.
This makes use of different custom indicators:
Multi Band Channel - Overbought/Oversold Oscillator
VixFix Linear regression
Regular Linear Regression.
Multi Band Oscillator is used for identifying overbought/oversold state of the instrument. This is used in conjunction with VIXFix Linear Regression to to find market bottoms for entry conditions.
Few parameters are explained below:
CheckBandDistance - If checked checks for narrow bands and ignore signals when crossover happens in narrow bands.
ConsiderOversoldDaysCounter/ConsiderOverboughtDaysCounter - If checked, considers oversold and overbought crossovers only if instrument stays in oversold/overbought state for that many bars.
UseLinearRegressionToOpen/UseLinearRegressionToClose - If checked, combines linear regression along with overbought/oversold condition for entry and exits.
UseVixFixToOpen - Uses VixFixLinear regression to identify market bottom and this condition will be combined with oversold/overbought state. When using VixFixLinearRegression signal, we can allow generating entry signals during non crossover bars. Vix Fix Entry Range sets the max bar for multi band state to be for generating signal. For example, if Vix Fix Entry Range is set to oversold, signal is generated based on VixFix if price is below oversold.
ExitStrategy - This can be trailing/reversal or combined. If set to reversal, exit will happen on state moving out of oversold region. If set to Trailing, stop will be based on trailing stops. Indicator shows what is the present stop value. If set to combined, exit will happen on stages. 30% of the remaining position gets closed upon reversals. State may go into oversold and return back many times before having full exit. If this happens, each time, 30% of the position will be closed. Full position closure happens on hitting training stop.
Candles are colored based on linear regression.
Green -> positive and moving up
Lime -> Positive moving down
Orange -> Negative moving up
Red -> Negative moving down
Purple -> Possible VixFix peak - aka Market bottom
Another snapshot of the script along with Linear regression and VIXFix-LinReg indicators:
Related scripts are found here:
I have not put additional indicators to identify trend. But, can be combined with higher timeframe trend filters to generate better signals. Making this as invite only script as I find it very lucrative to time index ETFs. Please PM me if you want to try this script.
VixFixLinReg-StrategyThis idea came up while discussing about strategies with one of the trading enthusiast from tradingview community.
Strategy basically uses existing script of Vix Fix by Chris Moody:
VixFix is a great indicator for finding the market bottoms. But, sometimes it generates signal too early. But, we can apply linear regression on vix fix to find vix fix top to make timing much better.
Entry condition:
Wait for Vix fix bar to turn lime.
Once vix fix is turned lime, then wait for linear regression (shown below 0) to turn lime from green. This indicates VIX-Fix has started declining.
Go long once above two conditions are satisfied
Exit Condition:
ATR Based Stop
Applied only if linear regression is green - which means VixFix rising.
Note: This is ideal for identifying market bottom. May not yield good results on individual stocks.
Moving Regression Band Breakout strategyFollowing the introduction of the Moving Regression Prediction Bands indicator (see link below), I'd like to propose how to utilize it in a simple band breakout strategy :
Go long after the candle closes above the upper band . The lower band (alternatively, the lower band minus the 14-period ATR or the central line ) will serve as a support line .
Exit as soon as the candle closes below the support line .
To manage the risk of false breakouts, a fixed stop loss is set to the value of the support line at the time of opening a position. When the support line moves above the position opening price, shift the stop loss to breakeven.
The same logic but in reverse applies to short positions.
As an option, it is possible to allow long entries only when the slope of the Moving Regression curve is positive (and short entries when the slope is negative).
Model parameters:
Length and Polynomial Order define the lag and smoothness of the model.
Multiplier specifies the width of the channel.
As the default model parameter values, I set those that I found to provide optimal risk / reward ratio on the daily timeframe (for both trending and range-bound market). However, the settings are very flexible and can be well-adjusted to particular market conditions. Feel free to play around and leave feedback in the comments!
Here's the original Moving Regression Prediction Bands script:
Linear Regression - Reverse Up/Down StrategyFor my first foray into pine script I took the code from the generic "Consecutive up/down" and flipped the logic. I added a linear regression filter to try and stay with the overall trend. ATR added for visual, I eventually want to use it as part of the money management.
Rules to open trade or close the opposite:
IF the linear regression slope is >=0 AND the last candle closes lower, BUY
IF the linear regression slope is <=0 AND the last candle closes higher SELL
Rules to close the opposite:
IF the linear regression slope is >=0 AND the last candle closes higher, close any open SELL
IF the linear regression slope is <=0 AND the last candle closes lower, close any open BUY
Function Polynomial Regression StrategyTo be clear I'm using the code from Richard Santos for the functional polynomial regression. I really loved his script idea (given that I'm into linear regression myself). I took his code and made a strategy which applies to bitcoin on the 5 minute chart (but you could adjust this for any asset), and you could make this work on anytime frame by adjusting the 'length' property of the regression until you get good results.
This strategy is very simple.
I drew lines to represent the bottom most part of the regression (green line), and top most part (red line). If the close crosses under the red line then you short. The reverse if it crosses above the green line then you go long.
Very simple but effective. To understand this script be sure to add Richard santos function polynomial regression so you can see what is going on and what I'm trying to do.
For example, on BTC with a length of 61 if you bought and held you would have only had 5% gain, instead with this strategy you are looking at very close to 60% gains! Now this could be a weird fluke of over-optimizing but I'm not sure this is the case because you can adjust the length from there +/- about 10 and still have good results. It's just certain lengths are the correct trading rhythms for different assets.
I'm excited to see how you guys use this and if you have any success. Be sure to thank Richard Santos for his great work!
Close Trade at end of day script serves as an example how we can close trades at end of day.
can be session controlled or the time controlled.
the session should be adjusted to be earlier than the candle time.
USDJPY 30 MIN STRATEGYThis strategy uses a combination linear regression moving averages and ATR, fine-tuned to the USD/JPY 30 minute chart. Without going into too much detail, the long/short signals are based upon linear regression moving average crosses and slope with ATR confirmation.
All code is based on one time frame with no security functions so zero repaint. Backtest is based upon compounding 100% of your capital using zero leverage.
PM me for access to the strategy. Alert indicator for this available for donation via BTC.
I'm not a professional coder, but the backtests speak for themselves. As with anything on Tradingview, your results may vary and use at your own risk. Past performance is no indication of future performance.
- Hoffdaddy
verified sar + adxsimple yet powerful script to get some cash.
use 1d+ timeframes and 0.15x-3x leverage to get full advantage from the market.
add it to favorites and use on your own risk.
Pair Trade cryptoPair trade for crypto with inputs:
* length of correlation and moving average
* trade pair
* spread threshold to enter long / short
* spread threshold to exit long / short
Pair TradePair trade with inputs:
* length of correlation and moving average
* trade pair
* spread threshold to enter long / short
* spread threshold to exit long / short
Linear Regression Pearson's R - Trend Channel StrategyThis script takes advantage of the Pearson's R attribute of the data set you provide.
Pearson's R attempts to find how correlated data is with a potential pattern. If the number is negative the correlation is upwards . If it's positive the correlation is downwards . Pearson's R can only be a number between -1 and 1. It should be impossible to ever reach -1 or 1 as that would be a perfect correlation.
This particular strategy involves using linear regression and Pearson's R to keep recalculating steps back from the current position until the Pearson's R reaches the desired amount. For example, in my experience I have found that 0.85 for as a buy point is very good as it means the trend is very reliable and solid. When the market tends to be bullish it tends to do so longer then when it's bearish.
Likewise when a downtrend is more real, I found that 0.71 for the negative Pearson's R value is ideal and gives the best results.
These can all be changed in the settings section (with the gear icon) next to when you set your results.
This strategy is really fun/useful to watch if you have the replay bar mode enabled for TradingView. This script supports this and all you have to do is go into the settings and enable realtime mode . Doing this you can actually see the trend lines change in realtime and comes in very handy for seeing long term reversals as you will see the Pearson's R value start to go down or up indicating the path it's going on.
WARNING: This script is very intensive on the processing power of your machine. If you find that it's to slow you may have to go into the settings of the script and adjust the 'step by' parameter so that it calculates a little faster. It won't be as accurate but it will be good enough. I feel I've optimized it with it's current setting as an example of what you want to aim for.
If there are any questions do no hesitate to message or ask me. I love feedback on the community for new features and ideas!
This works best with with XBTUSD on the 4 hourly chart . It does not seem to work well if you go below hourly or go above daily.