PresentTrend RMI Synergy - Strategy [presentTrading] █ Introduction and How it is Different
The "PresentTrend RMI Synergy Strategy" is the combined power of the Relative Momentum Index (RMI) and a custom presentTrend indicator. This strategy introduces a multifaceted approach, integrating momentum analysis with trend direction to offer traders a more nuanced and responsive trading mechanism.
BTCUSD 6h L/S Performance
Local
█ Strategy, How It Works: Detailed Explanation
The "PresentTrend RMI Synergy Strategy" intricately combines the Relative Momentum Index (RMI) and a custom SuperTrend indicator to create a powerful tool for traders.
🔶 Relative Momentum Index (RMI)
The RMI is a variation of the Relative Strength Index (RSI), but instead of using price closes against itself, it measures the momentum of up and down movements in price relative to previous prices over a given period. The RMI for a period length `N` is calculated as follows:
RMI = 100 - 100/ (1 + U/D)
where:
- `U` is the average upward price change over `N` periods,
- `D` is the average downward price change over `N` periods.
The RMI oscillates between 0 and 100, with higher values indicating stronger upward momentum and lower values suggesting stronger downward momentum.
RMI = 21
RMI = 42
For more information - RMI Trend Sync - Strategy :
🔶 presentTrend Indicator
The presentTrend indicator combines the Average True Range (ATR) with a moving average to determine trend direction and dynamic support or resistance levels. The presentTrend for a period length `M` and a multiplier `F` is defined as:
- Upper Band: MA + (ATR x F)
- Lower Band: MA - (ATR x F)
where:
- `MA` is the moving average of the close price over `M` periods,
- `ATR` is the Average True Range over the same period,
- `F` is the multiplier to adjust the sensitivity.
The trend direction switches when the price crosses the presentTrend bands, signaling potential entry or exit points.
presentTrend length = 3
presentTrend length = 10
For more information - PresentTrend - Strategy :
🔶 Strategy Logic
Entry Conditions:
- Long Entry: Triggered when the RMI exceeds a threshold, say 60, indicating a strong bullish momentum, and when the price is above the presentTrend, confirming an uptrend.
- Short Entry: Occurs when the RMI drops below a threshold, say 40, showing strong bearish momentum, and the price is below the present trend, indicating a downtrend.
Exit Conditions with Dynamic Trailing Stop:
- Long Exit: Initiated when the price crosses below the lower presentTrend band or when the RMI falls back towards a neutral level, suggesting a weakening of the bullish momentum.
- Short Exit: Executed when the price crosses above the upper presentTrend band or when the RMI rises towards a neutral level, indicating a reduction in bearish momentum.
Equations for Dynamic Trailing Stop:
- For Long Positions: The exit price is set at the lower SuperTrend band once the entry condition is met.
- For Short Positions: The exit price is determined by the upper SuperTrend band post-entry.
These dynamic trailing stops adjust as the market moves, providing a method to lock in profits while allowing room for the position to grow.
This strategy's strength lies in its dual analysis approach, leveraging RMI for momentum insights and presentTrend for trend direction and dynamic stops. This combination offers traders a robust framework to navigate various market conditions, aiming to capture trends early and exit positions strategically to maximize gains and minimize losses.
█ Trade Direction
The strategy provides flexibility in trade direction selection, offering "Long," "Short," or "Both" options to cater to different market conditions and trader preferences. This adaptability ensures that traders can align the strategy with their market outlook, risk tolerance, and trading goals.
█ Usage
To utilize the "PresentTrend RMI Synergy Strategy," traders should input their preferred settings in the Pine Script™ and apply the strategy to their charts. Monitoring RMI for momentum shifts and adjusting positions based on SuperTrend signals can optimize entry and exit points, enhancing potential returns while managing risk.
█ Default Settings
1. RMI Length: 21
The 21-period RMI length strikes a balance between capturing momentum and filtering out market noise, offering a medium-term outlook on market trends.
2. Super Trend Length: 7
A SuperTrend length of 7 periods is chosen for its responsiveness to price movements, providing a dynamic framework for trend identification without excessive sensitivity.
3. Super Trend Multiplier: 4.0
The multiplier of 4.0 for the SuperTrend indicator widens the trend bands, focusing on significant market moves and reducing the impact of minor fluctuations.
---
The "PresentTrend RMI Synergy Strategy" represents a significant step forward in trading strategy development, blending momentum and trend analysis in a unique way. By providing a detailed framework for understanding market dynamics, this strategy empowers traders to make more informed decisions.
Trend Analysis
AI SuperTrend x Pivot Percentile - Strategy [PresentTrading]█ Introduction and How it is Different
The AI SuperTrend x Pivot Percentile strategy is a sophisticated trading approach that integrates AI-driven analysis with traditional technical indicators. Combining the AI SuperTrend with the Pivot Percentile strategy highlights several key advantages:
1. Enhanced Accuracy in Trend Prediction: The AI SuperTrend utilizes K-Nearest Neighbors (KNN) algorithm for trend prediction, improving accuracy by considering historical data patterns. This is complemented by the Pivot Percentile analysis which provides additional context on trend strength.
2. Comprehensive Market Analysis: The integration offers a multi-faceted approach to market analysis, combining AI insights with traditional technical indicators. This dual approach captures a broader range of market dynamics.
BTC 6H L/S Performance
Local
█ Strategy: How it Works - Detailed Explanation
🔶 AI-Enhanced SuperTrend Indicators
1. SuperTrend Calculation:
- The SuperTrend indicator is calculated using a moving average and the Average True Range (ATR). The basic formula is:
- Upper Band = Moving Average + (Multiplier × ATR)
- Lower Band = Moving Average - (Multiplier × ATR)
- The moving average type (SMA, EMA, WMA, RMA, VWMA) and the length of the moving average and ATR are adjustable parameters.
- The direction of the trend is determined based on the position of the closing price in relation to these bands.
2. AI Integration with K-Nearest Neighbors (KNN):
- The KNN algorithm is applied to predict trend direction. It uses historical price data and SuperTrend values to classify the current trend as bullish or bearish.
- The algorithm calculates the 'distance' between the current data point and historical points. The 'k' nearest data points (neighbors) are identified based on this distance.
- A weighted average of these neighbors' trends (bullish or bearish) is calculated to predict the current trend.
For more please check: Multi-TF AI SuperTrend with ADX - Strategy
🔶 Pivot Percentile Analysis
1. Percentile Calculation:
- This involves calculating the percentile ranks for high and low prices over a set of predefined lengths.
- The percentile function is typically defined as:
- Percentile = Value at (P/100) × (N + 1)th position
- Where P is the desired percentile, and N is the number of data points.
2. Trend Strength Evaluation:
- The calculated percentiles for highs and lows are used to determine the strength of bullish and bearish trends.
- For instance, a high percentile rank in the high prices may indicate a strong bullish trend, and vice versa for bearish trends.
For more please check: Pivot Percentile Trend - Strategy
🔶 Strategy Integration
1. Combining SuperTrend and Pivot Percentile:
- The strategy synthesizes the insights from both AI-enhanced SuperTrend and Pivot Percentile analysis.
- It compares the trend direction indicated by the SuperTrend with the strength of the trend as suggested by the Pivot Percentile analysis.
2. Signal Generation:
- A trading signal is generated when both the AI-enhanced SuperTrend and the Pivot Percentile analysis agree on the trend direction.
- For instance, a bullish signal is generated when both the SuperTrend is bullish, and the Pivot Percentile analysis shows strength in bullish trends.
🔶 Risk Management and Filters
- ADX and DMI Filter: The strategy uses the Average Directional Index (ADX) and the Directional Movement Index (DMI) as filters to assess the trend's strength and direction.
- Dynamic Trailing Stop Loss: Based on the SuperTrend indicator, the strategy dynamically adjusts stop-loss levels to manage risk effectively.
This strategy stands out for its ability to combine real-time AI analysis with established technical indicators, offering traders a nuanced and responsive tool for navigating complex market conditions. The equations and algorithms involved are pivotal in accurately identifying market trends and potential trade opportunities.
█ Usage
To effectively use this strategy, traders should:
1. Understand the AI and Pivot Percentile Indicators: A clear grasp of how these indicators work will enable traders to make informed decisions.
2. Interpret the Signals Accurately: The strategy provides bullish, bearish, and neutral signals. Traders should align these signals with their market analysis and trading goals.
3. Monitor Market Conditions: Given that this strategy is sensitive to market dynamics, continuous monitoring is crucial for timely decision-making.
4. Adjust Settings as Needed: Traders should feel free to tweak the input parameters to suit their trading preferences and to respond to changing market conditions.
█Default Settings and Their Impact on Performance
1. Trading Direction (Default: "Both")
Effect: Determines whether the strategy will take long positions, short positions, or both. Adjusting this setting can align the strategy with the trader's market outlook or risk preference.
2. AI Settings (Neighbors: 3, Data Points: 24)
Neighbors: The number of nearest neighbors in the KNN algorithm. A higher number might smooth out noise but could miss subtle, recent changes. A lower number makes the model more sensitive to recent data but may increase noise.
Data Points: Defines the amount of historical data considered. More data points provide a broader context but may dilute recent trends' impact.
3. SuperTrend Settings (Length: 10, Factor: 3.0, MA Source: "WMA")
Length: Affects the sensitivity of the SuperTrend indicator. A longer length results in a smoother, less sensitive indicator, ideal for long-term trends.
Factor: Determines the bandwidth of the SuperTrend. A higher factor creates wider bands, capturing larger price movements but potentially missing short-term signals.
MA Source: The type of moving average used (e.g., WMA - Weighted Moving Average). Different MA types can affect the trend indicator's responsiveness and smoothness.
4. AI Trend Prediction Settings (Price Trend: 10, Prediction Trend: 80)
Price Trend and Prediction Trend Lengths: These settings define the lengths of weighted moving averages for price and SuperTrend, impacting the responsiveness and smoothness of the AI's trend predictions.
5. Pivot Percentile Settings (Length: 10)
Length: Influences the calculation of pivot percentiles. A shorter length makes the percentile more responsive to recent price changes, while a longer length offers a broader view of price trends.
6. ADX and DMI Settings (ADX Length: 14, Time Frame: 'D')
ADX Length: Defines the period for the Average Directional Index calculation. A longer period results in a smoother ADX line.
Time Frame: Sets the time frame for the ADX and DMI calculations, affecting the sensitivity to market changes.
7. Commission, Slippage, and Initial Capital
These settings relate to transaction costs and initial investment, directly impacting net profitability and strategy feasibility.
Ichimoku Clouds Strategy Long and ShortOverview:
The Ichimoku Clouds Strategy leverages the Ichimoku Kinko Hyo technique to offer traders a range of innovative features, enhancing market analysis and trading efficiency. This strategy is distinct in its combination of standard methodology and advanced customization, making it suitable for both novice and experienced traders.
Unique Features:
Enhanced Interpretation: The strategy introduces weak, neutral, and strong bullish/bearish signals, enabling detailed interpretation of the Ichimoku cloud and direct chart plotting.
Configurable Trading Periods: Users can tailor the strategy to specific market windows, adapting to different market conditions.
Dual Trading Modes: Long and Short modes are available, allowing alignment with market trends.
Flexible Risk Management: Offers three styles in each mode, combining fixed risk management with dynamic indicator states for versatile trade management.
Indicator Line Plotting: Enables plotting of Ichimoku indicator lines on the chart for visual decision-making support.
Methodology:
The strategy utilizes the standard Ichimoku Kinko Hyo model, interpreting indicator values with settings adjustable through a user-friendly menu. This approach is enhanced by TradingView's built-in strategy tester for customization and market selection.
Risk Management:
Our approach to risk management is dynamic and indicator-centric. With data from the last year, we focus on dynamic indicator states interpretations to mitigate manual setting causing human factor biases. Users still have the option to set a fixed stop loss and/or take profit per position using the corresponding parameters in settings, aligning with their risk tolerance.
Backtest Results:
Operating window: Date range of backtests is 2023.01.01 - 2024.01.04. It is chosen to let the strategy to close all opened positions.
Commission and Slippage: Includes a standard Binance commission of 0.1% and accounts for possible slippage over 5 ticks.
Maximum Single Position Loss: -6.29%
Maximum Single Profit: 22.32%
Net Profit: +10 901.95 USDT (+109.02%)
Total Trades: 119 (51.26% profitability)
Profit Factor: 1.775
Maximum Accumulated Loss: 4 185.37 USDT (-22.87%)
Average Profit per Trade: 91.67 USDT (+0.7%)
Average Trade Duration: 56 hours
These results are obtained with realistic parameters representing trading conditions observed at major exchanges such as Binance and with realistic trading portfolio usage parameters. Backtest is calculated using deep backtest option in TradingView built-in strategy tester
How to Use:
Add the script to favorites for easy access.
Apply to the desired chart and timeframe (optimal performance observed on the 1H chart, ForEx or cryptocurrency top-10 coins with quote asset USDT).
Configure settings using the dropdown choice list in the built-in menu.
Set up alerts to automate strategy positions through web hook with the text: {{strategy.order.alert_message}}
Disclaimer:
Educational and informational tool reflecting Skyrex commitment to informed trading. Past performance does not guarantee future results. Test strategies in a simulated environment before live implementation
mikul's Ichimoku Cloud Strategy v 2.0This is an Ichimoku cloud (long) strategy with both pump signals and trend signals.
It has both ATR stop loss, trailing percentage stop loss and also ichomoku cloud exit signal.
You can also combine the ATR stop loss and the trailing percentage stop loss with the Ichimoku cloud exit signal and a the take profit percentage.
In this example I use the default ATR stop loss method for taking profit.
10000$ is my initial capital and I risking 10% every trade. Commission is set to 0.075%.
Everything is set to default in this example.
There is also a moving average filter that is available, set to 200 EMA and turned off by default.
Conditions for taking a long position:
Trend Signal:
• Positive cross above the cloud
• Chikou span(lagging span) above price action
• Price above the Cloud
Pump Signal:
• Cloud ahead of you is green
• Price above the cloud
• Positive cross (Doesn’t Matter Where)
• Chikou span(lagging span) above the cloud
Ichimoku cloud exit signals:
• Negative cross
• Chikou span(lagging span) touches the price action
This strategy is totally free as freedom and as in free beer!
I do this for myself, but I like sharing and I want everyone to have the ability to use what I make no matter your economic situation.
If you have any suggestions for this strategy or perhaps any filtering options that could be fun to experiment with, then please leave a comment with your suggestion and maybe I can add it to the next version.
FlexiMA x FlexiST - Strategy [presentTrading]█ Introduction and How it is Different
The FlexiMA x FlexiST Strategy blends two analytical methods - FlexiMA and FlexiST, which are opened in my early post.
- FlexiMA calculates deviations between an indicator source and a dynamic moving average, controlled by a starting factor and increment factor.
- FlexiST, on the other hand, leverages the SuperTrend model, adjusting the Average True Range (ATR) length for a comprehensive trend-following oscillator.
This synergy offers traders a more nuanced and multifaceted tool for market analysis.
BTC 6H L/S Performance
Local
█ Strategy, How It Works: Detailed Explanation
The strategy combines two components: FlexiMA and FlexiST, each utilizing unique methodologies to analyze market trends.
🔶FlexiMA Component:
- Calculates deviations between an indicator source and moving averages of variable lengths.
- Moving average lengths are dynamically adjusted using a starting factor and increment factor.
- Deviations are normalized and analyzed to produce median and standard deviation values, forming the FlexiMA oscillator.
Length indicator (50)
🔶FlexiST Component:
- Uses SuperTrend indicators with varying ATR (Average True Range) lengths.
- Trends are identified based on the position of the indicator source relative to the SuperTrend bands.
- Deviations between the indicator source and SuperTrend values are calculated and normalized.
Starting Factor (5)
🔶Combined Strategy Logic:
- Entry Signals:
- Long Entry: Triggered when median values of both FlexiMA and FlexiST are positive.
- Short Entry: Triggered when median values of both FlexiMA and FlexiST are negative.
- Exit Signals:
- Long Exit: Triggered when median values of FlexiMA or FlexiST turn negative.
- Short Exit: Triggered when median values of FlexiMA or FlexiST turn positive.
This strategic blend of FlexiMA and FlexiST allows for a nuanced analysis of market trends, providing traders with signals based on a comprehensive view of market momentum and trend strength.
█ Trade Direction
The strategy is designed to cater to various trading preferences, offering "Long", "Short", and "Both" options. This flexibility allows traders to align the strategy with their specific market outlook, be it bullish, bearish, or a combination of both.
█ Usage
Traders can effectively utilize the FlexiMA x FlexiST Strategy by first selecting their desired trade direction. The strategy then generates entry signals when the conditions for either the FlexiMA or FlexiST are met, indicating potential entry points in the market. Conversely, exit signals are generated when the conditions for these indicators diverge, thus signaling a potential shift in market trends and suggesting a strategic exit point.
█ Default Settings
1. Indicator Source (HLC3): Provides a balanced and stable price source, reducing the impact of extreme market fluctuations.
2. Indicator Lengths (20 for FlexiMA, 10 for FlexiST): Longer FlexiMA length smooths out short-term fluctuations, while shorter FlexiST length allows for quicker response to market changes.
3. Starting Factors (1.0 for FlexiMA, 0.618 for FlexiST): Balanced start for FlexiMA and a harmonized approach for FlexiST, resonating with natural market cycles.
4. Increment Factors (1.0 for FlexiMA, 0.382 for FlexiST): FlexiMA captures a wide range of market behaviors, while FlexiST provides a gradual transition to capture finer trend shifts.
5. Normalization Methods ('None'): Uses raw deviations, suitable for markets where absolute price movements are more significant.
6. Trade Direction ('Both'): Allows strategy to consider both long and short opportunities, ideal for versatile market engagement.
*More details:
1. FlexiMA
2. FlexiST
Pivot Percentile Trend - Strategy [presentTrading]
█ Introduction and How it is Different
The "Pivot Percentile Trend - Strategy" from PresentTrading represents a paradigm shift in technical trading strategies. What sets this strategy apart is its innovative use of pivot percentiles, a method that goes beyond traditional indicator-based analyses. Unlike standard strategies that might depend on single-dimensional signals, this approach takes a multi-layered view of market movements, blending percentile calculations with SuperTrend indicators for a more nuanced and dynamic market analysis.
This strategy stands out for its ability to process multiple data points across various timeframes and pivot lengths, thereby capturing a broader and more detailed picture of market trends. It's not just about following the price; it's about understanding its position in the context of recent historical highs and lows, offering a more profound insight into potential market movements.
BTC 6h L/S
Where traditional methods might react to market changes, the Pivot Percentile Trend strategy anticipates them, using a calculated approach to identify trend strengths and weaknesses. This foresight gives traders a significant advantage, allowing for more strategic decision-making and potentially increasing the chances of successful trades.
In essence, this strategy introduces a more comprehensive and proactive approach to trading, harnessing the power of advanced percentile calculations combined with the robustness of SuperTrend indicators. It's a strategy designed for traders who seek a deeper understanding of market dynamics and a more calculated approach to their trading decisions.
Local picture
█ Strategy, How It Works: Detailed Explanation
🔶 Percentile Calculations
- The strategy employs percentile calculations to assess the relative position of current market prices against historical data.
- For a set of lengths (e.g., `length * 1`, `length * 2`, up to `length * 7`), it calculates the 75th percentile for high values (`percentilesHigh`) and the 25th percentile for low values (`percentilesLow`).
- These percentiles provide a sense of where the current price stands compared to recent price ranges.
Length - 10
Length - 15
🔶 SuperTrend Indicator
- The SuperTrend indicator is a key component, providing trend direction signals.
- It uses the `currentTrendValue`, derived from the difference between bull and bear strengths calculated from the percentile data.
* used the Supertrend toolkit by @EliCobra
🔶 Trend Strength Counts
- The strategy calculates counts of bullish and bearish indicators based on comparisons between the current high and low against high and low percentiles.
- `countBull` and `countBear` track the number of times the current high is above the high percentiles and the current low is below the low percentiles, respectively.
- Weak bullish (`weakBullCount`) and bearish (`weakBearCount`) counts are also determined by how often the current lows and highs fall within the percentile range.
*The idea of this strength counts mainly comes from 'Trend Strength Over Time' @federalTacos5392b
🔶 Trend Value Calculation
- The `currentTrendValue` is a crucial metric, computed as `bullStrength - bearStrength`.
- It indicates the market's trend direction, where a positive value suggests a bullish trend and a negative value indicates a bearish trend.
🔶 Trade Entry and Exit Logic
- The entry points for trades are determined by the combination of the trend value and the direction indicated by the SuperTrend indicator.
- For a long entry (`shouldEnterLong`), the `currentTrendValue` must be positive and the SuperTrend indicator should show a downtrend.
- Conversely, for a short entry (`shouldEnterShort`), the `currentTrendValue` should be negative with the SuperTrend indicating an uptrend.
- The strategy closes positions when these conditions reverse.
█ Trade Direction
The strategy is versatile, allowing traders to choose their preferred trading direction: long, short, or both. This flexibility enables traders to tailor their strategies to their market outlook and risk appetite.
█ Default Settings and Customization
1. Trade Direction: Selectable as Long, Short, or Both, affecting the type of trades executed.
2. Indicator Source: Pivot Percentile Calculations, key for identifying market trends and reversals.
3. Lengths for Percentile Calculation: Various configurable lengths, influencing the scope of trend analysis.
4. SuperTrend Settings: ATR Length 20, Multiplier 18, affecting indicator sensitivity and trend detection.
5. Style Options: Custom colors for bullish (green) and bearish (red) trends, aiding visual interpretation.
6. Additional Settings: Includes contrarian signals and UI enhancements, offering strategic and visual flexibility.
FlexiSuperTrend - Strategy [presentTrading]█ Introduction and How it is Different
The "FlexiSuperTrend - Strategy" by PresentTrading is a cutting-edge trading strategy that redefines market analysis through the integration of the SuperTrend indicator and advanced variance tracking.
BTC 6H L/S
This strategy stands apart from conventional methods by its dynamic adaptability, capturing market trends and momentum shifts with increased sensitivity. It's designed for traders seeking a more responsive tool to navigate complex market movements.
Local
█ Strategy, How It Works: Detailed Explanation
The "FlexiSuperTrend - Strategy" employs a multifaceted approach, combining the adaptability of the SuperTrend indicator with variance tracking. The strategy's core lies in its unique formulation and application of these components:
🔶 SuperTrend Polyfactor Oscillator:
- Basic Concept: The oscillator is a series of SuperTrend calculations with varying ATR lengths and multipliers. This approach provides a broader and more nuanced perspective of market trends.
- Calculation:
- For each iteration, `i`, the SuperTrend is calculated using:
- `ATR Length = indicatorLength * (startingFactor + i * incrementFactor)`.
- `Multiplier = dynamically adjusted based on market conditions`.
- The SuperTrend output for each iteration is compared with the indicator source (like hlc3), and the deviation is recorded.
SuperTrend Calculation:
- `Upper Band (UB) = hl2 + (ATR Length * Multiplier)`
- `Lower Band (LB) = hl2 - (ATR Length * Multiplier)`
- Where `hl2` is the average of high and low prices.
Deviation Calculation:
- `Deviation = indicatorSource - SuperTrend Value`
- This value is calculated for each SuperTrend setting in the oscillator series.
🔶 Indicator Source (`hlc3`):
- **Usage:** The strategy uses the average of high, low, and close prices, providing a balanced representation of market activity.
🔶 Adaptive ATR Lengths and Factors:
- Dynamic Adjustment: The strategy adjusts the ATR length and multiplier based on the `startingFactor` and `incrementFactor`. This adaptability is key in responding to changing market volatilities.
- Equation: ATR Length at each iteration `i` is given by `len = indicatorLength * (startingFactor + i * incrementFactor)`.
incrementFactor - 1
incrementFactor - 2
🔶 Normalization Methods:
Purpose: To standardize the deviations for comparability.
- Methods:
- 'Max-Min': Scales the deviation based on the range of values.
- 'Absolute Sum': Uses the sum of absolute deviations for normalization.
Normalization 'Absolute Sum'
- For 'Max-Min': `Normalized Deviation = (Deviation - Min(Deviations)) / (Max(Deviations) - Min(Deviations))`
- For 'Absolute Sum': `Normalized Deviation = Deviation / Sum(Absolute(Deviations))`
🔶 Trading Logic:
The strategy integrates the SuperTrend indicator, renowned for its effectiveness in identifying trend direction and reversals. The SuperTrend's incorporation enhances the strategy's ability to filter out false signals and confirm genuine market trends. * The SuperTrend Toolkit is made by @QuantiLuxe
- Long Entry Conditions: A buy signal is generated when the current trend, as indicated by the SuperTrend Polyfactor Oscillator, turns positive.
- Short Entry Conditions: A sell signal is triggered when the current trend turns negative.
- Entry and Exit Strategy: The strategy opens or closes positions based on these signals, aligning with the selected trade direction (long, short, or both).
█ Trade Direction
The strategy is versatile, allowing traders to choose their preferred trading direction: long, short, or both. This flexibility enables traders to tailor their strategies to their market outlook and risk appetite.
█ Usage
The FlexiSuperTrend strategy is suitable for various market conditions and can be adapted to different asset classes and time frames. Traders should set the strategy parameters according to their risk tolerance and trading goals. It's particularly useful for capturing long-term movements, ideal for swing traders, yet adaptable for short-term trading strategies.
█ Default Settings
1. Trading Direction: Choose from "Long", "Short", or "Both" to define the trade type.
2. Indicator Source (HLC3): Utilizes the HLC3 as the primary price reference.
3. Indicator Length (Default: 10): Influences the moving average calculation and trend sensitivity.
4. Starting Factor (0.618): Initiates the ATR length, influenced by Fibonacci ratios.
5. Increment Factor (0.382): Adjusts the ATR length incrementally for dynamic trend tracking.
6. Normalization Method: Options include "None", "Max-Min", and "Absolute Sum" for scaling deviations.
7. SuperTrend Settings: Varied ATR lengths and multipliers tailor the indicator's responsiveness.
8. Additional Settings: Features mesh style plotting and customizable colors for visual distinction.
The default settings provide a balanced approach, but users are encouraged to adjust them based on their individual trading style and market analysis.
FlexiMA Variance Tracker - Strategy [presentTrading]█ Introduction and How It Is Different
The FlexiMA Variance Tracker by PresentTrading introduces a novel approach to technical trading strategies. Unlike traditional methods, it calculates deviations between a chosen indicator source (such as price or average) and a moving average with a variable length. This flexibility is achieved through a unique combination of a starting factor and an increment factor, allowing the moving average to adapt dynamically within a specified range. This strategy provides a more responsive and nuanced view of market trends, setting it apart from standard trading methodologies.
BTC 8h L/S
Local
█ Strategy, How It Works: Detailed Explanation
The FlexiMA Variance Tracker, developed by PresentTrading, stands at the forefront of trading strategies, distinguished by its adaptive and multifaceted approach to market analysis. This strategy intricately weaves various technical elements to construct a comprehensive trading logic. Here's an in-depth professional breakdown:
🔶Foundation on Variable-Length Moving Averages:
Central to this strategy is the concept of variable-length Moving Averages (MAs). Unlike traditional MAs with a fixed period, this strategy dynamically adjusts the length of the MA based on a starting factor and an incremental factor. This approach allows the strategy to adapt to market volatility and trend strength more effectively.
Each MA iteration offers a distinct temporal perspective, capturing short-term price movements to long-term trends. This aggregation of various time frames provides a richer and more nuanced market analysis, essential for making informed trading decisions.
🔶Deviation Analysis and Normalization:
The strategy calculates deviations of the price (or the chosen indicator source) from each of these MAs. These deviations are pivotal in identifying the immediate market direction relative to the average trend captured by each MA.
To standardize these deviations for comparability, they undergo a normalization process. The choice of normalization method (Max-Min or Absolute Sum) can significantly influence the interpretation of market conditions, offering distinct insights into price movements and trend strength.
🔹Normalization: Absolute Sum
🔶Composite Oscillator Construction:
A composite oscillator is derived from the median of these normalized deviations. The median serves as a balanced and robust central trend indicator, minimizing the impact of outliers and market noise.
Additionally, the standard deviation of these deviations is computed, providing a measure of market volatility. This volatility indicator is crucial for assessing market risk and can guide traders in setting appropriate stop-loss and take-profit levels.
🔶Integration with SuperTrend Indicator:
The FlexiMA strategy integrates the SuperTrend indicator, renowned for its effectiveness in identifying trend direction and reversals. The SuperTrend's incorporation enhances the strategy's ability to filter out false signals and confirm genuine market trends.
* The SuperTrend Toolkit is made by @QuantiLuxe
This combination of the variable-length MA oscillator with the SuperTrend indicator forms a potent duo, offering traders a dual-confirmation mechanism for trade signals.
🔹Supertrend's incorporation
🔶Strategic Trade Signal Generation:
Trade signals are generated when there is a confluence between the composite oscillator and the SuperTrend indicator. For example, a long position signal might be considered when the oscillator suggests an uptrend, and the SuperTrend flips to bullish.
The strategy's parameters are fully customizable, enabling traders to tailor the signal generation process to their specific trading style, risk tolerance, and market conditions.
█ Usage
To effectively employ the FlexiMA Variance Tracker strategy:
Traders should set their desired trade direction and fine-tune the starting and increment factors according to their market analysis and risk tolerance.
Indicator Length: 5
Indicator Length: 40
The strategy is suitable for a wide range of markets and can be adapted to different time frames, making it a versatile tool for various trading scenarios.
█ Default Settings Impact on Performance: FlexiMA Variance Tracker
1. Trade Direction (Configurable: Long, Short, Both): Determines trade types. 'Long' for buying, 'Short' for selling, 'Both' adapts to market trends.
2. Indicator Source: HLC3: Balances market sentiment by considering high, low, and close, providing comprehensive period analysis.
4. Indicator Length (Default: 10): Baseline for moving averages. Shorter lengths increase responsiveness but add noise, while longer lengths favor trends.
5. Starting and Increment Factor (Default: 1.0): Adjusts MA lengths range. Higher values capture broad market dynamics, lower values focus analysis.
6. Normalization Method (Options: None, Max-Min, Absolute Sum): Standardizes deviations. 'None' for raw deviations, 'Max-Min' for relative scaling, 'Absolute Sum' emphasizes relative strength.
7. SuperTrend Settings (ATR Length: 10, Multiplier: 15.0): Influences indicator sensitivity. Short ATR or high multiplier for short-term, long ATR or low multiplier for long-term trends.
8. Additional Settings (Mesh Style, Color Customization): Enhances visual clarity. Mesh style for detailed deviation view, colors for quick market condition identification.
Elliott's Quadratic Momentum - Strategy [presentTrading]█ Introduction and How It Is Different
The "Elliott's Quadratic Momentum - Strategy" is a unique and innovative approach in the realm of technical trading. This strategy is a fusion of multiple SuperTrend indicators combined with an Elliott Wave-like pattern analysis, offering a comprehensive and dynamic trading tool. It stands apart from conventional strategies by incorporating multiple layers of trend analysis, thereby providing a more robust and nuanced view of market movements.
*Although the script doesn't explicitly analyze Elliott Wave patterns, it employs a wave-like approach by considering multiple SuperTrend indicators. Elliott Wave theory is based on the premise that markets move in predictable wave patterns. While this script doesn't identify specific Elliott Wave structures like impulsive and corrective waves, the sequential checking of trend conditions across multiple SuperTrend indicators mimics a wave-like progression.
BTC 8hr Long/Short Performance
Local Detail
█ Strategy, How It Works: Detailed Explanation
The core of this strategy lies in its multi-tiered approach:
1. Multiple SuperTrend Indicators:
The strategy employs four different SuperTrend indicators, each with unique ATR lengths and multipliers. These indicators offer various perspectives on market trends, ranging from short to long-term views.
By analyzing the convergence of these indicators, the strategy can pinpoint robust entry signals for both long and short positions.
2. Elliott Wave-like Pattern Recognition:
While not directly applying Elliott Wave theory, the strategy takes inspiration from its pattern recognition approach. It looks for alignments in market movements that resemble the characteristic waves of Elliott's theory.
This pattern recognition aids in confirming the signals provided by the SuperTrend indicators, adding an extra layer of validation to the trading signals.
3. Comprehensive Market Analysis:
By combining multiple indicators and pattern analysis, the strategy offers a holistic view of the market. This allows for capturing potential trend reversals and significant market moves early.
█ Trade Direction
The strategy is designed with flexibility in mind, allowing traders to select their preferred trading direction – Long, Short, or Both. This adaptability is key for traders looking to tailor their approach to different market conditions or personal trading styles. The strategy automatically adjusts its logic based on the chosen direction, ensuring that traders are always aligned with their strategic objectives.
█ Usage
To utilize the "Elliott's Quadratic Momentum - Strategy" effectively:
Traders should first determine their trading direction and adjust the SuperTrend settings according to their market analysis and risk appetite.
The strategy is versatile and can be applied across various time frames and asset classes, making it suitable for a wide range of trading scenarios.
It's particularly effective in trending markets, where the alignment of multiple SuperTrend indicators can provide strong trade signals.
█ Default Settings
Trading Direction: Configurable (Long, Short, Both)
SuperTrend Settings:
SuperTrend 1: ATR Length 7, Multiplier 4.0
SuperTrend 2: ATR Length 14, Multiplier 3.618
SuperTrend 3: ATR Length 21, Multiplier 3.5
SuperTrend 4: ATR Length 28, Multiplier 3.382
Additional Settings: Gradient effect for trend visualization, customizable color schemes for upward and downward trends.
London BreakOut ClassicHey there, this is my first time publishing a strategy. The strategy is based on the London Breakout Idea, an incredibly popular concept with abundant information available online.
Let me summarize the London Breakout Strategy in a nutshell: It involves identifying key price levels based on the Tokyo Session before the London Session starts. Typically, these key levels are the high and low of the previous Tokyo session. If a breakout occurs during the London session, you simply follow the trend.
The purpose of this code
After conducting my research, I came across numerous posts, videos, and articles discussing the London Breakout Strategy. I aimed to automatically test it myself to verify whether the claims made by these so-called trading gurus are accurate or not. Consequently, I wrote this script to gain an understanding of how this strategy would perform if I were to follow its basic settings blindly.
Explanation of drawings on the chart:
Red or Green Box: A box is drawn on our chart displaying the exact range of the Tokyo trading session. This box is colored red if the trend during the session was downward and green if it was upward. The box is always drawn between the high and the low between 0:00 AM and 7:00 AM UTC. You can change the settings via the Inputs "Session time Tokyo" & "Session time zone".
Green Background: The green background represents the London trading session. My code allows us to make entries only during this time. If we haven't entered a trade, any pending orders are canceled. I've also programmed a timeout at 11 pm to ensure every trade is closed before the new Tokyo session begins.
Red Line: The red line is automatically placed in the middle of our previous Tokyo range. This line acts as our stop loss. If we cross this line after entering a trade but before reaching our take profit, we'll be stopped out.
When do we enter a trade?
We wait for a candle body to close outside of the previous Tokyo range to enter a trade with the opening of the next candle. We only enter one trade per day.
Where do we put our Take Profit?
The code calculates the exact distance between our entry point and the stop loss. We are trading a risk-reward ratio of 1:1 by default, meaning our take profit is always the same number of pips away from our entry as the stop loss. The Stop Loss is always defined by the red line on the chart. You can change the risk-reward ratio via the inputs setting "CRV", to see how the result changes.
What is the purpose of this script?
I wanted to backtest the London breakout strategy to see how it actually works. Therefore, I wrote this code so that everybody can test it for themselves. You can change the settings and see how the result changes. Typically, you should test this strategy on forex markets and on either 1Min, 5 Min, or 15 Min timeframe.
What are the results?
Over the last 3-6 months (over 100 trades), trading the strategy with my default settings hasn't proven to be very successful. Consequently, I do not recommend trading this strategy blindly. The purpose of this code is to provide you with a foundation for the London Breakout Strategy, allowing you to modify and enhance it according to your preferences. If you're contemplating whether to give it a try, you can assess the results from the past months by using this code as a starting point.
Trend-based Price Action StrategyThis is a strategy script that combines trend-based price action analysis with the Relative Strength Index (RSI) and Exponential Moving Averages (EMA) as trend filters. Here's a summary of the key components and logic:
Price Action Candlestick Patterns:
Bullish patterns: Engulfing candle and Morning Star.
Bearish patterns: Engulfing candle and Evening Star.
RSI Integration:
RSI is used to identify overbought and oversold conditions.
EMA Trend Filter:
Three EMAs with different periods: Fast , Medium and Slow.
Long trend condition occur when the fast EMA is above the medium and the medium is above the slow EMA.
Short trend condition occur when the slow EMA is above the medium and the medium is above the fast EMA.
Long entry conditions: RSI is oversold, RSI is decreasing, bullish candlestick pattern, and EMA trend filter conditions are met.
Short entry conditions: RSI is overbought, RSI is decreasing, bearish candlestick pattern, and EMA trend filter conditions are met.
Exit conditions:
Take profit or stop loss is reached.
Plotting:
Signals are plotted on the chart when entry conditions are met.
EMAs are plotted when the EMA trend filter is enabled.
This script aims to capture potential trend reversal points based on a combination of candlestick patterns, RSI, and EMA trend analysis.
Traders can use this script as a starting point for further customization or as a reference for developing their own trading strategies. It's important to note that past performance is not indicative of future results, and thorough testing and validation are recommended before deploying any trading strategy.
RMI Trend Sync - Strategy [presentTrading]█ Introduction and How It Is Different
The "RMI Trend Sync - Strategy " combines the strength of the Relative Momentum Index (RMI) with the dynamic nature of the Supertrend indicator. This strategy diverges from traditional methodologies by incorporating a dual analytical framework, leveraging both momentum and trend indicators to offer a more holistic market perspective. The integration of the RMI provides an enhanced understanding of market momentum, while the Super Trend indicator offers clear insights into the end of market trends, making this strategy particularly effective in diverse market conditions.
BTC 4h long/short performance
█ Strategy: How It Works - Detailed Explanation
- Understanding the Relative Momentum Index (RMI)
The Relative Momentum Index (RMI) is an adaptation of the traditional Relative Strength Index (RSI), designed to measure the momentum of price movements over a specified period. While RSI focuses on the speed and change of price movements, RMI incorporates the direction and magnitude of those movements, offering a more nuanced view of market momentum.
- Principle of RMI
Calculation Method: RMI is calculated by first determining the average gain and average loss over a given period (Length). It differs from RSI in that it uses the price change (close-to-close) rather than absolute gains or losses. The average gain is divided by the average loss, and this ratio is then normalized to fit within a 0-100 scale.
- Momentum Analysis in the Strategy
Thresholds for Decision Making: The strategy uses predetermined thresholds (pmom for positive momentum and nmom for negative momentum) to trigger trading decisions. When RMI crosses above the positive threshold and other conditions align (e.g., a bullish trend), it signals a potential long entry. Similarly, crossing below the negative threshold in a bearish trend may trigger a short entry.
- Super Trend and Trend Analysis
The Super Trend indicator is calculated based on a higher time frame, providing a broader view of the market trend. This indicator uses the Average True Range (ATR) to adapt to market volatility, making it an effective tool for identifying trend reversals.
The strategy employs a Volume Weighted Moving Average (VWMA) alongside the Super Trend, enhancing its capability to identify significant trend shifts.
ETH 4hr long/short performance
█ Trade Direction
The strategy offers flexibility in selecting the trading direction: long, short, or both. This versatility allows traders to adapt to their market outlook and risk tolerance, whether looking to capitalize on bullish trends, bearish trends, or a combination of both.
█ Usage
To effectively use the "RMI Trend Sync" strategy, traders should first set their preferred trading direction and adjust the RMI and Super Trend parameters according to their risk appetite and trading goals.
The strategy is designed to adapt to various market conditions, making it suitable for different asset classes and time frames.
█ Default Settings
RMI Settings: Length: 21, Positive Momentum Threshold: 70, Negative Momentum Threshold: 30
Super Trend Settings: Length: 10, Higher Time Frame: 480 minutes, Super Trend Factor: 3.5, MA Source: WMA
Visual Settings: Display Range MA: True, Bullish Color: #00bcd4, Bearish Color: #ff5252
Additional Settings: Band Length: 30, RWMA Length: 20
Rate of Change StrategyRate of Change Strategy :
INTRODUCTION :
This strategy is based on the Rate of Change indicator. It compares the current price with that of a user-defined period of time ago. This makes it easy to spot trends and even speculative bubbles. The strategy is long term and very risky, which is why we've added a Stop Loss. There's also a money management method that allows you to reinvest part of your profits or reduce the size of your orders in the event of substantial losses.
RATE OF CHANGE (ROC) :
As explained above, the ROC is used to situate the current price compared to that of a certain period of time ago. The formula for calculating ROC in relation to the previous year is as follows :
ROC (365) = (close/close (365) - 1) * 100
With this formula we can find out how many percent the change in the current price is compared with 365 days ago, and thus assess the trend.
PARAMETERS :
ROC Length : Length of the ROC to be calculated. The current price is compared with that of the selected length ago.
ROC Bubble Signal : ROC value indicating that we are in a bubble. This value varies enormously depending on the financial product. For example, in the equity market, a bubble exists when ROC = 40, whereas in cryptocurrencies, a bubble exists when ROC = 150.
Stop Loss (in %) : Stop Loss value in percentage. This is the maximum trade value percentage that can be lost in a single trade.
Fixed Ratio : This is the amount of gain or loss at which the order quantity is changed. The default is 400, which means that for each $400 gain or loss, the order size is increased or decreased by an amount chosen by the user.
Increasing Order Amount : This is the amount to be added to or subtracted from orders when the fixed ratio is reached. The default is $200, which means that for every $400 gain, $200 is reinvested in the strategy. On the other hand, for every $400 loss, the order size is reduced by $200.
Initial capital : $1000
Fees : Interactive Broker fees apply to this strategy. They are set at 0.18% of the trade value.
Slippage : 3 ticks or $0.03 per trade. Corresponds to the latency time between the moment the signal is received and the moment the order is executed by the broker.
Important : A bot has been used to test the different parameters and determine which ones maximize return while limiting drawdown. This strategy is the most optimal on BITSTAMP:BTCUSD in 1D timeframe with the following parameters :
ROC Length = 365
ROC Bubble Signal = 180
Stop Loss (in %) = 6
LONG CONDITION :
We are in a LONG position if ROC (365) > 0 for at least two days. This allows us to limit noise and irrelevant signals to ensure that the ROC remains positive.
SHORT CONDITION :
We are in a SHORT position if ROC (365) < 0 for at least two days. We also open a SHORT position when the speculative bubble is about to burst. If ROC (365) > 180, we're in a bubble. If the bubble has been in existence for at least a week and the ROC falls back below this threshold, we can expect the asset to return to reasonable prices, and thus a downward trend. So we're opening a SHORT position to take advantage of this upcoming decline.
EXIT RULES FOR WINNING TRADE :
The strategy is self-regulating. We don't exit a LONG trade until a SHORT signal has arrived, and vice versa. So, to exit a winning position, you have to wait for the entry signal of the opposite position.
RISK MANAGEMENT :
This strategy is very risky, and we can easily end up on the wrong side of the trade. That's why we're going to manage our risk with a Stop Loss, limiting our losses as a percentage of the trade's value. By default, this percentage is set at 6%. Each trade will therefore take a maximum loss of 6%.
If the SL has been triggered, it probably means we were on the wrong side. This is why we change the direction of the trade when a SL is triggered. For example, if we were SHORT and lost 6% of the trade value, the strategy will close this losing trade and open a long position without taking into account the ROC value. This allows us to be in position all the time and not miss the best opportunities.
MONEY MANAGEMENT :
The fixed ratio method was used to manage our gains and losses. For each gain of an amount equal to the value of the fixed ratio, we increase the order size by a value defined by the user in the "Increasing order amount" parameter. Similarly, each time we lose an amount equal to the value of the fixed ratio, we decrease the order size by the same user-defined value. This strategy increases both performance and drawdown.
NOTE :
Please note that the strategy is backtested from 2017-01-01. As the timeframe is 1D, this strategy is a medium/long-term strategy. That's why only 34 trades were closed. Be careful, as the test sample is small and performance may not necessarily reflect what may happen in the future.
Enjoy the strategy and don't forget to take the trade :)
Multi-TF AI SuperTrend with ADX - Strategy [PresentTrading]
## █ Introduction and How it is Different
The trading strategy in question is an enhanced version of the SuperTrend indicator, combined with AI elements and an ADX filter. It's a multi-timeframe strategy that incorporates two SuperTrends from different timeframes and utilizes a k-nearest neighbors (KNN) algorithm for trend prediction. It's different from traditional SuperTrend indicators because of its AI-based predictive capabilities and the addition of the ADX filter for trend strength.
BTC 8hr Performance
ETH 8hr Performance
## █ Strategy, How it Works: Detailed Explanation (Revised)
### Multi-Timeframe Approach
The strategy leverages the power of multiple timeframes by incorporating two SuperTrend indicators, each calculated on a different timeframe. This multi-timeframe approach provides a holistic view of the market's trend. For example, a 8-hour timeframe might capture the medium-term trend, while a daily timeframe could capture the longer-term trend. When both SuperTrends align, the strategy confirms a more robust trend.
### K-Nearest Neighbors (KNN)
The KNN algorithm is used to classify the direction of the trend based on historical SuperTrend values. It uses weighted voting of the 'k' nearest data points. For each point, it looks at its 'k' closest neighbors and takes a weighted average of their labels to predict the current label. The KNN algorithm is applied separately to each timeframe's SuperTrend data.
### SuperTrend Indicators
Two SuperTrend indicators are used, each from a different timeframe. They are calculated using different moving averages and ATR lengths as per user settings. The SuperTrend values are then smoothed to make them suitable for KNN-based prediction.
### ADX and DMI Filters
The ADX filter is used to eliminate weak trends. Only when the ADX is above 20 and the directional movement index (DMI) confirms the trend direction, does the strategy signal a buy or sell.
### Combining Elements
A trade signal is generated only when both SuperTrends and the ADX filter confirm the trend direction. This multi-timeframe, multi-indicator approach reduces false positives and increases the robustness of the strategy.
By considering multiple timeframes and using machine learning for trend classification, the strategy aims to provide more accurate and reliable trade signals.
BTC 8hr Performance (Zoom-in)
## █ Trade Direction
The strategy allows users to specify the trade direction as 'Long', 'Short', or 'Both'. This is useful for traders who have a specific market bias. For instance, in a bullish market, one might choose to only take 'Long' trades.
## █ Usage
Parameters: Adjust the number of neighbors, data points, and moving averages according to the asset and market conditions.
Trade Direction: Choose your preferred trading direction based on your market outlook.
ADX Filter: Optionally, enable the ADX filter to avoid trading in a sideways market.
Risk Management: Use the trailing stop-loss feature to manage risks.
## █ Default Settings
Neighbors (K): 3
Data points for KNN: 12
SuperTrend Length: 10 and 5 for the two different SuperTrends
ATR Multiplier: 3.0 for both
ADX Length: 21
ADX Time Frame: 240
Default trading direction: Both
By customizing these settings, traders can tailor the strategy to fit various trading styles and assets.
2 Moving Averages | Trend FollowingThe trading system is a trend-following strategy based on two moving averages (MA) and Parabolic SAR (PSAR) indicators.
How it works:
The strategy uses two moving averages: a fast MA and a slow MA.
It checks for a bullish trend when the fast MA is above the slow MA and the current price is above the fast MA.
It checks for a bearish trend when the fast MA is below the slow MA and the current price is below the fast MA.
The Parabolic SAR (PSAR) indicator is used for additional trend confirmation.
Long and short positions can be turned on or off based on user input.
The strategy incorporates risk management with stop-loss orders based on the Average True Range (ATR).
Users can filter the backtest date range and display various indicators.
The strategy is designed to work with the date range filter, risk management, and user-defined positions.
Features:
Trend-following strategy.
Two customizable moving averages.
Parabolic SAR for trend confirmation.
User-defined risk management with stop-loss based on ATR.
Backtest date range filter.
Flexibility to enable or disable long and short positions.
This trading system provides a comprehensive approach to trend-following and risk management, making it suitable for traders looking to capture trends with controlled risk.
Renko StrategyRENKO STRATEGY
CAUTION : This strategy must be applied to a candlestick chart (not a Renko chart).
INTRODUCTION :
The Traditional Renko chart has been reproduced and is plotted according to the evolution of the price. It will enable us to receive buy or sell signals and follow major trends. This is a medium/long term strategy and depends a lot on the box size chosen in the parameters. There's also a money management method allowing us to reinvest part of the profits or reduce the size of orders in the event of substantial losses.
RENKO CHART :
Renko chart construction methodology :
The user must first choose the box size. The minimum is 0.00001 and there is no maximum. The default is 10. The user must then choose the source that will define the data on which the calculations will be based (high, low, open, close). By default, close is selected. The first candle on the chart is used to draw the first box with its high and low.
Each time the price changes by the amount of the box size relative to the high or low of the last box, a new box is added above or below the previous one. If price variations are less than the box size, the same box is added next to the previous one. If price variations are N (integer number) times greater than box size, N boxes are added above or below the previous one. Each box added above the previous one is a green box, while each box added below the previous one is a red box.
Conditions for drawing a green box above the previous one :
(source - high_of_the_last_box) / box_size > 1
Condition for drawing a red box below the previous one :
(low_of_the_last_box - source) / box_size > 1
If neither condition is triggered, the same box is drawn next to the previous one.
Example :
The last candle has drawn a box with low 12 and high 14. The box size is therefore 2. The strategy will look at the value of the close each time a candle ends. The current candle closes with a close equal to 15.5. As the variation from the previous high is only 1.5 (which is less than the box size), the same box is added next to the previous one. The next candle closes at 16.2. The price variation is therefore 2.2 compared with the previous high. We can now add a new green box just above the previous one, with a low of 14 and a high of 16. The same process applies if the candle's close is at least one box size below the low of the last box. In this case, a new red box is placed below the previous one.
PARAMETERS :
Source : Allows you to specify which data will be taken into account by the strategy when performing calculations. The default is close.
Box size : Size of Renko graph boxes. This is a very important parameter to choose carefully, as it has a strong impact on the strategy's performance. Defaults to 10.
Fixed Ratio : This is the amount of gain or loss at which the order quantity is changed. The default is 400, meaning that for each $400 gain or loss, the order size is increased or decreased by a user-selected amount.
Increasing Order Amount : This is the amount to be added to or subtracted from orders when the fixed ratio is reached. The default is $200, which means that for every $400 gain, $200 is reinvested in the strategy. On the other hand, for every $400 loss, the order size is reduced by $200.
Initial capital : $1000
Fees : Interactive Broker fees apply to this strategy. They are set at 0.18% of the trade value.
Slippage : 3 ticks or $0.03 per trade. Corresponds to the latency time between the moment the signal is received and the moment the order is executed by the broker.
Important : A bot has been used to test all possible box sizes to find out which one generates the highest return on BITSTAMP:LTCUSD while limiting the drawdown. This strategy is the most optimal with a box size equal to 5.08 in 8h timeframe.
BUY AND SHORT SIGNALS :
As the aim of this strategy is to follow major trends based on price movements, we need to be on the right side of price fluctuation. We trade every box reversal, i.e. we are LONG when the boxes are green indicating an uptrend and SHORT when they are red indicating a downtrend.
RISK MANAGEMENT :
This strategy can incur losses. The size of the box is decisive, as it is used to plot the RENKO chart and thus trigger buy or sell signals. It's also what allows us to manage risk. For every trade, we risk a maximum amount equal to 2 times the size of the box, i.e. :(5.08*2*nb_contract)/trade_value.
MONEY MANAGEMENT :
The fixed ratio method has been used to manage our gains and losses. For each gain of an amount equal to the value of the fixed ratio, we increase the order size by a value defined by the user in the "Increasing order amount" parameter. Similarly, each time we lose an amount equal to the value of the fixed ratio, we decrease the order size by the same user-defined value. This strategy not only increases our performance, but also our drawdown.
Enjoy the strategy and don't forget to take the trade :)
TradingView.To Strategy Template (with Dyanmic Alerts)Hello traders,
If you're tired of manual trading and looking for a solid strategy template to pair with your indicators, look no further.
This Pine Script v5 strategy template is engineered for maximum customization and risk management.
Best part?
This Pine Script v5 template facilitates the dynamic construction of TradingView.TO alerts, sparing users the time and effort of mastering the TradingView.TO syntax and manually create alert commands.
This powerful tool gives much power to those who don't know how to code in Pinescript and want to automate their indicators' signals via TradingView.TO bot.
IMPORTANT NOTES
TradingView.TO is a trading bot software that forwards TradingView alerts to your brokers (examples: Binance, Oanda, Coinbase, Bybit, Metatrader 4/5, ...) for automating trading.
Many traders don't know how to create TradingView.TO dynamically-compatible alerts using the data from their TradingView scripts.
Traders using trading bots want their alerts to reflect the stop-loss/take-profit/trailing-stop/stop-loss to break options from your script and then create the orders accordingly.
This script showcases how to create TradingView.TO alerts dynamically.
TRADINGVIEW ALERTS
1) You'll have to create one alert per asset X timeframe = 1 chart.
Example: 1 alert for BTC/USDT on the 5 minutes chart, 1 alert for BTC/USDT on the 15-minute chart (assuming you want your bot to trade the BTC/USDT on the 5 and 15-minute timeframes)
2) Select the Order fills and alert() function calls condition
3) For each alert, the alert message is pre-configured with the text below
{{strategy.order.alert_message}}
Please leave it as it is.
It's a TradingView native variable that will fetch the alert text messages built by the script.
4) TradingView.TO uses webhook technology - setting a webhook URL from the alerts notifications tab is required.
KEY FEATURES
I) Modular Indicator Connection
* plug your existing indicator into the template.
* Only two lines of code are needed for full compatibility.
Step 1: Create your connector
Adapt your indicator with only 2 lines of code and then connect it to this strategy template.
To do so:
1) Find in your indicator where the conditions print the long/buy and short/sell signals.
2) Create an additional plot as below
I'm giving an example with a Two moving averages cross.
Please replicate the same methodology for your indicator, whether a MACD , ZigZag, Pivots , higher-highs, lower-lows or whatever indicator with clear buy and sell conditions.
//@version=5
indicator("Supertrend", overlay = true, timeframe = "", timeframe_gaps = true)
atrPeriod = input.int(10, "ATR Length", minval = 1)
factor = input.float(3.0, "Factor", minval = 0.01, step = 0.01)
= ta.supertrend(factor, atrPeriod)
supertrend := barstate.isfirst ? na : supertrend
bodyMiddle = plot(barstate.isfirst ? na : (open + close) / 2, display = display.none)
upTrend = plot(direction < 0 ? supertrend : na, "Up Trend", color = color.green, style = plot.style_linebr)
downTrend = plot(direction < 0 ? na : supertrend, "Down Trend", color = color.red, style = plot.style_linebr)
fill(bodyMiddle, upTrend, color.new(color.green, 90), fillgaps = false)
fill(bodyMiddle, downTrend, color.new(color.red, 90), fillgaps = false)
buy = ta.crossunder(direction, 0)
sell = ta.crossunder(direction, 0)
//////// CONNECTOR SECTION ////////
Signal = buy ? 1 : sell ? -1 : 0
plot(Signal, title = "Signal", display = display.data_window)
//////// CONNECTOR SECTION ////////
Important Notes
🔥 The Strategy Template expects the value to be exactly 1 for the bullish signal and -1 for the bearish signal
Now, you can connect your indicator to the Strategy Template using the method below or that one.
Step 2: Connect the connector
1) Add your updated indicator to a TradingView chart
2) Add the Strategy Template as well to the SAME chart
3) Open the Strategy Template settings, and in the Data Source field, select your 🔌Connector🔌 (which comes from your indicator)
Note it doesn’t have to be named 🔌Connector🔌 - you can name it as you want - however, I recommend an explicit name you can easily remember.
From then, you should start seeing the signals and plenty of other stuff on your chart.
🔥 Note that whenever you update your indicator values, the strategy statistics and visuals on your chart will update in real-time
II) BOT Risk Management:
- Max Drawdown:
Mode: Select whether the max drawdown is calculated in percentage (%) or USD.
Value: If the max drawdown reaches this specified value, set a value to halt the bot.
- Max Consecutive Days:
Use Max Consecutive Days BOT Halt: Enable/Disable halting the bot if the max consecutive losing days value is reached.
- Max Consecutive Days: Set the maximum number of consecutive losing days allowed before halting the bot.
- Max Losing Streak:
Use Max Losing Streak: Enable/Disable a feature to prevent the bot from taking too many losses in a row.
- Max Losing Streak Length: Set the maximum length of a losing streak allowed.
Margin Call:
- Use Margin Call: Enable/Disable a feature to exit when a specified percentage away from a margin call to prevent it.
Margin Call (%): Set the percentage value to trigger this feature.
- Close BOT Total Loss:
Use Close BOT Total Loss: Enable/Disable a feature to close all trades and halt the bot if the total loss is reached.
- Total Loss ($): Set the total loss value in USD to trigger this feature.
Intraday BOT Risk Management:
- Intraday Losses:
Use Intraday Losses BOT Halt: Enable/Disable halting the bot on reaching specified intraday losses.
Mode: Select whether the intraday loss is calculated in percentage (%) or USD.
- Max Intraday Losses (%): Set the value for maximum intraday losses.
Limit Intraday Trades:
- Use Limit Intraday Trades: Enable/Disable a feature to limit the number of intraday trades.
- Max Intraday Trades: Set the maximum number of intraday trades allowed.
Restart Intraday EA:
III) Order Types and Position Sizing
- Choose between market or limit orders.
- Set your position size directly in the template.
Please use the position size from the “Inputs” and not the “Properties” tab.
I know it's redundant. - the template needs this value from the "Inputs" tab to build the alerts, and the Backtester needs it from the "Properties" tab.
IV) Advanced Take-Profit and Stop-Loss Options
- Choose to set your SL/TP in either USD or percentages.
- Option for multiple take-profit levels and trailing stop losses.
- Move your stop loss to break even +/- offset in USD for “risk-free” trades.
V) Miscellaneous:
Retry order openings if they fail.
Order Types:
Select and specify order type and price settings.
Position Size:
Define the type and size of positions.
Leverage:
Leverage settings, including margin type and hedge mode.
Session:
Limit trades to specific sessions.
Dates:
Limit trades to a specific date range.
Trades Direction:
Direction: Specify the market direction for opening positions.
VI) Logger
The TradingView.TO commands are logged in the TradingView logger.
You'll find more information about it in this TradingView blog post .
WHY YOU MIGHT NEED THIS TEMPLATE
1) Transform your indicator into a TradingView.TO trading bot more easily than before
Connect your indicator to the template
Create your alerts
Set your EA settings
2) Save Time
Auto-generated alert messages for TradingView.TO.
I tested them all and checked with the support team what could/couldn’t be done.
3) Be in Control
Manage your trading risks with advanced features.
4) Customizable
Fits various trading styles and asset classes.
REQUIREMENTS
* Make sure you have your TradingView.TO account
* If there is any issue with the template, ask me in the comments section - I’ll answer quickly.
BACKTEST RESULTS FROM THIS POST
1) I connected this strategy template to a dummy Supertrend script.
I could have selected any other indicator or concept for this script post.
I wanted to share an example of how you can quickly upgrade your strategy, making it compatible with TradingView.TO.
2) The backtest results aren't relevant for this educational script publication.
I used realistic backtesting data but didn't look too much into optimizing the results, as this isn't the point of why I'm publishing this script.
This strategy is a template to be connected to any indicator - the sky is the limit. :)
3) This template is made to take 1 trade per direction at any given time.
Pyramiding is set to 1 on TradingView.
The strategy default settings are:
* Initial Capital: 100000 USD
* Position Size: 1%
* Commission Percent: 0.075%
* Slippage: 1 tick
* No margin/leverage used
Engulfing with TrendThe script above is a trading strategy with rules based on the Engulfing candlestick pattern within the context of the trend. Some key elements of this script include:
1. ATR (Average True Range) settings to measure market volatility.
2. Supertrend settings to identify the market trend.
3. Conditions for determining uptrend and downtrend.
4. Determination of Bullish (Engulfing pattern during uptrend) and Bearish (Engulfing pattern during downtrend).
5. Calculation of Stop Loss (SL) and Take Profit (TP) levels based on the Engulfing pattern.
6. Entry conditions based on the Engulfing pattern and the corresponding trend.
7. Exit conditions based on price crossovers with SL and TP levels.
8. Plotting of the Engulfing patterns on the chart.
This strategy is used to identify trading opportunities based on Engulfing candlestick patterns that align with the direction of the market trend. Additionally, stop loss and take profit levels are calculated based on the Engulfing pattern, and trading signals are displayed on the chart.
It's important to note that this script can be customized according to your trading preferences and strategy.
Machine Learning: SuperTrend Strategy TP/SL [YinYangAlgorithms]The SuperTrend is a very useful Indicator to display when trends have shifted based on the Average True Range (ATR). Its underlying ideology is to calculate the ATR using a fixed length and then multiply it by a factor to calculate the SuperTrend +/-. When the close crosses the SuperTrend it changes direction.
This Strategy features the Traditional SuperTrend Calculations with Machine Learning (ML) and Take Profit / Stop Loss applied to it. Using ML on the SuperTrend allows for the ability to sort data from previous SuperTrend calculations. We can filter the data so only previous SuperTrends that follow the same direction and are within the distance bounds of our k-Nearest Neighbour (KNN) will be added and then averaged. This average can either be achieved using a Mean or with an Exponential calculation which puts added weight on the initial source. Take Profits and Stop Losses are then added to the ML SuperTrend so it may capitalize on Momentum changes meanwhile remaining in the Trend during consolidation.
By applying Machine Learning logic and adding a Take Profit and Stop Loss to the Traditional SuperTrend, we may enhance its underlying calculations with potential to withhold the trend better. The main purpose of this Strategy is to minimize losses and false trend changes while maximizing gains. This may be achieved by quick reversals of trends where strategic small losses are taken before a large trend occurs with hopes of potentially occurring large gain. Due to this logic, the Win/Loss ratio of this Strategy may be quite poor as it may take many small marginal losses where there is consolidation. However, it may also take large gains and capitalize on strong momentum movements.
Tutorial:
In this example above, we can get an idea of what the default settings may achieve when there is momentum. It focuses on attempting to hit the Trailing Take Profit which moves in accord with the SuperTrend just with a multiplier added. When momentum occurs it helps push the SuperTrend within it, which on its own may act as a smaller Trailing Take Profit of its own accord.
We’ve highlighted some key points from the last example to better emphasize how it works. As you can see, the White Circle is where profit was taken from the ML SuperTrend simply from it attempting to switch to a Bullish (Buy) Trend. However, that was rejected almost immediately and we went back to our Bearish (Sell) Trend that ended up resulting in our Take Profit being hit (Yellow Circle). This Strategy aims to not only capitalize on the small profits from SuperTrend to SuperTrend but to also capitalize when the Momentum is so strong that the price moves X% away from the SuperTrend and is able to hit the Take Profit location. This Take Profit addition to this Strategy is crucial as momentum may change state shortly after such drastic price movements; and if we were to simply wait for it to come back to the SuperTrend, we may lose out on lots of potential profit.
If you refer to the Yellow Circle in this example, you’ll notice what was talked about in the Summary/Overview above. During periods of consolidation when there is little momentum and price movement and we don’t have any Stop Loss activated, you may see ‘Signal Flashing’. Signal Flashing is when there are Buy and Sell signals that keep switching back and forth. During this time you may be taking small losses. This is a normal part of this Strategy. When a signal has finally been confirmed by Momentum, is when this Strategy shines and may produce the profit you desire.
You may be wondering, what causes these jagged like patterns in the SuperTrend? It's due to the ML logic, and it may be a little confusing, but essentially what is happening is the Fast Moving SuperTrend and the Slow Moving SuperTrend are creating KNN Min and Max distances that are extreme due to (usually) parabolic movement. This causes fewer values to be added to and averaged within the ML and causes less smooth and more exponential drastic movements. This is completely normal, and one of the perks of using k-Nearest Neighbor for ML calculations. If you don’t know, the Min and Max Distance allowed is derived from the most recent(0 index of data array) to KNN Length. So only SuperTrend values that exhibit distances within these Min/Max will be allowed into the average.
Since the KNN ML logic can cause these exponential movements in the SuperTrend, they likewise affect its Take Profit. The Take Profit may benefit from this movement like displayed in the example above which helped it claim profit before then exhibiting upwards movement.
By default our Stop Loss Multiplier is kept quite low at 0.0000025. Keeping it low may help to reduce some Signal Flashing while not taking extra losses more so than not using it at all. However, if we increase it even more to say 0.005 like is shown in the example above. It can really help the trend keep momentum. Please note, although previous results don’t imply future results, at 0.0000025 Stop Loss we are currently exhibiting 69.27% profit while at 0.005 Stop Loss we are exhibiting 33.54% profit. This just goes to show that although there may be less Signal Flashing, it may not result in more profit.
We will conclude our Tutorial here. Hopefully this has given you some insight as to how Machine Learning, combined with Trailing Take Profit and Stop Loss may have positive effects on the SuperTrend when turned into a Strategy.
Settings:
SuperTrend:
ATR Length: ATR Length used to create the Original Supertrend.
Factor: Multiplier used to create the Original Supertrend.
Stop Loss Multiplier: 0 = Don't use Stop Loss. Stop loss can be useful for helping to prevent false signals but also may result in more loss when hit and less profit when switching trends.
Take Profit Multiplier: Take Profits can be useful within the Supertrend Strategy to stop the price reverting all the way to the Stop Loss once it's been profitable.
Machine Learning:
Only Factor Same Trend Direction: Very useful for ensuring that data used in KNN is not manipulated by different SuperTrend Directional data. Please note, it doesn't affect KNN Exponential.
Rationalized Source Type: Should we Rationalize only a specific source, All or None?
Machine Learning Type: Are we using a Simple ML Average, KNN Mean Average, KNN Exponential Average or None?
Machine Learning Smoothing Type: How should we smooth our Fast and Slow ML Datas to be used in our KNN Distance calculation? SMA, EMA or VWMA?
KNN Distance Type: We need to check if distance is within the KNN Min/Max distance, which distance checks are we using.
Machine Learning Length: How far back is our Machine Learning going to keep data for.
k-Nearest Neighbour (KNN) Length: How many k-Nearest Neighbours will we account for?
Fast ML Data Length: What is our Fast ML Length?? This is used with our Slow Length to create our KNN Distance.
Slow ML Data Length: What is our Slow ML Length?? This is used with our Fast Length to create our KNN Distance.
If you have any questions, comments, ideas or concerns please don't hesitate to contact us.
HAPPY TRADING!
ProfitView Strategy TemplateHello traders,
This script took me a full week of coding/testing, sweat, and tears - and I’m too nice as I’m giving it for free to the community.
If you're tired of manual trading and looking for a solid strategy template to pair with your indicators, look no further.
This Pine Script v5 strategy template is engineered for maximum customization and risk management.
Best part?
This Pine Script v5 template facilitates the dynamic construction of ProfitView alerts, sparing users the time and effort of mastering the ProfitView syntax and manually creating alert commands.
This powerful tool gives much power to those who don't know how to code in Pinescript and want to automate their indicators' signals via the ProfitView Chrome extension.
IMPORTANT NOTES
ProfitView is a trading bot software that forwards TradingView alerts to your brokers (examples: Binance, Oanda, Coinbase, Bybit, etc.) for automating trading.
Many traders don't know how to dynamically create ProfitView-compatible alerts using the data from their TradingView scripts.
Traders using trading bots want their alerts to reflect the stop-loss/take-profit/trailing-stop/stop-loss to break options from your script and then create the orders accordingly.
This script showcases how to create ProfitView alerts dynamically.
TRADINGVIEW ALERTS
1) You'll have to create one alert per asset X timeframe = 1 chart.
Example: 1 alert for EUR/USD on the 5 minutes chart, 1 alert for EUR/USD on the 15-minute chart (assuming you want your bot to trade the EUR/USD on the 5 and 15-minute timeframes)
2) Select the Order fills and alert() function calls condition
3) For each alert, the alert message is pre-configured with the text below
{{strategy.order.alert_message}}
Please leave it as it is.
It's a TradingView native variable that will fetch the alert text messages built by the script.
4) ProfitView doesn't use webhook technology, so setting a webhook URL from the alerts notifications tab is unnecessary.
KEY FEATURES
I) Modular Indicator Connection
* plug your existing indicator into the template.
* Only two lines of code are needed for full compatibility.
Step 1: Create your connector
Adapt your indicator with only 2 lines of code and then connect it to this strategy template.
To do so:
1) Find in your indicator where the conditions print the long/buy and short/sell signals.
2) Create an additional plot as below
I'm giving an example with a Two moving averages cross.
Please replicate the same methodology for your indicator, whether a MACD , ZigZag, Pivots , higher-highs, lower-lows or whatever indicator with clear buy and sell conditions.
//@version=5
indicator("Supertrend", overlay = true, timeframe = "", timeframe_gaps = true)
atrPeriod = input.int(10, "ATR Length", minval = 1)
factor = input.float(3.0, "Factor", minval = 0.01, step = 0.01)
= ta.supertrend(factor, atrPeriod)
supertrend := barstate.isfirst ? na : supertrend
bodyMiddle = plot(barstate.isfirst ? na : (open + close) / 2, display = display.none)
upTrend = plot(direction < 0 ? supertrend : na, "Up Trend", color = color.green, style = plot.style_linebr)
downTrend = plot(direction < 0 ? na : supertrend, "Down Trend", color = color.red, style = plot.style_linebr)
fill(bodyMiddle, upTrend, color.new(color.green, 90), fillgaps = false)
fill(bodyMiddle, downTrend, color.new(color.red, 90), fillgaps = false)
buy = ta.crossunder(direction, 0)
sell = ta.crossunder(direction, 0)
//////// CONNECTOR SECTION ////////
Signal = buy ? 1 : sell ? -1 : 0
plot(Signal, title = "Signal", display = display.data_window)
//////// CONNECTOR SECTION ////////
Important Notes
🔥 The Strategy Template expects the value to be exactly 1 for the bullish signal and -1 for the bearish signal
Now, you can connect your indicator to the Strategy Template using the method below or that one.
Step 2: Connect the connector
1) Add your updated indicator to a TradingView chart
2) Add the Strategy Template as well to the SAME chart
3) Open the Strategy Template settings, and in the Data Source field, select your 🔌Connector🔌 (which comes from your indicator)
Note it doesn’t have to be named 🔌Connector🔌 - you can name it as you want - however, I recommend an explicit name you can easily remember.
From then, you should start seeing the signals and plenty of other stuff on your chart.
🔥 Note that whenever you update your indicator values, the strategy statistics and visuals on your chart will update in real-time
II) BOT Risk Management:
- Max Drawdown:
Mode: Select whether the max drawdown is calculated in percentage (%) or USD.
Value: If the max drawdown reaches this specified value, set a value to halt the bot.
- Max Consecutive Days:
Use Max Consecutive Days BOT Halt: Enable/Disable halting the bot if the max consecutive losing days value is reached.
- Max Consecutive Days: Set the maximum number of consecutive losing days allowed before halting the bot.
- Max Losing Streak:
Use Max Losing Streak: Enable/Disable a feature to prevent the bot from taking too many losses in a row.
- Max Losing Streak Length: Set the maximum length of a losing streak allowed.
Margin Call:
- Use Margin Call: Enable/Disable a feature to exit when a specified percentage away from a margin call to prevent it.
Margin Call (%): Set the percentage value to trigger this feature.
- Close BOT Total Loss:
Use Close BOT Total Loss: Enable/Disable a feature to close all trades and halt the bot if the total loss is reached.
- Total Loss ($): Set the total loss value in USD to trigger this feature.
Intraday BOT Risk Management:
- Intraday Losses:
Use Intraday Losses BOT Halt: Enable/Disable halting the bot on reaching specified intraday losses.
Mode: Select whether the intraday loss is calculated in percentage (%) or USD.
- Max Intraday Losses (%): Set the value for maximum intraday losses.
Limit Intraday Trades:
- Use Limit Intraday Trades: Enable/Disable a feature to limit the number of intraday trades.
- Max Intraday Trades: Set the maximum number of intraday trades allowed.
Restart Intraday EA:
- Use Restart Intraday EA: Enable/Disable a feature to restart the bot at the first bar of the next day if it has been stopped with an intraday risk management safeguard.
III) Order Types and Position Sizing
- Choose between market, limit, or stop orders.
- Set your position size directly in the template.
Please use the position size from the “Inputs” and not the “Properties” tab.
I know it's redundant. - the template needs this value from the "Inputs" tab to build the alerts, and the Backtester needs it from the "Properties" tab.
IV) Advanced Take-Profit and Stop-Loss Options
- Choose to set your SL/TP in either pips or percentages.
- Option for multiple take-profit levels and trailing stop losses.
- Move your stop loss to break even +/- offset in pips for “risk-free” trades.
V) Miscellaneous
Retry order openings if they fail.
Order Types:
Select and specify order type and price settings.
Position Size:
Define the type and size of positions.
Leverage:
Leverage settings, including margin type and hedge mode.
Session:
Limit trades to specific sessions.
Dates:
Limit trades to a specific date range.
Trades Direction:
Direction: Specify the market direction for opening positions.
VI) Notifications (Telegram/Discord/Email/IFTTT/Twilio/SMS)
Customize notifications sent to Telegram, Discord, Email, IFTTT, Twilio, and ProfitView Logger.
VII) Logger
The ProfitView commands are logged in the TradingView logger.
You'll find more information about it in this TradingView blog post .
WHY YOU MIGHT NEED THIS TEMPLATE
1) Transform your indicator into a ProfitView trading bot more easily than before
Connect your indicator to the template
Create your alerts
Set your EA settings
2) Save Time
Auto-generated alert messages for ProfitView.
I tested them all and checked with the support team what could/couldn’t be done.
3) Be in Control
Manage your trading risks with advanced features.
4) Customizable
Fits various trading styles and asset classes.
REQUIREMENTS
* Make sure you have your ProfitView account and do the settings correctly in your Chrome extension. If you don't know how to do it, read the documentation + ask for help in the ProfitView Discord support channel.
* If there is any issue with the template, ask me in the comments section - I’ll answer quickly.
BACKTEST RESULTS FROM THIS POST
1) I connected this strategy template to a dummy Supertrend script.
I could have selected any other indicator or concept for this script post.
I wanted to share an example of how you can quickly upgrade your strategy, making it compatible with ProfitView.
2) The backtest results aren't relevant for this educational script publication.
I used realistic backtesting data but didn't look too much into optimizing the results, as this isn't the point of why I'm publishing this script.
This strategy is a template to be connected to any indicator - the sky is the limit. :)
3) This template is made to take 1 trade per direction at any given time.
Pyramiding is set to 1 on TradingView.
The strategy default settings are:
* Initial Capital: 100000 USD
* Position Size: 1%
* Commission Percent: 0.075%
* Slippage: 1 tick
* No margin/leverage used
Best regards,
Dave
Pineconnector Strategy Template (Connect Any Indicator)Hello traders,
If you're tired of manual trading and looking for a solid strategy template to pair with your indicators, look no further.
This Pine Script v5 strategy template is engineered for maximum customization and risk management.
Best part?
It’s optimized for Pineconnector, allowing seamless integration with MetaTrader 4 and 5.
This powerful tool gives a lot of power to those who don't know how to code in Pinescript and are looking to automate their indicators' signals on Metatrader 4/5.
IMPORTANT NOTES
Pineconnector is a trading bot software that forwards TradingView alerts to your Metatrader 4/5 for automating trading.
Many traders don't know how to dynamically create Pineconnector-compatible alerts using the data from their TradingView scripts.
Traders using trading bots want their alerts to reflect the stop-loss/take-profit/trailing-stop/stop-loss to break options from your script and then create the orders accordingly.
This script showcases how to create Pineconnector alerts dynamically.
Pineconnector doesn't support alerts with multiple Take Profits.
As a workaround, for 2 TPs, I had to open two trades.
It's not optimal, as we end up paying more spreads for that extra trade - however, depending on your trading strategy, it may not be a big deal.
TRADINGVIEW ALERTS
1) You'll have to create one alert per asset X timeframe = 1 chart.
Example: 1 alert for EUR/USD on the 5 minutes chart, 1 alert for EUR/USD on the 15-minute chart (assuming you want your bot to trade the EUR/USD on the 5 and 15-minute timeframes)
2) Select the Order fills and alert() function calls condition
3) For each alert, the alert message is pre-configured with the text below
{{strategy.order.alert_message}}
Please leave it as it is.
It's a TradingView native variable that will fetch the alert text messages built by the script.
4) Don't forget to set the Pineconnector webhook URL in the Notifications tab of the TradingView alerts UI.
You’ll find the URL on the Pineconnector documentation website.
EA CONFIGURATION
1) The Pyramiding in the EA on Metatrader must be set to 2 if you want to trade with 2 TPs => as it's opening 2 trades.
If you only want 1 TP, set the EA Pyramiding to 1.
Regarding the other EA settings, please refer to the Pineconnector documentation on their website.
2) In the EA, you can set a risk (= position size type) in %/lots/USD, as in the TradingView backtest settings.
KEY FEATURES
I) Modular Indicator Connection
* plug in your existing indicator into the template.
* Only two lines of code are needed for full compatibility.
Step 1: Create your connector
Adapt your indicator with only 2 lines of code and then connect it to this strategy template.
To do so:
1) Find in your indicator where the conditions print the long/buy and short/sell signals.
2) Create an additional plot as below
I'm giving an example with a Two moving averages cross.
Please replicate the same methodology for your indicator, whether it's a MACD , ZigZag , Pivots , higher-highs, lower-lows, or whatever indicator with clear buy and sell conditions.
//@version=5
indicator("Supertrend", overlay = true, timeframe = "", timeframe_gaps = true)
atrPeriod = input.int(10, "ATR Length", minval = 1)
factor = input.float(3.0, "Factor", minval = 0.01, step = 0.01)
= ta.supertrend(factor, atrPeriod)
supertrend := barstate.isfirst ? na : supertrend
bodyMiddle = plot(barstate.isfirst ? na : (open + close) / 2, display = display.none)
upTrend = plot(direction < 0 ? supertrend : na, "Up Trend", color = color.green, style = plot.style_linebr)
downTrend = plot(direction < 0 ? na : supertrend, "Down Trend", color = color.red, style = plot.style_linebr)
fill(bodyMiddle, upTrend, color.new(color.green, 90), fillgaps = false)
fill(bodyMiddle, downTrend, color.new(color.red, 90), fillgaps = false)
buy = ta.crossunder(direction, 0)
sell = ta.crossunder(direction, 0)
//////// CONNECTOR SECTION ////////
Signal = buy ? 1 : sell ? -1 : 0
plot(Signal, title = "Signal", display = display.data_window)
//////// CONNECTOR SECTION ////////
Important Notes
🔥 The Strategy Template expects the value to be exactly 1 for the bullish signal and -1 for the bearish signal
Now, you can connect your indicator to the Strategy Template using the method below or that one.
Step 2: Connect the connector
1) Add your updated indicator to a TradingView chart
2) Add the Strategy Template as well to the SAME chart
3) Open the Strategy Template settings, and in the Data Source field, select your 🔌Connector🔌 (which comes from your indicator)
Note it doesn’t have to be named 🔌Connector🔌 - you can name it as you want - however, I recommend an explicit name you can easily remember.
From then, you should start seeing the signals and plenty of other stuff on your chart.
🔥 Note that whenever you update your indicator values, the strategy statistics and visuals on your chart will update in real-time
II) Customizable Risk Management
- Choose between percentage or USD modes for maximum drawdown.
- Set max consecutive losing days and max losing streak length.
- I used the code from my friend @JosKodify for the maximum losing streak. :)
Will halt the EA and backtest orders fill whenever either of the safeguards above are “broken”
III) Intraday Risk Management
- Limit the maximum intraday losses both in percentage or USD.
- Option to set a maximum number of intraday trades.
- If your EA gets halted on an intraday chart, auto-restart it the next day.
IV) Spread and Account Filters
- Trade only if the spread is below a certain pip value.
- Set requirements based on account balance or equity.
V) Order Types and Position Sizing
- Choose between market, limit, or stop orders.
- Set your position size directly in the template.
Please use the position size from the “Inputs” and not the “Properties” tab.
Reason : The template sends the order on the same candle as the entry signals - at those entry signals candles, the position size isn’t computed yet, and the template can’t then send it to Pineconnector.
However, you can use the position size type (USD, contracts, %) from the “Properties” tab for backtesting.
In the EA, you can define the position size type for your orders in USD or lots or %.
VI) Advanced Take-Profit and Stop-Loss Options
- Choose to set your SL/TP in either pips or percentages.
- Option for multiple take-profit levels and trailing stop losses.
- Move your stop loss to break even +/- offset in pips for “risk-free” trades.
VII) Logger
The Pineconnector commands are logged in the TradingView logger.
You'll find more information about it in this TradingView blog post .
WHY YOU MIGHT NEED THIS TEMPLATE
1) Transform your indicator into a Pineconnector trading bot more easily than before
Connect your indicator to the template
Create your alerts
Set your EA settings
2) Save Time
Auto-generated alert messages for Pineconnector.
I tested them all, and I checked with the support team what could/can’t be done
3) Be in Control
Manage your trading risks with advanced features.
4) Customizable
Fits various trading styles and asset classes.
REQUIREMENTS
* Make sure you have your Pineconnector license ID.
* Create your alerts with the Pineconnector webhook URL
* If there is any issue with the template, ask me in the comments section - I’ll answer quickly.
BACKTEST RESULTS FROM THIS POST
1) I connected this strategy template to a dummy Supertrend script.
I could have selected any other indicator or concept for this script post.
I wanted to share an example of how you can quickly upgrade your strategy, making it compatible with Pineconnector.
2) The backtest results aren't relevant for this educational script publication.
I used realistic backtesting data but didn't look too much into optimizing the results, as this isn't the point of why I'm publishing this script.
This strategy is a template to be connected to any indicator - the sky is the limit. :)
3) This template is made to take 1 trade per direction at any given time.
Pyramiding is set to 1 on TradingView.
The strategy default settings are:
* Initial Capital: 100000 USD
* Position Size: 1 contract
* Commission Percent: 0.075%
* Slippage: 1 tick
* No margin/leverage used
WHAT’S COMING NEXT FOR YOU GUYS?
I’ll make the same template for ProfitView, then for AutoView, and then for Alertatron.
All of those are free and open-source.
I have no affiliations with any of those companies - I'm publishing those templates as they will be useful to many of you.
Dave
Double AI Super Trend Trading - Strategy [PresentTrading]█ Introduction and How It is Different
The Double AI Super Trend Trading Strategy is a cutting-edge approach that leverages the power of not one, but two AI algorithms, in tandem with the SuperTrend technical indicator. The strategy aims to provide traders with enhanced precision in market entry and exit points. It is designed to adapt to market conditions dynamically, offering the flexibility to trade in both bullish and bearish markets.
*The KNN part is mainly referred from @Zeiierman.
BTCUSD 8hr performance
ETHUSD 8hr performance
█ Strategy, How It Works: Detailed Explanation
1. SuperTrend Calculation
The SuperTrend is a popular indicator that captures market trends through a combination of the Volume-Weighted Moving Average (VWMA) and the Average True Range (ATR). This strategy utilizes two sets of SuperTrend calculations with varying lengths and factors to capture both short-term and long-term market trends.
2. KNN Algorithm
The strategy employs k-Nearest Neighbors (KNN) algorithms, which are supervised machine learning models. Two sets of KNN algorithms are used, each focused on different lengths of historical data and number of neighbors. The KNN algorithms classify the current SuperTrend data point as bullish or bearish based on the weighted sum of the labels of the k closest historical data points.
3. Signal Generation
Based on the KNN classifications and the SuperTrend indicator, the strategy generates signals for the start of a new trend and the continuation of an existing trend.
4. Trading Logic
The strategy uses these signals to enter long or short positions. It also incorporates dynamic trailing stops for exit conditions.
Local picture
█ Trade Direction
The strategy allows traders to specify their trading direction: long, short, or both. This enables the strategy to be versatile and adapt to various market conditions.
█ Usage
ToolTips: Comprehensive tooltips are provided for each parameter to guide the user through the customization process.
Inputs: Traders can customize numerous parameters including the number of neighbors in KNN, ATR multiplier, and types of moving averages.
Plotting: The strategy also provides visual cues on the chart to indicate bullish or bearish trends.
Order Execution: Based on the generated signals, the strategy will execute buy or sell orders automatically.
█ Default Settings
The default settings are configured to offer a balanced approach suitable for most scenarios:
Initial Capital: $10,000
Default Quantity Type: 10% of equity
Commission: 0.1%
Slippage: 1
Currency: USD
These settings can be modified to suit various trading styles and asset classes.
Keltner Channel Strategy with Golden CrossOnly trade with the trend.
This Keltner Channel-based strategy that will only enter into a trade if the signal of the Keltner Channel agrees with a moving average crossover as defined by the user.
Long Position Entries
2 Conditions must be present
1. There must be a Golden Cross (lower period moving average is above higher period moving average). ex 50 period MA > 200 period MA.
2. Price must cross above the Keltner Channel ATR defined by the user.
Short Position Entries
2 Conditions must be present
1. There must be a Death Cross (lower period moving average is below higher period moving average). ex 50 period MA < 200 period MA.
2. Price must cross below the Keltner Channel ATR defined by the user
Closing Trades:
The strategy closes trades as follows:
1. Price crossing the Keltner Channel's Take Profit ATR (defined by User)
2. Price crossing the Keltner Channel's Stop Loss ATR (defined by User)