QuantBuilder | FractalystWhat's the strategy's purpose and functionality?
QuantBuilder is designed for both traders and investors who want to utilize mathematical techniques to develop profitable strategies through backtesting on historical data.
The primary goal is to develop profitable quantitive strategies that not only outperform the underlying asset in terms of returns but also minimize drawdown.
For instance, consider Bitcoin (BTC), which has experienced significant volatility, averaging an estimated 200% annual return over the past decade, with maximum drawdowns exceeding -80%. By employing this strategy with diverse entry and exit techniques, users can potentially seek to enhance their Compound Annual Growth Rate (CAGR) while managing risk to maintain a lower maximum drawdown.
While this strategy employs quantitative techniques, including mathematical methods such as probabilities and positive expected values, it demonstrates exceptional efficacy across all markets. It particularly excels in futures, indices, stocks, cryptocurrencies, and commodities, leveraging their inherent trending behaviors for optimized performance.
In both trending and consolidating market conditions, QuantBuilder employs a combination of multi-timeframe probabilities, expected values, directional biases, moving averages and diverse entry models to identify and capitalize on bullish market movements.
How does the strategy perform for both investors and traders?
The strategy has two main modes, tailored for different market participants: Traders and Investors.
1. Trading:
- Designed for traders looking to capitalize on bullish markets.
- Utilizes a percentage risk per trade to manage risk and optimize returns.
- Suitable for both swing and intraday trading with a focus on probabilities and risk per trade approach.
2. Investing:
- Geared towards investors who aim to capitalize on bullish trending markets without using leverage while mitigating the asset's maximum drawdown.
- Utilizes pre-define percentage of the equity to buy, hold, and manage the asset.
- Focuses on long-term growth and capital appreciation by fully/partially investing in the asset during bullish conditions.
How does the strategy identify market structure? What are the underlying calculations?
The strategy utilizes an efficient logic with for loops to pinpoint the first swing candle featuring a pivot of 2, establishing the point at which the break of structure begins.
What entry criteria are used in this script? What are the underlying calculations?
The script utilizes two entry models: BreakOut and fractal.
Underlying Calculations:
Breakout: The script assigns the most recent swing high to a variable. When the price closes above this level and all other conditions are met, the script executes a breakout entry (conservative approach).
Fractal: The script identifies a swing low with a period of 2. Once this condition is met, the script executes the trade (aggressive approach).
How does the script calculate probabilities? What are the underlying calculations?
The script calculates probabilities by monitoring price interactions with liquidity levels. Here’s how the underlying calculations work:
Tracking Price Hits: The script counts the number of times the price taps into each liquidity side after the EQM level is activated. This data is stored in an array for further analysis.
Sample Size Consideration: The total number of price interactions serves as the sample size for calculating probabilities.
Probability Calculation: For each liquidity side, the script calculates the probability by taking the average of the recorded hits. This allows for a dynamic assessment of the likelihood that a particular side will be hit next, based on historical performance.
Dynamic Adjustment: As new price data comes in, the probabilities are recalculated, providing real-time aduptive insights into market behavior.
Note: The calculations are performed independently for each directional range. A range is considered bearish if the previous breakout was through a sellside liquidity. Conversely, a range is considered bullish if the most recent breakout was through a buyside liquidity.
How does the script calculate expected values? What are the underlying calculations?
The script calculates expected values by leveraging the probabilities of winning and losing trades, along with their respective returns. The process involves the following steps:
This quantitative methodology provides a robust framework for assessing the expected performance of trading strategies based on historical data and backtesting results.
How is the contextual bias calculated? What are the underlying calculations?
The contextual bias in the QuantBuilder script is calculated through a structured approach that assesses market structure based on swing highs and lows. Here’s how it works:
Identification of Swing Points: The script identifies significant swing points using a defined pivot logic, focusing on the first swing high and swing low. This helps establish critical levels for determining market structure.
Break of Structure (BOS) Assessment:
Bullish BOS: The script recognizes a bullish break of structure when a candle closes above the first swing high, followed by at least one swing low.
Bearish BOS: Conversely, a bearish break of structure is identified when a candle closes below the first swing low, followed by at least one swing high.
Bias Assignment: Based on the identified break of structure, the script assigns directional biases:
A bullish bias is assigned if a bullish BOS is confirmed.
A bearish bias is assigned if a bearish BOS is confirmed.
Quantitative Evaluation: Each identified bias is quantitatively evaluated, allowing the script to assign numerical values representing the strength of each bias. This quantification aids in assessing the reliability of market sentiment across multiple timeframes.
What's the purpose of using moving averages in this strategy? What are the underlying calculations?
Using moving averages is a widely-used technique to trade with the trend.
The main purpose of using moving averages in this strategy is to filter out bearish price action and to only take trades when the price is trading ABOVE specified moving averages.
The script uses different types of moving averages with user-adjustable timeframes and periods/lengths, allowing traders to try out different variations to maximize strategy performance and minimize drawdowns.
By applying these calculations, the strategy effectively identifies bullish trends and avoids market conditions that are not conducive to profitable trades.
The MA filter allows traders to choose whether they want a specific moving average above or below another one as their entry condition.
What type of stop-loss identification method are used in this strategy? What are the underlying calculations?
- Initial Stop-loss:
1. ATR Based:
The Average True Range (ATR) is a method used in technical analysis to measure volatility. It is not used to indicate the direction of price but to measure volatility, especially volatility caused by price gaps or limit moves.
Calculation:
- To calculate the ATR, the True Range (TR) first needs to be identified. The TR takes into account the most current period high/low range as well as the previous period close.
The True Range is the largest of the following:
- Current Period High minus Current Period Low
- Absolute Value of Current Period High minus Previous Period Close
- Absolute Value of Current Period Low minus Previous Period Close
- The ATR is then calculated as the moving average of the TR over a specified period. (The default period is 14)
2. ADR Based:
The Average Day Range (ADR) is an indicator that measures the volatility of an asset by showing the average movement of the price between the high and the low over the last several days.
Calculation:
- To calculate the ADR for a particular day:
- Calculate the average of the high prices over a specified number of days.
- Calculate the average of the low prices over the same number of days.
- Find the difference between these average values.
- The default period for calculating the ADR is 14 days. A shorter period may introduce more noise, while a longer period may be slower to react to new market movements.
3. PL Based:
This method places the stop-loss at the low of the previous candle.
If the current entry is based on the hunt entry strategy, the stop-loss will be placed at the low of the candle that wicks through the lower FRMA band.
Example:
If the previous candle's low is 100, then the stop-loss will be set at 100.
This method ensures the stop-loss is placed just below the most recent significant low, providing a logical and immediate level for risk management.
- Trailing Stop-Loss:
One of the key elements of this strategy is its ability to detect structural liquidity and structural invalidation levels across multiple timeframes to trail the stop-loss once the trade is in running profits.
By utilizing this approach, the strategy allows enough room for price to run.
By using these methods, the strategy dynamically adjusts the initial stop-loss based on market volatility, helping to protect against adverse price movements while allowing for enough room for trades to develop.
Each market behaves differently across various timeframes, and it is essential to test different parameters and optimizations to find out which trailing stop-loss method gives you the desired results and performance.
What type of break-even and take profit identification methods are used in this strategy? What are the underlying calculations?
For Break-Even:
Percentage (%) Based:
Moves the initial stop-loss to the entry price when the price reaches a certain percentage above the entry.
Calculation:
Break-even level = Entry Price * (1 + Percentage / 100)
Example:
If the entry price is $100 and the break-even percentage is 5%, the break-even level is $100 * 1.05 = $105.
Risk-to-Reward (RR) Based:
Moves the initial stop-loss to the entry price when the price reaches a certain RR ratio.
Calculation:
Break-even level = Entry Price + (Initial Risk * RR Ratio)
For TP1 (Take Profit 1):
- You can choose to set a take profit level at which your position gets fully closed or 50% if the TP2 boolean is enabled.
- Similar to break-even, you can select either a percentage (%) or risk-to-reward (RR) based take profit level, allowing you to set your TP1 level as a percentage amount above the entry price or based on RR.
For TP2 (Take Profit 2):
- You can choose to set a take profit level at which your position gets fully closed.
- As with break-even and TP1, you can select either a percentage (%) or risk-to-reward (RR) based take profit level, allowing you to set your TP2 level as a percentage amount above the entry price or based on RR.
What's the day filter Filter, what does it do?
The day filter allows users to customize the session time and choose the specific days they want to include in the strategy session. This helps traders tailor their strategies to particular trading sessions or days of the week when they believe the market conditions are more favorable for their trading style.
Customize Session Time:
Users can define the start and end times for the trading session.
This allows the strategy to only consider trades within the specified time window, focusing on periods of higher market activity or preferred trading hours.
Select Days:
Users can select which days of the week to include in the strategy.
This feature is useful for excluding days with historically lower volatility or unfavorable trading conditions (e.g., Mondays or Fridays).
Benefits:
Focus on Optimal Trading Periods:
By customizing session times and days, traders can focus on periods when the market is more likely to present profitable opportunities.
Avoid Unfavorable Conditions:
Excluding specific days or times can help avoid trading during periods of low liquidity or high unpredictability, such as major news events or holidays.
What tables are available in this script?
- Summary: Provides a general overview, displaying key performance parameters such as Net Profit, Profit Factor, Max Drawdown, Average Trade, Closed Trades and more.
Total Commission: Displays the cumulative commissions incurred from all trades executed within the selected backtesting window. This value is derived by summing the commission fees for each trade on your chart.
Average Commission: Represents the average commission per trade, calculated by dividing the Total Commission by the total number of closed trades. This metric is crucial for assessing the impact of trading costs on overall profitability.
Avg Trade: The sum of money gained or lost by the average trade generated by a strategy. Calculated by dividing the Net Profit by the overall number of closed trades. An important value since it must be large enough to cover the commission and slippage costs of trading the strategy and still bring a profit.
MaxDD: Displays the largest drawdown of losses, i.e., the maximum possible loss that the strategy could have incurred among all of the trades it has made. This value is calculated separately for every bar that the strategy spends with an open position.
Profit Factor: The amount of money a trading strategy made for every unit of money it lost (in the selected currency). This value is calculated by dividing gross profits by gross losses.
Avg RR: This is calculated by dividing the average winning trade by the average losing trade. This field is not a very meaningful value by itself because it does not take into account the ratio of the number of winning vs losing trades, and strategies can have different approaches to profitability. A strategy may trade at every possibility in order to capture many small profits, yet have an average losing trade greater than the average winning trade. The higher this value is, the better, but it should be considered together with the percentage of winning trades and the net profit.
Winrate: The percentage of winning trades generated by a strategy. Calculated by dividing the number of winning trades by the total number of closed trades generated by a strategy. Percent profitable is not a very reliable measure by itself. A strategy could have many small winning trades, making the percent profitable high with a small average winning trade, or a few big winning trades accounting for a low percent profitable and a big average winning trade. Most mean-reversion successful strategies have a percent profitability of 40-80% but are profitable due to risk management control.
BE Trades: Number of break-even trades, excluding commission/slippage.
Losing Trades: The total number of losing trades generated by the strategy.
Winning Trades: The total number of winning trades generated by the strategy.
Total Trades: Total number of taken traders visible your charts.
Net Profit: The overall profit or loss (in the selected currency) achieved by the trading strategy in the test period. The value is the sum of all values from the Profit column (on the List of Trades tab), taking into account the sign.
- Monthly: Displays performance data on a month-by-month basis, allowing users to analyze performance trends over each month and year.
- Weekly: Displays performance data on a week-by-week basis, helping users to understand weekly performance variations.
- UI Table: A user-friendly table that allows users to view and save the selected strategy parameters from user inputs. This table enables easy access to key settings and configurations, providing a straightforward solution for saving strategy parameters by simply taking a screenshot with Alt + S or ⌥ + S.
User-input styles and customizations:
To facilitate studying historical data, all conditions and filters can be applied to your charts. By plotting background colors on your charts, you'll be able to identify what worked and what didn't in certain market conditions.
Please note that all background colors in the style are disabled by default to enhance visualization.
How to Use This Quantitive Strategy Builder to Create a Profitable Edge and System?
Choose Your Strategy mode:
- Decide whether you are creating an investing strategy or a trading strategy.
Select a Market:
- Choose a one-sided market such as stocks, indices, or cryptocurrencies.
Historical Data:
- Ensure the historical data covers at least 10 years of price action for robust backtesting.
Timeframe Selection:
- Choose the timeframe you are comfortable trading with. It is strongly recommended to use a timeframe above 15 minutes to minimize the impact of commissions/slippage on your profits.
Set Commission and Slippage:
- Properly set the commission and slippage in the strategy properties according to your broker/prop firm specifications.
Parameter Optimization:
- Use trial and error to test different parameters until you find the performance results you are looking for in the summary table or, preferably, through deep backtesting using the strategy tester.
Trade Count:
- Ensure the number of trades is 200 or more; the higher, the better for statistical significance.
Positive Average Trade:
- Make sure the average trade is above zero.
(An important value since it must be large enough to cover the commission and slippage costs of trading the strategy and still bring a profit.)
Performance Metrics:
- Look for a high profit factor, and net profit with minimum drawdown.
- Ideally, aim for a drawdown under 20-30%, depending on your risk tolerance.
Refinement and Optimization:
- Try out different markets and timeframes.
- Continue working on refining your edge using the available filters and components to further optimize your strategy.
What makes this strategy original?
QuantBuilder stands out due to its unique combination of quantitative techniques and innovative algorithms that leverage historical data for real-time trading decisions. Unlike most algorithmic strategies that work based on predefined rules, this strategy adapts to real-time market probabilities and expected values, enhancing its reliability. Key features include:
Mathematical Framework: The strategy integrates advanced mathematical concepts, such as probabilities and expected values, to assess trade viability and optimize decision-making.
Multi-Timeframe Analysis: By utilizing multi-timeframe probabilities, QuantBuilder provides a comprehensive view of market conditions, enhancing the accuracy of entry and exit points.
Dynamic Market Structure Identification: The script employs a systematic approach to identify market structure changes, utilizing a blend of swing highs and lows to detect contextual/direction bias of the market.
Built-in Trailing Stop Loss: The strategy features a dynamic trailing stop loss based on multi-timeframe analysis of market structure. This allows traders to lock in profits while adapting to changing market conditions, ensuring that exits are executed at optimal levels without prematurely closing positions.
Robust Performance Metrics: With detailed performance tables and visualizations, users can easily evaluate strategy effectiveness and adjust parameters based on historical performance.
Adaptability: The strategy is designed to work across various markets and timeframes, making it versatile for different trading styles and objectives.
Suitability for Investors and Traders: QuantBuilder is ideal for both investors and traders looking to rely on mathematically proven data to create profitable strategies, ensuring that decisions are grounded in quantitative analysis.
These original elements combine to create a powerful tool that can help both traders and investors to build and refine profitable strategies based on algorithmic quantitative analysis.
Terms and Conditions | Disclaimer
Our charting tools are provided for informational and educational purposes only and should not be construed as financial, investment, or trading advice. They are not intended to forecast market movements or offer specific recommendations. Users should understand that past performance does not guarantee future results and should not base financial decisions solely on historical data.
Built-in components, features, and functionalities of our charting tools are the intellectual property of @Fractalyst Unauthorized use, reproduction, or distribution of these proprietary elements is prohibited.
By continuing to use our charting tools, the user acknowledges and accepts the Terms and Conditions outlined in this legal disclaimer and agrees to respect our intellectual property rights and comply with all applicable laws and regulations.
Algorithmictrading
AlgoBuilder [Mean-Reversion] | FractalystWhat's the strategy's purpose and functionality?
This strategy is designed for both traders and investors looking to rely and trade based on historical and backtested data using automation.
The main goal is to build profitable mean-reversion strategies that outperform the underlying asset in terms of returns while minimizing drawdown.
For example, as for a benchmark, if the S&P 500 (SPX) has achieved an estimated 10% annual return with a maximum drawdown of -57% over the past 20 years, using this strategy with different entry and exit techniques, users can potentially seek ways to achieve a higher Compound Annual Growth Rate (CAGR) while maintaining a lower maximum drawdown.
Although the strategy can be applied to all markets and timeframes, it is most effective on stocks, indices, future markets, cryptocurrencies, and commodities and JPY currency pairs given their trending behaviors.
In trending market conditions, the strategy employs a combination of moving averages and diverse entry models to identify and capitalize on upward market movements. It integrates market structure-based moving averages and bands mechanisms across different timeframes and provides exit techniques, including percentage-based and risk-reward (RR) based take profit levels.
Additionally, the strategy has also a feature that includes a built-in probability function for traders who want to implement probabilities right into their trading strategies.
Performance summary, weekly, and monthly tables enable quick visualization of performance metrics like net profit, maximum drawdown, profit factor, average trade, average risk-reward ratio (RR), and more.
This aids optimization to meet specific goals and risk tolerance levels effectively.
-----
How does the strategy perform for both investors and traders?
The strategy has two main modes, tailored for different market participants: Traders and Investors.
Trading:
1. Trading:
- Designed for traders looking to capitalize on bullish trending markets.
- Utilizes a percentage risk per trade to manage risk and optimize returns.
- Suitable for active trading with a focus on mean-reversion and risk per trade approach.
◓: Mode | %: Risk percentage per trade
3. Investing:
- Geared towards investors who aim to capitalize on bullish trending markets without using leverage while mitigating the asset's maximum drawdown.
- Utilizes pre-define percentage of the equity to buy, hold, and manage the asset.
- Focuses on long-term growth and capital appreciation by fully investing in the asset during bullish conditions.
- ◓: Mode | %: Risk not applied (In investing mode, the strategy uses 10% of equity to buy the asset)
-----
What's is FRMA? How does the triple bands work? What are the underlying calculations?
Middle Band (FRMA):
The middle band is the core of the FRMA system. It represents the Fractalyst Moving Average, calculated by identifying the most recent external swing highs and lows in the market structure.
By determining these external swing pivot points, which act as significant highs and lows within the market range, the FRMA provides a unique moving average that adapts to market structure changes.
Upper Band:
The upper band shows the average price of the most recent external swing highs.
External swing highs are identified as the highest points between pivot points in the market structure.
This band helps traders identify potential overbought conditions when prices approach or exceed this upper band.
Lower Band:
The lower band shows the average price of the most recent external swing lows.
External swing lows are identified as the lowest points between pivot points in the market structure.
The script utilizes this band to identify potential oversold conditions, triggering entry signals as prices approach or drop below the lower band.
Adjustments Based on User Inputs:
Users can adjust how the upper and lower bands are calculated based on their preferences:
Upper/Lower: This method calculates the average bands using the prices of external swing highs and lows identified in the market.
Percentage Deviation from FRMA: Alternatively, users can opt to calculate the bands based on a percentage deviation from the middle FRMA. This approach provides flexibility to adjust the width of the bands relative to market conditions and volatility.
-----
What's the purpose of using moving averages in this strategy? What are the underlying calculations?
Using moving averages is a widely-used technique to trade with the trend.
The main purpose of using moving averages in this strategy is to filter out bearish price action and to only take trades when the price is trading ABOVE specified moving averages.
The script uses different types of moving averages with user-adjustable timeframes and periods/lengths, allowing traders to try out different variations to maximize strategy performance and minimize drawdowns.
By applying these calculations, the strategy effectively identifies bullish trends and avoids market conditions that are not conducive to profitable trades.
The MA filter allows traders to choose whether they want a specific moving average above or below another one as their entry condition.
This comparison filter can be turned on (>) or off.
For example, you can set the filter so that MA#1 > MA#2, meaning the first moving average must be above the second one before the script looks for entry conditions. This adds an extra layer of trend confirmation, ensuring that trades are only taken in more favorable market conditions.
⍺: MA Period | Σ: MA Timeframe
-----
What entry modes are used in this strategy? What are the underlying calculations?
The strategy by default uses two different techniques for the entry criteria with user-adjustable left and right bars: Breakout and Fractal.
1. Breakout Entries :
- The strategy looks for pivot high points with a default period of 3.
- It stores the most recent high level in a variable.
- When the price crosses above this most recent level, the strategy checks if all conditions are met and the bar is closed before taking the buy entry.
◧: Pivot high left bars period | ◨: Pivot high right bars period
2. Fractal Entries :
- The strategy looks for pivot low points with a default period of 3.
- When a pivot low is detected, the strategy checks if all conditions are met and the bar is closed before taking the buy entry.
◧: Pivot low left bars period | ◨: Pivot low right bars period
2. Hunt Entries :
- The strategy identifies a candle that wicks through the lower FRMA band.
- It waits for the next candle to close above the low of the wick candle.
- When this condition is met and the bar is closed, the strategy takes the buy entry.
By utilizing these entry modes, the strategy aims to capitalize on bullish price movements while ensuring that the necessary conditions are met to validate the entry points.
-----
What type of stop-loss identification method are used in this strategy? What are the underlying calculations?
Initial Stop-Loss:
1. ATR Based:
The Average True Range (ATR) is a method used in technical analysis to measure volatility. It is not used to indicate the direction of price but to measure volatility, especially volatility caused by price gaps or limit moves.
Calculation:
- To calculate the ATR, the True Range (TR) first needs to be identified. The TR takes into account the most current period high/low range as well as the previous period close.
The True Range is the largest of the following:
- Current Period High minus Current Period Low
- Absolute Value of Current Period High minus Previous Period Close
- Absolute Value of Current Period Low minus Previous Period Close
- The ATR is then calculated as the moving average of the TR over a specified period. (The default period is 14).
Example - ATR (14) * 2
⍺: ATR period | Σ: ATR Multiplier
2. ADR Based:
The Average Day Range (ADR) is an indicator that measures the volatility of an asset by showing the average movement of the price between the high and the low over the last several days.
Calculation:
- To calculate the ADR for a particular day:
- Calculate the average of the high prices over a specified number of days.
- Calculate the average of the low prices over the same number of days.
- Find the difference between these average values.
- The default period for calculating the ADR is 14 days. A shorter period may introduce more noise, while a longer period may be slower to react to new market movements.
Example - ADR (20) * 2
⍺: ADR period | Σ: ADR Multiplier
3. PL Based:
This method places the stop-loss at the low of the previous candle.
If the current entry is based on the hunt entry strategy, the stop-loss will be placed at the low of the candle that wicks through the lower FRMA band.
Example:
If the previous candle's low is 100, then the stop-loss will be set at 100.
This method ensures the stop-loss is placed just below the most recent significant low, providing a logical and immediate level for risk management.
Application in Strategy (ATR/ADR):
- The strategy calculates the current bar's ADR/ATR with a user-defined period.
- It then multiplies the ADR/ATR by a user-defined multiplier to determine the initial stop-loss level.
By using these methods, the strategy dynamically adjusts the initial stop-loss based on market volatility, helping to protect against adverse price movements while allowing for enough room for trades to develop.
Each market behaves differently across various timeframes, and it is essential to test different parameters and optimizations to find out which trailing stop-loss method gives you the desired results and performance.
-----
What type of break-even and take profit identification methods are used in this strategy? What are the underlying calculations?
For Break-Even:
Percentage (%) Based:
Moves the initial stop-loss to the entry price when the price reaches a certain percentage above the entry.
Calculation:
Break-even level = Entry Price * (1 + Percentage / 100)
Example:
If the entry price is $100 and the break-even percentage is 5%, the break-even level is $100 * 1.05 = $105.
Risk-to-Reward (RR) Based:
Moves the initial stop-loss to the entry price when the price reaches a certain RR ratio.
Calculation:
Break-even level = Entry Price + (Initial Risk * RR Ratio)
Example:
If the entry price is $100, the initial risk is $10, and the RR ratio is 2, the break-even level is $100 + ($10 * 2) = $120.
FRMA Based:
Moves the stop-loss to break-even when the price hits the FRMA level at which the entry was taken.
Calculation:
Break-even level = FRMA level at the entry
Example:
If the FRMA level at entry is $102, the break-even level is set to $102 when the price reaches $102.
For TP1 (Take Profit 1):
- You can choose to set a take profit level at which your position gets fully closed or 50% if the TP2 boolean is enabled.
- Similar to break-even, you can select either a percentage (%) or risk-to-reward (RR) based take profit level, allowing you to set your TP1 level as a percentage amount above the entry price or based on RR.
For TP2 (Take Profit 2):
- You can choose to set a take profit level at which your position gets fully closed.
- As with break-even and TP1, you can select either a percentage (%) or risk-to-reward (RR) based take profit level, allowing you to set your TP2 level as a percentage amount above the entry price or based on RR.
When Both Percentage (%) Based and RR Based Take Profit Levels Are Off:
The script will adjust the take profit level to the higher FRMA band set within user inputs.
Calculation:
Take profit level = Higher FRMA band length/timeframe specified by the user.
This ensures that when neither percentage-based nor risk-to-reward-based take profit methods are enabled, the strategy defaults to using the higher FRMA band as the take profit level, providing a consistent and structured approach to profit-taking.
For TP1 and TP2, it's specifying the price levels at which the position is partially or fully closed based on the chosen method (percentage or RR) above the entry price.
These calculations are crucial for managing risk and optimizing profitability in the strategy.
⍺: BE/TP type (%/RR) | Σ: how many RR/% above the current price
-----
What's the ADR filter? What does it do? What are the underlying calculations?
The Average Day Range (ADR) measures the volatility of an asset by showing the average movement of the price between the high and the low over the last several days.
The period of the ADR filter used in this strategy is tied to the same period you've used for your initial stop-loss.
Users can define the minimum ADR they want to be met before the script looks for entry conditions.
ADR Bias Filter:
- Compares the current bar ADR with the ADR (Defined by user):
- If the current ADR is higher, it indicates that volatility has increased compared to ADR (DbU).(⬆)
- If the current ADR is lower, it indicates that volatility has decreased compared to ADR (DbU).(⬇)
Calculations:
1. Calculate ADR:
- Average the high prices over the specified period.
- Average the low prices over the same period.
- Find the difference between these average values in %.
2. Current ADR vs. ADR (DbU):
- Calculate the ADR for the current bar.
- Calculate the ADR (DbU).
- Compare the two values to determine if volatility has increased or decreased.
By using the ADR filter, the strategy ensures that trades are only taken in favorable market conditions where volatility meets the user's defined threshold, thus optimizing entry conditions and potentially improving the overall performance of the strategy.
>: Minimum required ADR for entry | %: Current ADR comparison to ADR of 14 days ago.
-----
What's the probability filter? What are the underlying calculations?
The probability filter is designed to enhance trade entries by using buyside liquidity and probability analysis to filter out unfavorable conditions.
This filter helps in identifying optimal entry points where the likelihood of a profitable trade is higher.
Calculations:
1. Understanding Swing highs and Swing Lows
Swing High: A Swing High is formed when there is a high with 2 lower highs to the left and right.
Swing Low: A Swing Low is formed when there is a low with 2 higher lows to the left and right.
2. Understanding the purpose and the underlying calculations behind Buyside, Sellside and Equilibrium levels.
3. Understanding probability calculations
1. Upon the formation of a new range, the script waits for the price to reach and tap into equilibrium or the 50% level. Status: "⏸" - Inactive
2. Once equilibrium is tapped into, the equilibrium status becomes activated and it waits for either liquidity side to be hit. Status: "▶" - Active
3. If the buyside liquidity is hit, the script adds to the count of successful buyside liquidity occurrences. Similarly, if the sellside is tapped, it records successful sellside liquidity occurrences.
5. Finally, the number of successful occurrences for each side is divided by the overall count individually to calculate the range probabilities.
Note: The calculations are performed independently for each directional range. A range is considered bearish if the previous breakout was through a sellside liquidity. Conversely, a range is considered bullish if the most recent breakout was through a buyside liquidity.
Example - BSL > 55%
-----
What's the range length Filter? What are the underlying calculations?
The range length filter identifies the price distance between buyside and sellside liquidity levels in percentage terms. When enabled, the script only looks for entries when the minimum range length is met. This helps ensure that trades are taken in markets with sufficient price movement.
Calculations:
Range Length (%) = ( ( Buyside Level − Sellside Level ) / Current Price ) ×100
Range Bias Identification:
Bullish Bias: The current range price has broken above the previous external swing high.
Bearish Bias: The current range price has broken below the previous external swing low.
Example - Range length filter is enabled | Range must be above 1%
>: Minimum required range length for entry | %: Current range length percentage in a (Bullish/Bearish) range
-----
What's the day filter Filter, what does it do?
The day filter allows users to customize the session time and choose the specific days they want to include in the strategy session. This helps traders tailor their strategies to particular trading sessions or days of the week when they believe the market conditions are more favorable for their trading style.
Customize Session Time:
Users can define the start and end times for the trading session.
This allows the strategy to only consider trades within the specified time window, focusing on periods of higher market activity or preferred trading hours.
Select Days:
Users can select which days of the week to include in the strategy.
This feature is useful for excluding days with historically lower volatility or unfavorable trading conditions (e.g., Mondays or Fridays).
Benefits:
Focus on Optimal Trading Periods:
By customizing session times and days, traders can focus on periods when the market is more likely to present profitable opportunities.
Avoid Unfavorable Conditions:
Excluding specific days or times can help avoid trading during periods of low liquidity or high unpredictability, such as major news events or holidays.
Increased Flexibility: The filter provides increased flexibility, allowing traders to adapt the strategy to their specific needs and preferences.
Example - Day filter | Session Filter
θ: Session time | Exchange time-zone
-----
What tables are available in this script?
Table Type:
- Summary: Provides a general overview, displaying key performance parameters such as Net Profit, Profit Factor, Max Drawdown, Average Trade, Closed Trades and more.
Avg Trade: The sum of money gained or lost by the average trade generated by a strategy. Calculated by dividing the Net Profit by the overall number of closed trades. An important value since it must be large enough to cover the commission and slippage costs of trading the strategy and still bring a profit.
MaxDD: Displays the largest drawdown of losses, i.e., the maximum possible loss that the strategy could have incurred among all of the trades it has made. This value is calculated separately for every bar that the strategy spends with an open position.
Profit Factor: The amount of money a trading strategy made for every unit of money it lost (in the selected currency). This value is calculated by dividing gross profits by gross losses.
Avg RR: This is calculated by dividing the average winning trade by the average losing trade. This field is not a very meaningful value by itself because it does not take into account the ratio of the number of winning vs losing trades, and strategies can have different approaches to profitability. A strategy may trade at every possibility in order to capture many small profits, yet have an average losing trade greater than the average winning trade. The higher this value is, the better, but it should be considered together with the percentage of winning trades and the net profit.
Winrate: The percentage of winning trades generated by a strategy. Calculated by dividing the number of winning trades by the total number of closed trades generated by a strategy. Percent profitable is not a very reliable measure by itself. A strategy could have many small winning trades, making the percent profitable high with a small average winning trade, or a few big winning trades accounting for a low percent profitable and a big average winning trade. Most mean-reversion successful strategies have a percent profitability of 40-80% but are profitable due to risk management control.
BE Trades: Number of break-even trades, excluding commission/slippage.
Losing Trades: The total number of losing trades generated by the strategy.
Winning Trades: The total number of winning trades generated by the strategy.
Total Trades: Total number of taken traders visible your charts.
Net Profit: The overall profit or loss (in the selected currency) achieved by the trading strategy in the test period. The value is the sum of all values from the Profit column (on the List of Trades tab), taking into account the sign.
- Monthly: Displays performance data on a month-by-month basis, allowing users to analyze performance trends over each month.
- Weekly: Displays performance data on a week-by-week basis, helping users to understand weekly performance variations.
- OFF: Hides the performance table.
Profit Color:
- Allows users to set the color for representing profit in the performance table, helping to quickly distinguish profitable periods.
Loss Color:
- Allows users to set the color for representing loss in the performance table, helping to quickly identify loss-making periods.
These customizable tables provide traders with flexible and detailed performance analysis, aiding in better strategy evaluation and optimization.
-----
User-input styles and customizations:
To facilitate studying historical data, all conditions and rules can be applied to your charts. By plotting background colors on your charts, you'll be able to identify what worked and what didn't in certain market conditions.
Please note that all background colors in the style are disabled by default to enhance visualization.
-----
How to Use This Algobuilder to Create a Profitable Edge and System:
Choose Your Strategy mode:
- Decide whether you are creating an investing strategy or a trading strategy.
Select a Market:
- Choose a one-sided market such as stocks, indices, or cryptocurrencies.
Historical Data:
- Ensure the historical data covers at least 10 years of price action for robust backtesting.
Timeframe Selection:
- Choose the timeframe you are comfortable trading with. It is strongly recommended to use a timeframe above 15 minutes to minimize the impact of commissions/slippage on your profits.
Set Commission and Slippage:
- Properly set the commission and slippage in the strategy properties according to your broker or prop firm specifications.
Parameter Optimization:
- Use trial and error to test different parameters until you find the performance results you are looking for in the summary table or, preferably, through deep backtesting using the strategy tester.
Trade Count:
- Ensure the number of trades is 100 or more; the higher, the better for statistical significance.
Positive Average Trade:
- Make sure the average trade value is above zero.
(An important value since it must be large enough to cover the commission and slippage costs of trading the strategy and still bring a profit.)
Performance Metrics:
- Look for a high profit factor, and net profit with minimum drawdown.
- Ideally, aim for a drawdown under 20-30%, depending on your risk tolerance.
Refinement and Optimization:
- Try out different markets and timeframes.
- Continue working on refining your edge using the available filters and components to further optimize your strategy.
Automation:
- Once you’re confident in your strategy, you can use the automation section to connect the algorithm to your broker or prop firm.
- Trade a fully automated and backtested trading strategy, allowing for hands-free execution and management.
-----
What makes this strategy original?
1. Incorporating direct integration of probabilities into the strategy.
2. Utilizing built-in market structure-based moving averages across various timeframes.
4. Offering both investing and trading strategies, facilitating optimization from different perspectives.
5. Automation for efficient execution.
6. Providing a summary table for instant access to key parameters of the strategy.
-----
How to use automation?
For Traders:
1. Ensure the strategy parameters are properly set based on your optimized parameters.
2. Enter your PineConnector License ID in the designated field.
3. Specify the desired risk level.
4. Provide the Metatrader symbol.
5. Check for chart updates to ensure the automation table appears on the top right corner, displaying your License ID, risk, and symbol.
6. Set up an alert with the strategy selected as Condition and the Message as {{strategy.order.alert_message}}.
7. Activate the Webhook URL in the Notifications section, setting it as the official PineConnector webhook address.
8. Double-check all settings on PineConnector to ensure the connection is successful.
9. Create the alert for entry/exit automation.
For Investors:
1. Ensure the strategy parameters are properly set based on your optimized parameters.
2. Choose "Investing" in the user-input settings.
3. Create an alert with a specified name.
4. Customize the notifications tab to receive alerts via email.
5. Buying/selling alerts will be triggered instantly upon entry or exit order execution.
-----
Terms and Conditions | Disclaimer
Our charting tools are provided for informational and educational purposes only and should not be construed as financial, investment, or trading advice. They are not intended to forecast market movements or offer specific recommendations. Users should understand that past performance does not guarantee future results and should not base financial decisions solely on historical data.
Built-in components, features, and functionalities of our charting tools are the intellectual property of @Fractalyst Unauthorized use, reproduction, or distribution of these proprietary elements is prohibited.
By continuing to use our charting tools, the user acknowledges and accepts the Terms and Conditions outlined in this legal disclaimer and agrees to respect our intellectual property rights and comply with all applicable laws and regulations.
Hulk Grid Algorithm V2 - The Quant ScienceIt's the latest proprietary grid algorithm developed by our team. This software represents a clearer and more comprehensive modernization of the deprecated Hulk Grid Algorithm. In this new release, we have optimized the source code architecture and investment logic, which we will describe in detail below.
Overview
Hulk Grid Algorithm V2 is designed to optimize returns in sideways market conditions. In this scenario, the algorithm divides purchases with long orders at each level of the grid. Unlike a typical grid algorithm, this version applies an anti-martingale model to mitigate volatility and optimize the average entry price. Starting from the lower level, the purchase quantity is increased at each new subsequent level until reaching the upper level. The initial quantity of the first order is fixed at 0.50% of the initial capital. With each new order, the initial quantity is multiplied by a value equal to the current grid level (where 1 is the lower level and 10 is the upper level).
Example: Let's say we have an initial capital of $10,000. The initial capital for the first order would be $50 * 1 = $50, for the second order $50 * 2 = $100, for the third order $50 * 3 = $150, and so on until reaching the upper level.
All previously opened orders are closed using a percentage-based stop-loss and take-profit, calculated based on the extremes of the grid.
Set Up
As mentioned earlier, the user's goal is to analyze this strategy in markets with a lack of trend, also known as sideways markets. After identifying a price range within which the asset tends to move, the user can choose to create the grid by placing the starting price at the center of the range. This way, they can consider trading the asset, if the backtesting generates a return greater than the Buy & Hold return.
Grid Configuration
To create the grid, it's sufficient to choose the starting price during the launch phase. This level will be the center of the grid from which the upper and lower levels will be calculated. The grid levels are computed using an arithmetic method, adding and subtracting a configurable fixed amount from the user interface (Grid Step $).
Example: Let's imagine choosing 1000 as the starting price and 50 as the Grid Step ($). The upper levels will be 1000, 1050, 1100, 1150, 1200. The lower levels will be 950, 900, 850, 800, and 750.
Markets
This software can be used in all markets: stocks, indices, commodities, cryptocurrencies, ETFs, Forex, etc.
Application
With this backtesting software, is possible to analyze the strategy and search for markets where it can generate better performance than Buy & Hold returns. There are no alerts or automatic investment mechanisms, and currently, the strategy can only be executed manually.
Design
Is possible to modify the grid style and customize colors by accessing the Properties section of the user interface.
Hobbiecode - Five Day Low RSI StrategyThis is a simple strategy that is working well on SPY but also well performing on Mini Futures SP500. The strategy is composed by the followin rules:
1. If today’s close is below yesterday’s five-day low, go long at the close.
2. Sell at the close when the two-day RSI closes above 50.
3. There is a time stop of five days if the sell criterium is not triggered.
If you backtest it on Mini Futures SP500 you will be able to track data from 1993. It is important to select D1 as timeframe.
Please share any comment or idea below.
Have a good trading,
Ramón.
Risk Reward Calculator [lovealgotrading]
OVERVIEW:
This Risk Reward Calculator strategy can help you maximize your RR value with help of algorithmic trading.
INDICATOR:
I wanted to setup my trades more easier with this indicator, I didn't want to calculate everytime before orders, with help this indicator we can calculate R:R value, avarage price, stoploss price, take-profit price, order prices, all position cost and more ...
Our strategy is a risk revard calculation indicator that is made easy to use by using visualized lines and panels, and also has algorithmic trading support.
With the help of this indicator, we can quickly and easily calculate our risk reward values and enter the positions.
If we want to ensure that our balance grows regularly while trading in the stock market, we need to manage the risks and rewards otherwise we may fall below our initial balance at the end of the day, even if we seem to be winning.
What is the Risk-Reward value ?
This value is a value that shows how many times the amount of risk we take when entering the position is successful, we will earn.
- For example, you risked $100 while entering the trade, so if your trade stops, you will lose 100 $.
Your Risk-Reward(RR) value is 2 means that if your position is successful, you will have 200 $ in your pocket.
A trader's success is determined by the amount of R he earns monthly or yearly, not how much money he makes.
What is different in this indicator ?
I want to say thank you to © EvoCrypto. His Calculator (weighted) – evo indicator helped me when I was developed my indicator.
I want to explain what I have improved:
1-In this strategy, we can determine the time period in which we want to open our positions.
2-We can open a maximum of 4 positions in the same direction and close our positions at a single level. StopLoss or TakeProfit
3-This indicator, which works in the form of a strategy, shows where our positions have been opened or closed. With the help of this, it helps us to determine our strategy in our future positions more accurately.
4-The most important improvement is that we do not miss our positions with the help of alarms (WEB HOOK). if we want, we receive by quickly connecting all these positions to our robot, the software can enter and exit the position while we are busy.
IMPLEMENTATION DETAILS – SETTINGS:
1 - We can set the start and end dates of the positions we will take.
2- We can set our take profit, stoploss levels.
3- If your trade is stopped, we can determine the amount of the trade that we will lose.
4- We can adjust our entry levels to positions and our position sizes at entry levels.
(Sum of positions weight must be 100%)
5- We can receive our positions even if we are busy with the help of algorithmic trading. For this, we must paste our Jshon codes into the fields specified in the settings panel.
6- Finally, we can change the settings we want and don't want to have in our visual elements.
Let's make a LONG side example together
We have determined our positions to enter stoploss, take profit and long positions. We did not forget to set the start time of our strategy
Our strategy appear on the graph as follows.
Our strategy has calculated the total position size, our R-R value, the distance of the current price to the stop and take profit levels, in short, a lot of things we could look visually.
Notes:
If you're going to connect this bot to an automatic Long or Short direction,
Don’t forget! you need to Webhook URL,
Don’t miss paste this code to your message window {{strategy.order.alert_message}}
ALSO:
If you have any ideas what to add to my work to add more sources or make calculations cooler, feel free to write me.
AUTOMATIC GRID BOT STRATEGY [ilovealgotrading]
OVERVIEW:
This Grid trading strategy can help you maximize your profit in a ranging sideways market with no clear direction.
INDICATOR:
We can get some money by taking advantage of the movement of the price between the range we have determined.
Short positions are opened while the price is rising, long positions are opened while the price is falling.
Therefore, there is no need to predict the trend direction.
What is different in this indicator:
I want to say thank you to © thequantscience. His GRID SPOT TRADING ALGORITHM - GRID BOT TRADING strategy helped me when I was writing my indicator.
I want to explain what I have improved:
1- Grid strategy is a type of strategy that can be traded in very short time frames and users can trade this strategy algorithmically by connecting this strategy to their own accounts with the help of API systems. For this reason, I have developed a software that can give us signals by dynamically changing the long and short messages when users are trading.
2- We can change the start and end dates of our grid bot as we want. It is necessary to use this setting when setting up automatic bots, so that previously opened transactions are not taken into account.
3 - Lot or quantity size should not be excessively small when users are taking automatic trades because exchanges have limitations, to avoid this problem, I have prevented this error by automatically rounding up to the nearest quantity size inside the software.
4 - Users can avoid excessive losses by using stop loss on this grid bot if they wish.
5 - When our price is over the range high or below the range low, our open positions are closed, if the stop button is active. We can also change which close price time frame we take as a basis from the settings.
6 -Users can set how many dollars they can enter per transaction while performing their transactions automatically.
IMPLEMENTATION DETAILS – SETTINGS:
This script allows the user to choose the highs and lows leves of our range. Our bot trades in the specified range.
1. This strategy allows us to set start and end backtest dates.
2. We can change range high and range low leves of our bot
3. IF people want to trade algorithmically with the help of this bot, there are 6 different input systems that will receive the Json codes as an alarm
4. IF the price closes above the upper line or below the lower line, all transactions will be closed. We can determine in which time frame our transactions will be stopped if the price closes outside these levels.We can adjust how our bot works by activating or turning off the Stop Loss button.
5. In this strategy, you can determine your dollar cost for per position.
6. The user can also divide the interval we have determined into 10 parts or 20 equal parts.
7. The grid is divided and colored at the interval we set. At the same time, if we don't want we can turn off colored channels.
Notes:
If you're going to connect this bot to an automatic Long and Short direction,
Don’t forget! you need to Webhook URL,
Don’t miss paste this code to your message window {{strategy.order.alert_message}}
ALSO:
Set your range below the support zones and above the resistance zones.
Don't be afraid to take a wide range, it doesn't matter if you make a little money, the important thing is that you don't lose money.
If you have any ideas what to add to my work to add more sources or make calculations cooler, suggest in DM .
Cloud X MesoHello there fellow Traders!
Thanks for stopping by, so today I will be covering everything you need to to know about this TradingView strategy.
Below I will discuss everything you need to know about this strategy so you can get a full grasp of what the strategy is, the features, what it does, how it works, the benefits of how this strategy can help you, and the results.
What is Cloud X Meso?
-Cloud X Meso is a strategy that consists of 7 indicators to all line up for total confluence to take a buy or sell once all 6 indicators conditions are met. This strategy does not repaint and doesn't require any technical analysis to be used. The strategy can be used on any timeframe, and any instrument.
-I have optimized many different variations for different types of trading instruments of this strategy ready to be used. The difference of this strategy is that these variations do not need any reoptimization to keep up with recent market conditions since there are hardly any inputs used, which prevents common overfitting problems. The main goal was for this strategy to be automated, as well as plug and play or you can officially consider this as set and forever forget.
What does this strategy do?
-The main goal for this strategy is to catch long or short term trends by waiting for all 7 indicators to line up as well as using customized trading times to trade certain sessions where there is high amounts of volume in the market. This strategy doesn't always need to have a clear trending market, since it can also catch short term trends in choppy markets as well. Overall, the strategy tell you when it buys, sells, and exits after all conditions are met.
How does the strategy work?
-The way that this strategy works is when all of the indicators confluences are met. Next, a buy or sell label will print and the candles colors will color blue or red to show that the trade is in the buy or sell position followed along with a magenta colored line which is the trailing stop to follow the trade until the trade exits from the trailing stop being hit or if the strategies exit condition is met.
-The strategy does have a set Take Profit target since it relies on the trailing stop to end the trade. This is beneficial so you can catch any size of a trend move when the strategy is in high volume market sessions. You catch these trends by customizing the settings to toggle on or off certain indicators, functions, configuring a customized trading time, and toggling on or off certain trading days to make a specific approach for fine tuning a pair to trade in a certain time window with high amounts of volume to catch trending moves whether it be a long or short term trend.
Below I will explain each functionality of the strategy for you to better understand the different ways you can adjust the settings of this strategy.
Backtest Settings:
-You can use these settings to determine a start / end date of what results you would like to see in the strategy tester.
-You can determine the $ amount you would like to see on strategy testers results to be in terms of net profit and max drawdown.
-You can choose whether you want the strategy to take buys only, sells only, or buys and sells.
Automation:
-Compatible with Pine Connectors to fully automate this strategy for MT4/5
-It uses a % based risk when placing trades so you won't have to calculate a proper lot size or dollar amount.
-You can also put the symbol of what that strategy will be trading on so you know what pair its trading.
Custom Trading Times:
-When you customize a trading time for the strategy to trade in, the background will turn blue for that specific time window, and you can use the "Session Exit" function to have trades close once the time window ends when toggled on, or you can have the existing trades close on their own when "Session Exit" is toggled off.
Dynamic Trailing:
-The algorithm uses a volatility based indicator to determine proper stop loss placement depending on how volatile the market is. This will prevent you from guesstimating if your stop loss is too big or too small.
-When Dynamic trailing is off, then the strategy will use a Risk Reward based stop loss to trail everytime the trades hits a new Risk Reward target.
-You can also toggle on or off for the stop loss to go to break even once the trade hits a 1:1 Risk Reward.
Directional Bias Settings:
-This indicator is the main directional bias that uses a multi timeframe function to determine the directional bias, you can also use the Exponential Moving Average as a form of directional bias instead, or you can use both of them to work together to find the directional bias. You can also toggle each one on or off
Entry / Exit Settings:
-This indicator also uses a multi timeframe function but it determines the entry and exit for a trade when all confluences are met. You can also toggle the entry and exit functions on or off.
1 Candle Rule:
-This feature is inspired by No Nonsense Forex (NNFX) the main function of this is if your entry doesn't meet all the entry conditions, then the strategy will wait 1 more candle to meet all the entry conditions to take a trade.
No Trade Zone:
-This feature will uses a Volume based indicator to filter out low volume markets. The candles will turn grey to indicate the algorithm not to take trades, and you can also customize the sensitivity of how strong this indicator will filter out the low volume in the markets.
Indicator functions
Each indicator plays a certain role and also meets certain conditions when a buy or sell trade is placed. I will reveal 3 out of 7 of the indicators used to preserve the uniqueness of this strategy but overall, the logic of this strategies main goal is to ride long or short terms trends while getting dynamic Risk Reward trades.
-The first indicator that the strategy uses an Exponential Moving Average that is customizable, and is used as a form of a filter for either a long or short term directional bias to filter out false signals to help the algorithm trade with the trend.
-The second indicator that the strategy uses is an Oscillator which is the Wavetrend and this indicators functionality for the algorithm is used for the its buy and sell signals to line up with all the other indicators for confluence. This indicator can also be toggled on or off for you own preference
-The third indicator used is the Volume indicator, and this is used to give the other indicators the green light to enter a trade if there are high amounts of volume in the market.
What are the benefits of using this algorithm?
Stress Free Trading:
-Once automated, you will no longer need to stare at the charts all day, as well as trying to execute the trades on time or worried that you missed a setup. Or you can choose to take trades manually when a buy or sell signal comes up
Stress Free Risk Management:
-All you have to do is provide a risk % and the algorithm will do the rest of the work calculating the stop loss, exiting trades, etc. No more needing to find the right lot size, or dollar amount, all in all the strategy will manage the trades for you.
Psychology:
-when you choose to have a systematic trading approach, it eliminates a lot bad habits from human nature
What are the results like?
-I have multiple different variations of results of this strategy, but I will share one of the results.
Here is a screenshot below of what this strategy can do from just one of the variations.
The backtest below was done with another variation on simulating a 100k account risking 0.50% per trade.
Thank you for taking the time to read through this whole guide, and I hope this helped you better understand the strategy.
Reinforced RSI - The Quant Science This strategy was designed and written with the goal of showing and motivating the community how to integrate our 'Probabilities' module with their own script.
We have recreated one of the simplest strategies used by many traders. The strategy only trades long and uses the overbought and oversold levels on the RSI indicator.
We added stop losses and take profits to offer more dynamism to the strategy. Then the 'Probabilities' module was integrated to create a probabilistic reinforcement on each trade.
Specifically, each trade is executed, only if the past probabilities of making a profitable trade is greater than or equal to 51%. This greatly increased the performance of the strategy by avoiding possible bad trades.
The backtesting was calculated on the NASDAQ:TSLA , on 15 minutes timeframe.
The strategy works on Tesla using the following parameters:
1. Lenght: 13
2. Oversold: 40
3. Overbought: 70
4. Lookback: 50
5. Take profit: 3%
6. Stop loss: 3%
Time period: January 2021 to date.
Our Probabilities Module, used in the strategy example:
Hulk Grid Algorithm - The Quant ScienceGrid-based intraday algorithm that works 50% in trend following and 50% in swing trading. Orders are executed on a grid of 10 levels. The grid levels are dynamic and calculated on the difference between the previous day's open and close. The algorithm makes only long trades based on the following logic:
1. The daily close of the previous day is analyzed, the first condition is met if the previous day was bullish, closing higher than the 'opening.
2. Must pass 'x' number of bars before placing market orders.
3. The range, as the difference between close and open of the previous day must be greater than 'x'.
If these three conditions are met then the algorithm will proceed to place long orders. On a total of 10 grid levels, up to five trades are executed per day.
If the current close is above level 1 of the grid (previous day's close) then trend following trading will take place, working on the upper 5 levels. In this case each order is placed starting at level 1 and closed at each level above.
If the current close is below level 1 of the grid (previous day's open) then swing trading will be carried out, working on the lower 5 levels. In this case each order is placed starting at level 2 and closed at the upper level.
If at the time of order execution the price is above or below the stop loss and take profit levels, the algorithm will cancel the orders and prevent trading.
All orders are closed exclusively for two reasons:
1. If the stop loss or take profit level is confirmed.
2. If the daily session is ended.
UI Interface
You can adjust:
1. Backtesting period
2. 'x' number of bars before placing orders at the market (remember to always add 2 to the number you enter in the user interface if you enter 2 then execution will occur at the market opening after the fourth bar).
3. Intercepted price range between close and open of the previous day, avoiding trading on days when the range is too low.
4. Stop loss, level calculated from the 'last lower grid, if the market breaks this level the grid is destroyed and closes all open positions.
5. Take profit, the level calculated from the last upper grid, if the market breaks this level the grid is destroyed and closes all open positions.
The backtesting you see in the example was generated on:
BINANCE:BTCUSDT
Timeframe 15 min
Stop loss 2%
Take profit 2%
Minimum bars 3
Size grid range 500
This algorithm can be used only on intraday timeframe.
iMoku (Ichimoku Complete Tool) - The Quant Science iMoku™ is a professional all-in-one solution for the famous Ichimoku Kinko Hyo indicator.
The algorithm includes:
1. Backtesting spot
2. Visual tool
3. Auto-trading functions
With iMoku you can test four different strategies.
Strategy 1: Cross Tenkan Sen - Kijun Sen
A long position is opened with 100% of the invested capital ($1000) when "Tenkan Sen" crossover "Kijun Sen".
Closing the long position on the opposite condition.
There are 3 different strength signals for this strategy: weak, normal, strong.
Weak : the signal is weak when the condition is true and the price is above the 'Kumo'
Normal : the signal is normal when the condition is true and the price is within the 'Kumo'
Strong : the signal is strong when the condition is true and the price is below the 'Kumo'
Strategy 2: Cross Price - Kijun Sen
A long position is opened with 100% of the invested capital ($1000) when the price crossover the 'Kijun Sen'.
Closing the long position on the opposite condition.
There are 3 different strength signals for this strategy: weak, normal, strong.
Weak : the signal is weak when the condition is true and the price is above the 'Kumo'
Normal : the signal is normal when the condition is true and the price is inside the 'Kumo'
Strong : the signal is strong when the condition is true and the price is below the 'Kumo'
Strategy 3: Kumo Breakout
A long position is opened with 100% of the invested capital ($1000) when the price breakup the 'Kumo'.
Closing the long position with a percentage stop loss and take profit on the invested capital.
Strategy 4: Kumo Twist
A long position is opened with 100% of the invested capital ($1000) when the 'Kumo' goes from negative to positive (called "Twist").
Closing the long position on the opposite condition.
There are 2 different strength signals for this strategy: weak, and strong.
Weak : the signal is weak when the condition is true and the price is above the 'Kumo'
Strong : the signal is strong when the condition is true and the price is below the 'Kumo'
This script is compliant with algorithmic trading.
You can use this script with trading terminals such as 3Commas or CryptoHopper. Connecting this script is very easy.
1. Enter the user interface
2. Select and activate a strategy
3. Copy your bot's links into the dedicated fields
4. Create and activate alert
Disclaimer: algorithmic trading involves risk, the user should consider aspects such as slippage, liquidity and costs when evaluating an asset. The Quant Science is not responsible for any kind of damage resulting from use of this script. By using this script you take all the responsibilities and risks.
Statistical Correlation Algorithm - The Quant ScienceStatistical Correlation Algorithm - The Quant Science™ is a quantitative trading algorithm.
ALGORITHM DESCRIPTION
This algorithm analyses the correlation ratios between two assets. The main asset (on the chart), and the secondary asset (set by the user). Then apply the long or short trading strategy.
The algorithm divides trading work into three parts:
1. Correlation analysis
2. Long or short entry
3. Closing trades
Inside the strategy: the algorithm analyses the percentage change yields from a previous session, of the secondary asset. If the variation meets the set condition then it will open a long or short position, on the primary asset. The open position is closed after 'x' number of sessions. Stop loss and take profit can be added to the trade exit parameters.
Logic: analyses the correlation between two assets and looks for a statistical advantage within the correlation.
INDICATOR DESCRIPTION
The algorithm includes a quantitative indicator. This indicator is used for correlation analysis and offers a quick reading of the quantitative data. The blue area shows the correlation ratio values. The yellow histograms show the percentage change in the yields of the main asset. Purple histograms show the percentage change in secondary asset yields.
GENERAL FEATURES
Multi time-frame: the user can set any time-frame for the secondary asset.
Multi asset: the user analyses the conditions on a second asset.
Multi-strategy: the algorithm can apply either the long strategy or the short strategy.
Built-in alerts: the algorithm contains alerts that can be customized from the user interface.
Integrated indicator: the quantity indicator is included.
Backtesting included: automatic backtesting of the strategy is generated based on the values set.
Auto-trading compliant: functions for auto trading are included.
USER INTERFACE SETTINGS
Through the intuitive user interface, you can manage all the parameters of this algorithm without any programming experience. The user interface is extremely descriptive and contains all the information needed to understand the logic of the algorithm and to configure it correctly.
1. Date range: through this function you can adjust the analysis and working period of the algorithm.
2. Asset: through this function you can adjust the secondary asset and its time-frame. You can enter any type of asset, even indices and economic indicators.
3. Asset details: this function is used to adjust the percentage change to be analyzed on the secondary asset. The analysis and input conditions are also chosen.
4. Active long or short strategy: this function is used to set the type of strategy to be used, long or short.
5. Setting algo trading alert: with this function, users can manage alerts for their web-hook.
6. Exit&Money management: with this function the user can adjust the exit periods of each trade and activate or deactivate any stop losses and take profits.
7. Data Value Analysis: this function is used to adjust the parameters for the quantity indicator.
MZ Momentum Non Repainting HTF HFT Scalper BotThis is an original script meant to be a high frequency trader that works on higher time frame calculations. I came up with the idea that using calculus I can figure out the actual rate of change and momentum with different calculations than the momentum indicator that is provided by trading view. Once momentum is shifted on a small time frame, it will provide an entry signal. The script is meant to be used on an algorithmic trading system for scalping purposes. It should be run on a one minute time frame.
Set it up on a one minute chart - setup your bot on a one minute interval.
Find the source of your data. You can use any time frame, open, close. high, low, olc4. Open is pretty much guaranteed to not have any repainting issues - although all the other calcs use a custom isbarconfirmed security repaint calculation.
Set your rate of change period - typically I use a one minute time frame for this as well - but set my length fairly long (30-40).
Then set your period for momentum calculation. This will sample the rate of change data to figure out your momentum. I typically try a setting of 6-8. If that doesn't work, try setting it about the same as the rate of change period and add or subtract a few from there.
Unfortunately due to various plotting constraints in Pinescript, you cannot plot the rate of change and momentum and price in the same.
Set your trigger point. I try values -30, -20, -10, 0, 1. Then finesse to get an earlier entry signal. You should account for a slight delay from the signal to the actual entry. Your backtest should test well, but please note that does not gaurantee results. In my findings, I have seen that there is a slight minimal delay between signal to entry and that can make the difference whether your trade is profitable or not.
Use the show data to show you additional data when you are backtesting. This can allow you to try to filter out results or market conditions that do not work. I typically work with the RSI and use the 30 minute and 15 minute RSIs. I make sure that it is trading within a certain band - about 40-75. You can try the inverse and only buy during really low RSI's as well.
Use the enter and close messages to setup your webhook messages. But I recommend to allow the algo trading platform to close the trade for you based on their calcs since that platform knows the actual price level and when it has become profitable.
Filters have been setup for
Moving Average Variants - any time frame, any length.
RSI - Any time frame, any length,
Future Plans: ATR Filter so you can filter out low volatility periods.
Send me a message with any suggestions.
Customizable Non-Repainting HTF MACD MFI Scalper Bot StrategyThis script was originally shared by Wunderbit as a free open source script for the community to work with.
WHAT THIS SCRIPT DOES:
It is intended for use on an algorithmic bot trading platform but can be used for scalping and manual trading.
This strategy is based on the trend-following momentum indicator . It includes the Money Flow index as an additional point for entry.
HOW IT DOES IT:
It uses a combination of MACD and MFI indicators to create entry signals. Parameters for each indicator have been surfaced for user configurability.
Take profits are fixed, but stop loss uses ATR configuration to minimize losses and close profitably.
HOW IS MY VERSION ORIGINAL:
I started trying to deploy this script myself in my algorithmic trading but ran into some issues which I have tried to address in this version.
Delayed Signals : The script has been refactored to use a time frame drop down. The higher time frame can be run on a faster chart (recommended on one minute chart for fastest signal confirmation and relay to algotrading platform.)
Repainting Issues : All indicators have been recoded to use the security function that checks to see if the current calculation is in realtime, if it is, then it uses the previous bar for calculation. If you are still experiencing repainting issues based on intended (or non intended use), please provide a report with screenshot and explanation so I can try to address.
Filtering : I have added to additional filters an ABOVE EMA Filter and a BELOW RSI Filter (both can be turned on and off)
Customizable Long and Close Messages : This allows someone to use the script for algorithmic trading without having to alter code. It also means you can use one indicator for all of your different alterts required for your bots.
HOW TO USE IT:
It is intended to be used in the 5-30 minute time frames, but you might be able to get a good configuration for higher time frames. I welcome feedback from other users on what they have found.
Find a pair with high volatility (example KUCOIN:ETH3LUSDT ) - I have found it works particularly well with 3L and 3S tokens for crypto. although it the limitation is that confrigurations I have found to work typically have low R/R ratio, but very high win rate and profit factor.
Ideally set one minute chart for bots, but you can use other charts for manual trading. The signal will be delayed by one bar but I have found configurations that still test well.
Select a time frame in configuration for your indicator calculations.
Select the strategy config for time frame. I like to use 5 and 15 minutes for scalping scenarios, but I am interested in hearing back from other community memebers.
Optimize your indicator without filters (trendFilter and RSI Filter)
Use the TrendFilter and RSI Filter to further refine your signals for entry. You will get less entries but you can increase your win ratio.
I will add screenshots and possibly a video provided that it passes community standards.
Limitations: this works rather well for short term, and does some good forward testing but back testing large data sets is a problem when switching from very small time frame to large time frame. For instance, finding a configuration that works on a one minute chart but then changing to a 1 hour chart means you lose some of your intra bar calclulations. There are some new features in pine script which might be able to address, this, but I have not had a chance to work on that issue.
SIMPLE CANDLESTICK PATTERN ALGO BACKTESTING - TESLA 4HMany traders spend a lot of time to create algorithms full of unrealistic and far from reality indicators and market conditions. With this script I want to help traders understand the advantage of the Pine language. Using indicators with no statistical foundation and creating algorithms with technical indicators and thousands of conditions is not always the right way to create an efficient tool.
With this script that we have called "SimpleBarPattern_LongOnly" we analyse the market through a simple condition, using bars or candles.
How it works
The condition is constructed as follows. You go long with 100% of the established capital and 0.03% commission. The first condition is that the minimum of the period under analysis falls below the opening level. The second condition is that the low of the period is below the low of the previous period. The third condition is that the close of the period is above the opening level. The final condition wants the current close to be higher than the previous open and higher than the previous close. We used a statistical approach in the creation of this script, some candlestick patterns that reflect these conditions are: Bullish Engulfing, Bullish Hammer and Morning Star .
This strategy aims to help traders make more accurate decisions while using candlesticks for their trading and scientifically demonstrates that candlesticks are valid statistical tools for financial analysis.
"SimpleBarPattern_LongOnly" is a very lightweight script created with Pine v5. We developed a user interface that can adjust the analysis period from a few days to several years.
The initial capital set is €1,000 (You can change this from the "Properties" section of the user interface).
Each individual trade uses 100% of the set capital, in this case €1,000.
The default commission per trade is 0.03% (You can change this in the "Properties" section of the user interface).
User Interface
1) General backtest time settings: Set the history period to be analysed
StartDate: backtest start date
StartMonth: backtest start month
StartYear: backtest start year
EndDate: backtest end day
EndMonth: backtest end month
EndYear: backtest end year
3) Stop Loss
4) Take Profit
Please do not hesitate to contact us for any questions or information.
Disclaimer
Be careful, the past is not a guarantee of future performance, so remember to use the script as a pure analysis tool. The developer takes no responsibility for any use other than research and analysis and can in no way be held liable for damages resulting from wrong use of this code.
Algorithmic Trading on ETH/USDT 1H Backtesting Strategy How it works
%VARonMeanLongOnly is a long-only strategy that uses the average and price movement to find buying opportunities. The script takes into account the simple average over a longer timeframe than the observed timeframe. It then calculates the distance between point "X" (average) and point "Y" (market price). The algorithm will buy every time the price is lower than the average and has a percentage variation greater than the set one. So every time the price moves away from the average by XY% a long position will be opened. The position is closed only when a specific percentage distance of the price above the average is reached, without the use of stop losses and take profits.
This strategy is inspired by the classic academic mean and standard deviation approach , according to which the market tends to move around average values, which may deviate from the average for short periods. In this strategy the trader tries to find a statistical advantage over the distances between average and price.
%VARonMeanLongOnly is a very lightweight script created with Pine v5. We developed a user interface that can adjust the analysis period from a few days to several years. We chose the Moving Average Multi Time Frame and a simple mathematical expression to calculate the percentage distance from price to average and vice versa.
What can you do with %VARonMeanLongOnly ?
With %VARonMeanLongOnly you can implement a statistical arbitrage strategy that allows you to understand if buying above the average and selling the asset above the average can be profitable for a given market. Using the interface you can adjust the periods and variations and analyse if there is a possibility to use this strategy on that market. Understand if this approach has produced positive results on the market under analysis in the past.
The initial capital set is €1,000 (You can change this from the "Properties" section of the user interface).
Each individual trade uses 100% of the set capital, in this case €1,000.
The default commission per trade is 0.03% (You can change this in the "Properties" section of the user interface).
User Interface
1) General backtest time settings: Set the history period to be analysed
StartDate: backtest start date
StartMonth: backtest start month
StartYear: backtest start year
EndDate: backtest end day
EndMonth: backtest end month
EndYear: backtest end year
2) Mean Setting
Length: Periods to be observed when calculating the average
Source: Open, Close, High, Low
TimeFrame: Time frame of the average (usually larger than the time frame under observation)
3) Entry Long Trades:
EntryOnPercentVar: % distance from average to current price
4) Exit Long Trades:
ExitOnPercentVar: % distance from the current price to the average
Please do not hesitate to contact us for any questions or information.
Disclaimer
Be careful, the past is not a guarantee of future performance, so remember to use the script as a pure analysis tool. The developer takes no responsibility for any use other than research and analysis and can in no way be held liable for damages resulting from wrong use of this code.
LTDP: Long Trade on Drop Price (ETH/USDT, Timeframe 4H)How it works
The script analyses drawdown periods and negative price variation in order to search for ideal entry points for long positions.
"Has 'buy the dip' really produced profitable results so far?" "How do you define a buy the dip entry?" "What are the best setups to take advantage of a strong market drop?"
Many investors ask themselves these questions when they are buying during a strong drop price. Having an analysis tool that allows you to analyse the profitability of buying during a market drop is indispensable for dealing with it like a pro. We have decided to develop a script that gives you the ability to analyse this market condition in depth.
LTDP is a very light script created with Pine V.5 that has about 50 strings of code. We have developed a user interface capable of adjusting the analysis period from a few days to several years. We have chosen the Rate Of Change indicator to implement the function to analyse the period and the price variation. Finally, we have set the condition with which the script simulates a long entry with the intention of exploiting the volatility and the bearish moment. The trade is closed by stop losses and take profits which can be adjusted by the user interface.
What can you do with LTDP ?
1) Understand if a Buy The Dip approach can be profitable .
Using the interface you can adjust the periods and variations and analyse whether there is a possibility to use this strategy on that market. Understand if in the past this approach has produced positive results on the market under analysis.
2) Understand the best setup to approach a "Buy The Dip" strategy.
Once you understand and set up the best period and variation you can research which take profit and stop loss has worked best so far.
In this test
We used LTDP to answer this question on the ETH/USDT pair with 4H timeframe.
Buying after a drop of -17.5% over 28 hours, is it possible to achieve profitable conditions by opening only long positions with a 3% take profit and a 4% stop loss?
In this study case the result was that offered by the backtest. In this market using this simple strategy, positive results have been produced over the last 4 years.
The initial capital set is €10,000 (You can change this from the "Properties" section of the user interface).
Each individual trade uses 100% of the set capital, in this case €10,000.
The default commission per trade is 0.03% (You can change this in the "Properties" section of the user interface).
User Interface
1) General backtest time settings: Set the history period to be analysed
StartDate: backtest start date
StartMonth: backtest start month
StartYear: backtest start year
EndDate: backtest end day
EndMonth: backtest end month
EndYear: backtest end year
2) Buy The Dip analysis settings: Set the drawdown period and the variation to be taken into account
Period_on_analysis: Drawdown bars analysis
Source: Open, Close, High, Low
PercentDrawDown: The percentage of decline to be observed in Period_on_analysis
3) Money Management Settings: Set Take Profit and Stop Loss
TakeProfit: % Profit
StopLoss: % Loss
Please do not hesitate to contact us for any questions or information.
Disclaimer
Be careful, the past is not a guarantee of future performance, so remember to use the script as a pure analysis tool that cannot be intended as the sole reference in making and implementing financial investment strategies. The developer takes no responsibility for any use other than research and analysis and can in no way be held liable for damages resulting from misuse of this code.
hamster-bot PDD Pump and Dump DetectorPump and Dump detector by hamster-bot
strategy author: foresterufa
Pump and Dump detector (PDD)
This is a trend strategy, with a unique mechanism of multi-stage re-entry into a position (Take Profit-Entry) when a significant trend develops, based on our HiDeep indicator.
Positions are opened by the HiDeep indicator signal with trend direction filtering and volatility filtering. Positions are closed by a HiDeep indicator signal or a change in the trend direction.
The position can be accompanied by a unique Stoploss trailing MA.
Relativity BEARS FOREX 50X 4H AlgorithmHello, this script is the correction of my old script related to Forex. (Bear market)
Old script :
4H was chosen as the time frame.
Thus, larger pips are at our disposal and we benefit more from the hedge effect of the leverage.
Commissions per trade have been removed to get more realistic commissions.
Because every wrong trade deletes all the 1% position size.
(with leverage effect)
Use the links below to obtain access to this indicator :
Relativity BULLS FOREX 50X 4H Algorithm
Hello, this script is the correction of my bull script related to Forex. (Bull market)
Old script :
4H was chosen as the time frame.
Thus, larger pips are at our disposal and we benefit more from the hedge effect of the leverage.
Commissions per trade have been removed to get more realistic commissions.
Because every wrong trade deletes all the 1% position size.
(with leverage effect)
Use the link below to obtain access to this indicator :
Coinbase_3-MIN_HFT-StrategyThis conceptual strategy trades against the short-term trend. The first position can be either long or short.
In the short-term, prices fluctuate up and down on wide spread exchanges.
And if the price moves to one side, the price tends to return to its original position momentarily.
This strategy set stop order. Stop price is calculated with upper and lower shadows.