PROTECTED SOURCE SCRIPT

QuantBuilder | Fractalyst

업데이트됨
What'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.
릴리즈 노트
- Fixed a bug in boolean expression evaluation that incorrectly handled nested conditions.
릴리즈 노트
Multi-Timeframe Tables Added:

Two tables have been integrated into the script—one at the top and one at the bottom. These tables display the expected values and probabilities across multiple timeframes, providing users with enhanced insights into current market conditions.

스냅샷
릴리즈 노트
- Added "Average Trade Duration" to the summary table, allowing users to track the average time their positions are held in the market.

This is crucial for evaluating the impact of swap fees or overnight charges that may affect long-term trades depending on the broker's fee structure.
릴리즈 노트
- Enhanced table functionality and visualization for improved data representation and user experience.
- Optimized code logic for faster execution times, ensuring more efficient processing.
릴리즈 노트
- Enhanced the summary table by incorporating more meaningful tooltips with actionable insights that appear upon mouse hover, providing users with valuable information to optimize their trading strategies.
릴리즈 노트
- Updated special characters to a readable format across all devices for improved visualization.

- Enhanced timeframe readability logic.
릴리즈 노트
- Enhanced probability logic calculations to increase accuracy in predictive modeling.

- Improved consistency across deep backtesting and standard backtesting results by refining its calculation flow.
릴리즈 노트
- Converted to PineScript V6
algorithmictradingexpectedvalueinvestmentliquidityPivot points and levelsPortfolio managementprobabilitiesprofitabletradingquanttradingresearchstatisticssystematictrading

보호된 스크립트입니다

이 스크립트는 클로즈 소스로 게시되며 자유롭게 사용할 수 있습니다. 당신은 스크립트를 차트에 사용하기 위해 그것을 즐겨찾기 할 수 있습니다. 소스 코드는 보거나 수정할 수 없습니다.

차트에 이 스크립트를 사용하시겠습니까?


Machine Learning Entry Model:
fractalyst.net/

Steal All of My Codes:
discord.gg/Ax2AdPUd
또한 다음에서도:

면책사항