Trend FollowingMoving Average Period:** This is the period of the moving average that will be used to identify the trend. A good starting point is 10 days.
* **Candlestick Patterns:** The candlestick patterns that will be used to identify potential reversals in the trend. Some of the most common candlestick patterns include the bullish engulfing pattern, the bearish engulfing pattern, the hammer pattern, and the inverted hammer pattern.
* **Support and Resistance Levels:** The support and resistance levels that will be used to manage risk. These levels can be identified using a variety of technical indicators, such as the moving average, the Bollinger bands, and the Fibonacci retracement levels.
Here is how the strategy will work:
1. The moving average will be used to identify the trend. When the price is above the moving average, it is considered to be in an uptrend. When the price is below the moving average, it is considered to be in a downtrend.
2. Candlestick patterns will be used to identify potential reversals in the trend. If a bullish candlestick pattern appears in an uptrend, it could be a sign that the trend is about to continue. If a bearish candlestick pattern appears in a downtrend, it could be a sign that the trend is about to reverse.
Educational
Default Strategy Template© CN_FX-999
Coded By Christian Nataliano
First Coded In 14/06/2023
Last Edited In 22/06/2023
This Is A Default Strategy Template That Can Make Your Strategy Scripts More Organized With The Benefit Of Having The Same Layouts & Not Needing To Copy Over The Common Codes Such As Displaying Backtest Results, Opening & Closing Trades, Pine Connector Capabilities And A Clean User Input Interface. This Is A Blank Strategy Script So Feel Free To Use It As Your Default Template For Your Future Strategies.
Credits To Some Of The Custom Code In The Scripts To © ZenAndTheArtOfTrading, Especially The Table Data Plotting
Heikin Ashi ROC Percentile Strategy**User Guide for the "Heikin Ashi ROC Percentile Strategy"**
This strategy, "Heikin Ashi ROC Percentile Strategy", is designed to provide an easy-to-use framework for trading based on the Heikin Ashi Rate of Change (ROC) and its percentiles.
Here's how you can use it:
1. **Setting the Start Date**: You can set the start date for the strategy in the user inputs at the top of the script. The variable `startDate` defines the point from which the script begins executing trades. Simply input the desired date in the format "YYYY MM DD". For example, to start the strategy from March 3, 2023, you would enter `startDate = timestamp("2023 03 03")`.
2. **Adjusting the Midline, Lookback Period, and Stop Loss Level**: The `zerohLine`, `rocLength`, and `stopLossLevel` inputs allow you to adjust the baseline for ROC, the lookback period for the SMA and ROC, and the level at which the strategy stops the loss, respectively. By tweaking these parameters, you can fine-tune the strategy to better suit your trading style or the particular characteristics of the asset you are trading.
3. **Understanding the Trade Conditions**: The script defines conditions for entering and exiting long and short positions based on crossovers and crossunders of the ROC and the upper and lower "kill lines". These lines are defined as certain percentiles of the ROC's highest and lowest values over a specified lookback period. When the ROC crosses above the lower kill line, the script enters a long position; when it crosses below the upper kill line, it exits the position. Similarly, when the ROC crosses below the upper kill line, the script enters a short position; when it crosses above the lower kill line, it exits the position.
In my testing, this strategy performed best on a day and hour basis. However, I encourage you to experiment with different timeframes and settings to see how the strategy performs under various conditions. Remember, there's no one-size-fits-all approach to trading; what works best will depend on your specific circumstances, goals, and risk tolerance.
If you find other useful applications for this strategy, please let me know in the comments. Your feedback is invaluable in helping to refine and improve this tool. Happy trading!
The Z-score The Z-score, also known as the standard score, is a statistical measurement that describes a value's relationship to the mean of a group of values. It's measured in terms of standard deviations from the mean. If a Z-score is 0, it indicates that the data point's score is identical to the mean score. Z-scores may be positive or negative, with a positive value indicating the score is above the mean and a negative score indicating it is below the mean.
The concept of Z-score was introduced by statistician Carl Friedrich Gauss as part of his "method of the least squares," which was an important step in the development of the normal distribution and Z-score tables. It's a key concept in statistics and is used in various statistical tests.
In financial analysis, Z-scores are used to determine whether a data point is usual or unusual. You can think of it as a measure of how many standard deviations an element is from the mean. For instance, a Z-score of 1.0 would denote a value that is one standard deviation from the mean. Z-scores are also used to predict probabilities, with Z-scores having a distribution that is expected to be normal.
In trading, a Z-score is used to determine how often a trading system may produce a string of winners or losers. It can help a trader to understand whether the losses or profits they see are something that the system would most likely produce, or if it's a once in a blue moon situation. This helps traders make decisions about when to start or stop a system.
I just wanted to play a bit with the Z-score I guess.
Feel free to share your findings if you discover additional applications for this strategy or identify timeframes where it appears to perform more optimally.
How it works:
This strategy is based on a statistical concept called Z-score, which measures the number of standard deviations a data point is from the mean. In other words, it helps determine how unusual or usual a data point is.
In the context of this strategy, Z-score is applied to a 10-period EMA (Exponential Moving Average) of Heikin-Ashi candlestick close prices. The Z-score is calculated over a look-back period of 25 bars.
The EMA of the Z-score is then calculated over a 20-bar period, and the upper and lower thresholds (bounds for buy and sell signals) are defined using the 90th and 10th percentiles of this EMA score.
Long positions are taken when the Z-score crosses above the lower threshold or crosses above the mid-line (50th percentile). An additional long entry is made when the Z-score crosses above the highest value the EMA has been in the past 100 periods.
Short positions are initiated when the EMA crosses below the upper threshold, lower threshold or the highest value the EMA has been in the past 100 periods.
Positions are closed when opposing entry conditions are met, for example, a long position is closed when the short entry condition is true, and vice versa.
Set your desired start date for the strategy. This can be modified in the timestamp("YYYY MM DD") function at the top of the script.
D-BoT Alpha 'Short' SMA and RSI StrategyDostlar selamlar,
İşte son derece basit ama etkili ve hızlı, HTF de çok iyi sonuçlar veren bir strateji daha, hepinize bol kazançlar dilerim ...
Nedir, Nasıl Çalışır:
Strateji, iki ana girdiye dayanır: SMA ve RSI. SMA hesaplama aralığı 200 olarak, RSI ise 14 olarak ayarlanmıştır. Bu değerler, kullanıcı tercihlerine veya geriye dönük test sonuçlarına göre ayarlanabilir.
Strateji, iki koşul karşılandığında bir short sinyali oluşturur: RSI değeri, belirlenen bir giriş seviyesini (burada 51 olarak belirlenmiş) aşar ve kapanış fiyatı SMA değerinin altındadır.
Strateji, kısa pozisyonu üç durumda kapatır: Kapanış fiyatı, takip eden durdurma seviyesinden (pozisyon açıldığından beri en düşük kapanış olarak belirlenmiştir) büyükse, RSI değeri belirlenen bir durdurma seviyesini (bu durumda 54) aşarsa veya RSI değeri belirli bir kar al seviyesinin (bu durumda 32) altına düşerse.
Güçlü Yönleri:
İki farklı gösterge (SMA ve RSI) kullanımı, yalnızca birini kullanmaktan daha sağlam bir sinyal sağlayabilir.
Strateji, karları korumaya ve fiyat dalgalanmalarında kayıpları sınırlamaya yardımcı olabilecek bir iz süren durdurma seviyesi içerir.
Script oldukça anlaşılır ve değiştirmesi nispeten kolaydır.
Zayıf Yönleri:
Strateji, hacim, oynaklık veya daha geniş piyasa eğilimleri gibi diğer potansiyel önemli faktörleri göz önünde bulundurmaz.
RSI seviyeleri ve SMA süresi için belirli parametreler sabittir ve tüm piyasa koşulları veya zaman aralıkları için optimal olmayabilir.
Strateji oldukça basittir. Trade maliyetini (kayma veya komisyonlar gibi) hesaba katmaz, bu da trade performansını önemli ölçüde etkileyebilir.
Bu Stratejiyle Nasıl İşlem Yapılır:
Strateji, short işlemler için tasarlanmıştır. RSI, 51'in üzerine çıktığında ve kapanış fiyatı 200 periyotluk SMA'nın altında olduğunda işleme girer. RSI, 54'ün üzerine çıktığında veya 32'nin altına düştüğünde veya fiyat, pozisyon açıldığından beri en düşük kapanış fiyatının üzerine çıktığında işlemi kapatır.
Lütfen Dikkat, bu strateji veya herhangi bir strateji izole bir şekilde kullanılmamalıdır. Tüm bu çalışmalar eğitsel amaçlıdır. Yatırım tavsiyesi içermez.
This script defines a trading strategy based on Simple Moving Average (SMA) and the Relative Strength Index (RSI) indicators. Here's an overview of how it works, along with its strengths and weaknesses, and how to trade using this strategy:
How it works:
The strategy involves two key inputs: SMA and RSI. The SMA length is set to 200, and the RSI length is set to 14. These values can be adjusted based on user preferences or back-testing results.
The strategy generates a short signal when two conditions are met: The RSI value crosses over a defined entry level (set at 51 here), and the closing price is below the SMA value.
When a short signal is generated, the strategy opens a short position.
The strategy closes the short position under three conditions: If the close price is greater than the trailing stop (which is set as the lowest close since the position opened), if the RSI value exceeds a defined stop level (54 in this case), or if the RSI value drops below a certain take-profit level (32 in this case).
Strengths:
The use of two different indicators (SMA and RSI) can provide a more robust signal than using just one.
The strategy includes a trailing stop, which can help to protect profits and limit losses as the price fluctuates.
The script is straightforward and relatively easy to understand and modify.
Weaknesses:
The strategy doesn't consider other potentially important factors, such as volume, volatility, or broader market trends.
The specific parameters for the RSI levels and SMA length are hard-coded, and may not be optimal for all market conditions or timeframes.
The strategy is very simplistic. It doesn't take into account the cost of trading (like slippage or commissions), which can significantly impact trading performance.
How to trade with this strategy:
The strategy is designed for short trades. It enters a trade when the RSI crosses above 51 and the closing price is below the 200-period SMA. It will exit the trade when the RSI goes above 54 or falls below 32, or when the price rises above the lowest closing price since the position was opened.
Please note, this strategy or any strategy should not be used in isolation. It's important to consider other aspects of trading such as risk management, capital allocation, and combining different strategies to diversify. Back-testing the strategy on historical data and demo trading before going live is also a recommended practice.
D-Bot Alpha RSI Breakout StrategyHello dear Traders,
Here is a simple yet effective strategy to use, for best profit higher time frame, such as daily.
Structure of the code
The code defines inputs for SMA (simple moving average) length, RSI (relative strength index) length, RSI entry level, RSI stop loss level, and RSI take profit level. The default values of these variables can be customized as per the user's preferences.
The script calculates SMA and RSI based on the input parameters and the closing price of the asset.
Trading logic
This strategy allows the placement of a long position when:
The RSI crosses above the RSI entry level and
The close price is above the SMA value.
After entering a long position, it applies a trailing stop mechanism. The stop price is updated to the close price if the close price is lower than the last close price.
The script closes the long position when:
RSI falls below the stop loss level.
RSI reaches or exceeds the take profit level.
If the trailing stop is activated (once RSI reaches or exceeds the take profit level), the closing price falls below the trailing stop level.
Strengths
The strategy includes mechanisms for entering a position, taking profit, and stopping losses, which are fundamental aspects of a trading strategy.
It applies a trailing stop mechanism that allows to capture further gains if the price keeps increasing while protecting from losses if the price starts to decrease.
Weaknesses
This strategy only contemplates long positions. Depending on the market situation, the strategy may miss opportunities for short selling when the market is on a downward trend.
The choice of the fixed RSI entry, stop loss, and take profit levels may not be ideal for all market conditions or assets. It might benefit from a more adaptive mechanism that adjusts these levels according to market volatility or trend.
The strategy doesn't factor in trading costs (such as spread or commission), which could have a significant impact on the net profit, especially if the user is trading with a high frequency or in a low liquidity market.
How to trade with this strategy
Given these parameters and the strategy outlined by the code, the trader would enter a long position when the RSI crosses above the RSI entry level (default 34) and the closing price is above the SMA value (SMA calculated with default period of 200). The trader would exit the position when either the RSI falls below the RSI stop loss level (default 30), or RSI rises above the RSI take profit level (default 50), or when the trailing stop is hit.
Remember "The strategies I have prepared are entirely for educational purposes and should not be considered as investment advice. Support your trades using other tools. Wishing everyone profitable trades..."
Mechanical Trading StrategyThe "Mechanical Trading Strategy" is a simple and systematic approach to trading that aims to capture short-term price movements in the financial markets. This strategy focuses on executing trades based on specific conditions and predetermined profit targets and stop loss levels.
Key Features:
Profit Target: The strategy allows you to set a profit target as a percentage of the entry price. This target represents the desired level of profit for each trade.
Stop Loss: The strategy incorporates a stop loss level as a percentage of the entry price. This level represents the maximum acceptable loss for each trade, helping to manage risk.
Entry Condition: The strategy triggers trades at a specific time. In this case, the condition for entering a trade is based on the hour of the candle being 16 (4:00 PM). This time-based entry condition provides a systematic approach to executing trades.
Position Sizing: The strategy determines the position size based on a fixed percentage of the available equity. This approach ensures consistent risk management and allows for potential portfolio diversification.
Execution:
When the entry condition is met, signified by the hour being 16, the strategy initiates a long position using the strategy.entry function. It sets the exit conditions using the strategy.exit function, with a limit order for the take profit level and a stop order for the stop loss level.
Take Profit and Stop Loss:
The take profit level is calculated by adding a percentage of the entry price to the entry price itself. This represents the profit target for the trade. Conversely, the stop loss level is calculated by subtracting a percentage of the entry price from the entry price. This level represents the maximum acceptable loss for the trade.
By using this mechanical trading strategy, traders can establish a disciplined and systematic approach to their trading decisions. The predefined profit target and stop loss levels provide clear exit rules, helping to manage risk and potentially maximize returns. However, it is important to note that no trading strategy is guaranteed to be profitable, and careful analysis and monitoring of market conditions are always recommended.
Monthly Strategy Performance TableWhat Is This?
This script code adds a Monthly Strategy Performance Table to your Pine Script strategy scripts so you can see a month-by-month and year-by-year breakdown of your P&L as a percentage of your account balance.
The table is based on realized equity rather than open equity, so it only updates the metrics when a trade is closed.
That's why some numbers will not match the Strategy Tester metrics (such as max drawdown), as the Strategy Tester bases metrics like max drawdown on open trade equity and not realized equity (closed trades).
The script is still a work-in-progress, so make sure to read the disclaimer below. But I think it's ready to release the code for others to play around with.
How To Use It
The script code includes one of my strategies as an example strategy. You need to replace my strategy code with your own. To do that just copy the source code below into a blank script, delete lines 11 -> 60 and paste your strategy code in there instead of mine. The script should work with most systems, but make sure to read the disclaimer below.
It works best with a significant amount of historical data, so it may not work very effectively on intraday timeframes as there is a severe limitation of available bars on TradingView. I recommend using it on 4HR timeframes and above, as anything less will produce very little usable data. Having a premium TradingView plan will also help boost the number of available bars.
You can hover your mouse over a table cell to get more information in the form of tooltips (such as the Long and Short win rate if you hover over your total return cell).
Credit
The code in this script is based on open-source code originally written by QuantNomad, I've made significant changes and additions to the original script but all credit for the idea and especially the display table code goes to them - I just built on top of it:
Why Did I Make This?
None of this is trading or investment advice, just my personal opinion based on my experience as a trader and systems developer these past 6+ years:
The TradingView Strategy Tester is severely limited in some important ways. And unless you use complex Excel formulas on exported test data, you can't see a granular perspective of your system's historical performance.
There is much more to creating profitable and tradeable systems than developing a strategy with a good win rate and a good return with a reasonable drawdown.
Some additional questions we need to ask ourselves are:
What did the system's worst drawdown look like?
How long did it last?
How often do drawdowns occur, and how quickly are they typically recovered?
How often do we have a break-even or losing month or year?
What is our expected compounded annual growth rate, and how does that growth rate compare to our max drawdown?
And many more questions that are too long to list and take a lifetime of trading experience to answer.
Without answering these kinds of questions, we run the risk of developing systems that look good on paper, but when it comes to live trading, we are uncomfortable or incapable of enduring the system's granular characteristics.
This Monthly Performance Table script code is intended to help bridge some of that gap with the Strategy Tester's limited default performance data.
Disclaimer
I've done my best to ensure the numbers this code outputs are accurate, and according to my testing with my personal strategy scripts it appears to work fine. But there is always a good chance I've missed something, or that this code will not work with your particular system.
The majority of my TradingView systems are extremely simple single-target systems that operate on a closed-candle basis to minimize many of the data reliability issues with the Strategy Tester, so I was unable to do much testing with multiple targets and pyramiding etc.
I've included a Debug option in the script that will display important data and information on a label each time a trade is closed. I recommend using the Debug option to confirm that the numbers you see in the table are accurate and match what your strategy is actually doing.
Always do your own due diligence, verify all claims as best you can, and never take anyone's word for anything.
Take care, and best of luck with your trading :)
Kind regards,
Matt.
PS. If you're interested in learning how this script works, I have a free hour-long video lesson breaking down the source code - just check out the links below this script or in my profile.
Break even stop loss (% of instrument price)Simply proof of concept to place a stop loss a percentage below entry price and move it to break even if the price moves the same percentage above the entre price.
FRAMA & CPMA Strategy [CSM]The script is an advanced technical analysis tool specifically designed for trading in financial markets, with a particular focus on the BankNifty market. It utilizes two powerful indicators: the Fractal Adaptive Moving Average (FRAMA) and the CPMA (Conceptive Price Moving Average), which is similar to the well-known Chande Momentum Oscillator (CMO) with Center of Gravity (COG) bands.
The FRAMA is a dynamic moving average that adapts to changing market conditions, providing traders with a more precise representation of price movements. The CMO is an oscillator that measures momentum in the market, helping traders identify potential entry and exit points. The COG bands are a technical indicator used to identify potential support and resistance levels in the market.
Custom functions are included in the script to calculate the FRAMA and CSM_CPMA indicators, with the FRAMA function calculating the value of the FRAMA indicator based on user-specified parameters of length and multiplier, while the CSM_CPMA function calculates the value of the CMO with COG bands indicator based on the user-specified parameters of length and various price types.
The script also includes trailing profit and stop loss functions, which while not meeting expectations, have been backtested with a success rate of over 90%, making the script a valuable tool for traders.
Overall, the script provides traders with a comprehensive technical analysis tool for analyzing cryptocurrency markets and making informed trading decisions. Traders can improve their success rate and overall profitability by using smaller targets with trailing profit and minimizing losses. Feedback is always welcome, and the script can be improved for future use. Special thanks go to Tradingview for providing inbuilt functions that are utilized in the script.
Risk Reward Calculator [lovealgotrading]
OVERVIEW:
This Risk Reward Calculator strategy can help you maximize your RR value with help of algorithmic trading.
INDICATOR:
I wanted to setup my trades more easier with this indicator, I didn't want to calculate everytime before orders, with help this indicator we can calculate R:R value, avarage price, stoploss price, take-profit price, order prices, all position cost and more ...
Our strategy is a risk revard calculation indicator that is made easy to use by using visualized lines and panels, and also has algorithmic trading support.
With the help of this indicator, we can quickly and easily calculate our risk reward values and enter the positions.
If we want to ensure that our balance grows regularly while trading in the stock market, we need to manage the risks and rewards otherwise we may fall below our initial balance at the end of the day, even if we seem to be winning.
What is the Risk-Reward value ?
This value is a value that shows how many times the amount of risk we take when entering the position is successful, we will earn.
- For example, you risked $100 while entering the trade, so if your trade stops, you will lose 100 $.
Your Risk-Reward(RR) value is 2 means that if your position is successful, you will have 200 $ in your pocket.
A trader's success is determined by the amount of R he earns monthly or yearly, not how much money he makes.
What is different in this indicator ?
I want to say thank you to © EvoCrypto. His Calculator (weighted) – evo indicator helped me when I was developed my indicator.
I want to explain what I have improved:
1-In this strategy, we can determine the time period in which we want to open our positions.
2-We can open a maximum of 4 positions in the same direction and close our positions at a single level. StopLoss or TakeProfit
3-This indicator, which works in the form of a strategy, shows where our positions have been opened or closed. With the help of this, it helps us to determine our strategy in our future positions more accurately.
4-The most important improvement is that we do not miss our positions with the help of alarms (WEB HOOK). if we want, we receive by quickly connecting all these positions to our robot, the software can enter and exit the position while we are busy.
IMPLEMENTATION DETAILS – SETTINGS:
1 - We can set the start and end dates of the positions we will take.
2- We can set our take profit, stoploss levels.
3- If your trade is stopped, we can determine the amount of the trade that we will lose.
4- We can adjust our entry levels to positions and our position sizes at entry levels.
(Sum of positions weight must be 100%)
5- We can receive our positions even if we are busy with the help of algorithmic trading. For this, we must paste our Jshon codes into the fields specified in the settings panel.
6- Finally, we can change the settings we want and don't want to have in our visual elements.
Let's make a LONG side example together
We have determined our positions to enter stoploss, take profit and long positions. We did not forget to set the start time of our strategy
Our strategy appear on the graph as follows.
Our strategy has calculated the total position size, our R-R value, the distance of the current price to the stop and take profit levels, in short, a lot of things we could look visually.
Notes:
If you're going to connect this bot to an automatic Long or Short direction,
Don’t forget! you need to Webhook URL,
Don’t miss paste this code to your message window {{strategy.order.alert_message}}
ALSO:
If you have any ideas what to add to my work to add more sources or make calculations cooler, feel free to write me.
Dynamic Stop Loss DemoWhat does this script do ?
This script is for pine script programmers and explains how to implement a dynamic stop-loss strategy. It is different from trailing stop-loss. Trailing stop-loss can only set the retracement value, but this script can take profit on part of the position at a fixed price and allows users to decide whether to take profit on all positions based on whether a certain track is breached or other conditions author want. In this demo, it use rsi crossover and crossunder to decide the strategy condition, and use close price as open price, and use lowest low / highest high as stop price, and use 1.5 risk ratio to calculate the fixed first profit price. It will take 50% position size when the first profit price was reached. Then it will close all rest positions when the inverse condition come out or the dynamic stop(calculated by ATR) breached or when the price back to the open price or the stop price.
How is this script implemented
When start strategy by strategy.entry , it gives a custom id which contains direction, openPrice, stopPrice, profitPrice, qty, etc. It can be get from the global variable strategy.posiition_entry_name .
Strategy DesignerHello traders.
Thanks to the tool I have published, everyone who knows or does not know coding will be able to create strategies and see the results instantly on the screen. Yes it looks very nice :)
What does this script do?
Thanks to this tool, even if you don't know any coding, you will be able to create your own strategies. You can add and remove indicators.
Entrance
The first thing you need to do is to set a strategy in your mind.
Then you need to adjust the settings of the indicators installed in the system. Please set the indicators first, because later they are forgotten.
The screen for entering the parameters of the indicators will be as follows.
After entering the parameters there is an important part . In this section, we can adjust the strategy settings.
First we choose between which dates we want the strategy to run. We then choose whether we want the strategy results to be displayed in a table or not.
We choose how the Terms should be linked together. For example, if you have a condition that is expected to produce more than one receive signal, select whether these conditions are connected to each other with and or with the connector.
In this way, you can determine whether all or any of the rules in your strategy should apply.
Next, we choose whether our strategy will work in the spot market or in a bidirectional market. Yes, you can design a strategy for both spot and bidirectional trades :)
At the bottom of the above image, we see a screen where we can adjust the stop level and tp level. As a standard, adjustments are made according to the percentage level you enter. However, if you remove the tick next to the percent sign, the previous stop level and the next profit level are determined as much as the value you entered.
At the bottom is the trailing stop. When you open the trailing stop, the trailing stop becomes active in your strategy.
Very important, when the trailing stop and the stop are active at the same time, the trailing stop value is valid.
It's time to design our strategy. Each chapter that begins with an exclamation point is a separate fiction.
If you do not mark the Active button, that condition will not be included in the calculation.
Direction = It is the direction for which the fiction in this region is valid.
We came to the indicator setting screen. Here, there is a screen where we can select two different indicators on the right and left.
We choose the first indicator starting with 1.
Then we choose from the middle region how we want these two indicators to interact.
We choose our second indicator from the place starting with 2.
If you want an indicator to interact with any value, tick the box where it says Value and fill in the value in the blank. When Value is ticked, the second indicator does not work.
Educational Strategy : TRIPLE DRAG-ON SYSTEM V.1The Triple Dragon System is a technical trading strategy that uses a combination of three different indicators to identify potential buy and sell signals in the market. The three indicators used in this strategy are the Extended Price Volume Trend (EPVT), the Donchian Channels, and the Parabolic SAR. Each of these indicators provides different types of information about the market, and by combining them, we can create a more comprehensive trading system.
The EPVT is used to identify potential trend changes and measure the strength of a trend. The Donchian Channels are used to identify the direction of the trend, while the Parabolic SAR is used to provide additional confirmation of trend changes and help determine potential entry and exit points.
In this strategy, we first use the EPVT and Donchian Channels to identify the direction of the trend. When the EPVT is above its baseline and the price is above the upper Donchian Channel, it suggests an uptrend. Conversely, when the EPVT is below its baseline and the price is below the lower Donchian Channel, it suggests a downtrend.
Once we have identified the trend direction, we use the Parabolic SAR to help determine potential entry and exit points. When the Parabolic SAR is below the price and flips to above the price, it suggests a potential buy signal. Conversely, when the Parabolic SAR is above the price and flips to below the price, it suggests a potential sell signal.
To further refine our trading signals, we use multiple timeframes to confirm the trend direction and ensure that we are not entering the market during a period of high volatility. We also use multiple take-profit levels to lock in profits and manage risk.
Overall, the Triple Dragon System is a comprehensive technical trading strategy that combines multiple indicators to provide clear entry and exit signals. By using a combination of trend-following and momentum indicators, we can identify potential trading opportunities while minimizing risk. Please note that this strategy is for educational purposes only and should not be taken as financial advice.
Strategy Template + Performance & Returns table + ExtrasA script I've been working on since summer 2022. A template for any strategy so you just have to write or paste the code and go straight into risk management settings
Features:
>Signal only Longs/only Shorts/Both
>Leverage system
>Proper fees calculation (even with leverage on)
>Different Stop Loss systems: Simple percentage, 4 different "move to Break Even" systems and Scaling SL after each TP order (read the disclaimer at the bottom regarding this and the TV % profitable metric)
>2 Take Profit systems: Simple percentages, or Risk/reward ratios based on SL level
>Additional option on TP so last one "rides free" until closure of position or Stoploss is hit (for more than 1 orders)
>Up to 5 TP orders
>Show or hide SL/TP levels on demand
>2 date filters. Manual filter is nothing new, enter two dates/hours and filter will turn on. BUT automatic filter is another thing (thanks to user @bfr_ for his help in codingthis feature)
>AUTOMATIC DATE FILTER. Allows you to split all historical data on the chart in X periods, then choose the range of periods used. Up to 10 but that can be changed, instructions included. Useful for WalkForward simulations, haven't seen a script in TradingView that allows you to do this and test your strategy on "unseen data" automatically
EXTRA SETTINGS
Besides, some additions I like to add to my codes:
>Returns table for monthly and weekly performance. Requires recalculation on every tick. This is a modified version of @QuantNomad's work. May add lower TF options later on
>Volume Based S/R system. Original work from @shtcoinr
>One feature that was made by me, the "portfolio table". Yields info and metrics of your strategy, current position and balance. You're able to turn it off and change its size
Should anyone find an error, or have any idea on how to improve this code, please contact me. Future updates could come, stay tuned
DISCLAIMER:
In order to have accurate StopLoss hit, I had to change the previous system, which was a "close position on candle close" instead at actual stoploss level. It was fixed, but resulted on inflation of the number of trading orders, thus reducing the percent profitable and making it strongly biased and unreal. Keep that in mind, that "real" profitability could be 2x or 3x the metric TradingView says. If your strategy has a really high trading frequency, resulting in 3000+ orders, might be a problem. Try to make use of the automatic/manual date filter as workaround, I have no means of changing this, seems it is not a bug but an intended design of the PineScript Code
Kitchen [ilovealgotrading]
OVERVIEW:
Kitchen is a strategy that aims to trade in the direction of the trend by using supertrend and stochRsi data by calculating at different time values.
IMPLEMENTATION DETAILS – SETTINGS:
First of all, let's understand the supertrend and stocrsi indicators.
How do you read and use Super Trend for trading ?
The price is often going upwards when it breaks the super trend line while keeping its position above the indication level.
When the market is in a bullish trend, the indicator becomes green. The indicator level will act as trendline support in such a scenario. The color of the indicator changes to red to indicate a negative trend once the price crosses the support line. The price uses the super trend level as a trendline resistance during a bearish move.
In our strategy, if our 1-hour and 4-hour supertrend lines show the up or down train in the same direction at the same time, we can assume that a train is forming here.
Why do I use the time of 1 hour and 4 hours ?
When I did a backtest from the past to the present, I discovered that the most accurate and consistent time zones are the 1 hour and 4 hour time zones.
By the way we can change our short term timeframe(1H) and long term timeframe(4H) from settings panel.
How do you read and use the Stoch-RSI Indicator?
This indicator analyzes price dynamics automatically to detect overbought and oversold locations.
The indicator includes:
- The primary line, which typically has values between 0 and 100;
- Two dynamic levels for overbought and oversold conditions.
IF our stoch-rsi indicator value has fallen below our lower boundary line, the oversold event has been observed in the price, if our stoch-rsi value breaks up our bottom line after becoming oversold, we think that the price will start the recovery phase.(The case is also true for the opposite.)
However, this does not always apply and we need additional approvals, Therefore, our 1H and 4H supertrrend indicator provides us with additional confirmation.
Buy Condition:
Our 1H(short term) and 4H(long term) supertrrend indicator, has given the buy signal(green line and yellow line), and if our stochrsi indicator has broken our oversold line up on the past 15 bars, the buy signal is formed here.
Sell Condition:
Our 1H(short term) and 4H(long term) supertrrend indicator, has given the sell signal(red line and orange line), and if our stochrsi indicator has broken our overbuy line down on the past 15 bars, the sell signal is formed here.
Stop Loss or Take Profit Conditions:
Exit Long Senerio:
All conditions are completed, the buy signal has arrived and we have entered a LONG trade, the 1-hour supertrend line follows the price rise(yellow line), if the price breaks below the 1-hour super trend line and a sell condition occurs for 1H timeframe for supertrend indcator, LONG trade will exit here.
Exit Short Senerio:
All conditions are completed, the Sell signal has arrived and we have entered a SHORT trade, the 1-hour supertrend line follows the price down(orange line), if the price breaks up the 1-hour super trend line and a buy condition occurs for 1H timeframe for supertrend indcator, SHORT trade will exit here.
What can you change in the settings panel?
1-We can set Start and End date for backtest and future alarms
2-We can set ATR length and Factor for supertrend indicator
3-We can set our short term and long term timeframe value
4-We can set StochRsi Up and Low limit to confirm buy and sell conditions
5-We can set stochrsi retroactive approval length
6-We can set stochrsi values or the length
7-We can set Dollar cost for per position
8- We can choose the direction of our positions, we can set only LONG, only SHORT or both directions.
9-IF you want to place automatic buy and sell orders with this strategy, you can paste your codes into the Long open-close or Short open-close message sections.
For example
IF you write your alert window this code {{strategy.order.alert_message}}.
When trigger Long signal you will get dynamically what you pasted here for Long Open Message
ALSO:
Please do not open trades without properly managing your risk and psychology!!!
If you have any ideas what to add to my work to add more sources or make calculations cooler, suggest in DM .
Donchian Trend V1The Donchian Trend strategy is a trend-following approach that uses the Donchian Channels indicator to identify potential entry and exit points in a security. The Donchian Channels are formed by taking the highest high and the lowest low prices over a specified period and plotting them as upper and lower channels around the current price. The width of the channels indicates the level of volatility in the market.
In this strategy, the Donchian Channels are used as a trend filter to determine the direction of the market. When the price is above the upper channel, it suggests an uptrend, and when the price is below the lower channel, it indicates a downtrend. The length of the Donchian Channels is a key parameter in the strategy, as it determines the look-back period for identifying the high and low prices.
Additional Logic: To further refine the entry and exit signals, The script uses two moving averages, a fast one (MA5) and a slow one (MA45), to identify trends and generate trading signals. When the fast moving average crosses above the slow moving average, a buy signal is generated, indicating that the market is trending upwards. Conversely, when the fast moving average crosses below the slow moving average, a sell signal is generated, indicating that the market is trending downwards.
Evaluation: The script was backtested on historical price data for the pair. The backtest results showed that the script was able to generate a net profit of , with a profit factor of and a Sharpe ratio of . The script also includes metrics such as the number of winning and losing trades, the average trade, and the largest winning and losing trades.
The strategy is evaluated based on its net profit, gross profit, gross loss, max run-up, max drawdown, buy & hold return, Sharpe ratio, Sortino ratio, and profit factor. The parameters used in the backtest include a Donchian Channel length of 42, which corresponds to a weekly time with divide of 4h time frame, and a short-term MA of 5 and a long-term MA of 45 for more accurate entry and exit signals.
Disclaimer: This script is for educational and research purposes only and should not be used for trading with real money without further testing and validation. Past performance is not indicative of future results.
ARCHENS SHARESThis script marks the high and low of 9.45 to 10.15 price. When the price breaks high, then gives Buy signal. When the price breaks low, then it gives Sell Signal. These buy and sell signals are given with labels "ARCHENS BUY" or "ARCHENS SELL". With my observation in stock market, I have made this strategy.
This strategy works in normal candle pattern but i observed that it works well in heikenashi candle. For this strategy to work well, we have to select 5 mins heikenashi candles.
If this strategy gives "ARCHENS buy", then buy it. Target should be as per individuals mind. But Stop loss should be hitted when there are two continue opposite {red} heikenashi candle.
If this strategy gives "ARCHENS sell", then sell it. Target should be as per individuals mind. But Stop loss should be hitted when there are two continue opposite {green} heikenashi candle.
Reinforced RSI - The Quant Science This strategy was designed and written with the goal of showing and motivating the community how to integrate our 'Probabilities' module with their own script.
We have recreated one of the simplest strategies used by many traders. The strategy only trades long and uses the overbought and oversold levels on the RSI indicator.
We added stop losses and take profits to offer more dynamism to the strategy. Then the 'Probabilities' module was integrated to create a probabilistic reinforcement on each trade.
Specifically, each trade is executed, only if the past probabilities of making a profitable trade is greater than or equal to 51%. This greatly increased the performance of the strategy by avoiding possible bad trades.
The backtesting was calculated on the NASDAQ:TSLA , on 15 minutes timeframe.
The strategy works on Tesla using the following parameters:
1. Lenght: 13
2. Oversold: 40
3. Overbought: 70
4. Lookback: 50
5. Take profit: 3%
6. Stop loss: 3%
Time period: January 2021 to date.
Our Probabilities Module, used in the strategy example:
Strategy: Range BreakoutWhat?
In the price action, levels have a significant role to play. Based on the price moving above/below the levels - the underlying instrument shows some price-action in the direction of breakout/breakdown.
There are plenty of ways level can be determined. Levels are the decision point to take a trade or not. But if we make the level derivation complex, then the execution may get hamper.
This strategy script, developed in PineScript v5, is our attempt at solving this problem at the core by providing this simple, yet elegant solution to this problem.
It's essentially an attempt to Trade Simple by drawing logical (horizontal) lines in the chart and take actions, after multiple associated parameters confirmation, on the breakout / breakdown of the levels.
How?
Let us explain how we are drawing the levels.
We are depending on some of the parameters as described below:
Open Range : During intraday movement, often if prices move beyond a particular level, it exibits more movement in the same swing in same direction. We found out, through our back testing for Indian Indices like NSE:NIFTY , NSE:BANKNIFTY or NSE:CNXFINANCE the first 15m (i.e 09:15 AM to 09:30 AM, IST) is one of such range. For Indian stocks, it is 9:15 to 9:45. And for MCX MCX:CRUDEOIL1! it's 5:00 pm to 6:00 pm. There are our first levels.
PDHCL : Previous Day High, Close, Low. This is our next level
VWAP : The rolling VWAP (volume weighted average price)
In the breakout/breakdown of the Open Range and Previous Day High/Low, we are taking the trade decisions as follows using CEST principle:
C onditions :
If current bar's (say you are in 5m timeframe) closing is broken out the Open Range High or Previous Day High, taken a Buy/Long decision (let's say buying a Call Option CE or selling a Put Option PE or buying the future or cash).
If current bar's (say you are in 5m timeframe) closing is broken down the Open Range Low or Previous Day Low, taken a Sell/Short decision (let's say buying a Put Option CE or selling a Call Option PE or selling the future or cash).
Additionally, and optionally (default ON, one can turn off): we are checking various other associated multiple confirmations as follows:
1. Momentum : Checking 14-period RSI value is more than 50 or less than 50 (all parameters like period, OB, OS ranges are configurable through settings)
2. Current bar's volume is more than the last 20 bars volume average. How much more - that multiplier is also configurable. (default is 1)
3. The breakout candle is bullish (green) or bearish (red).
E ntry :
All of these happens only on the closing of the candle . Means: Non Repainting! .
Clearly in the chart we are showing as green up arrow BO (breakout for buy) and red down arrow BD (breakdown for sell) to take your decision process smooth.
So, on the closing of the decision BO/BD candle we are entering the trade (with a thumping heart and nail biting ...)
S top Loss :
We are relying on the time tasted (last 40 years) mechanism of Average True Range (ATR) of default 14 period. This default period is also configurable.
So for Long trades: the 14 period ATR low band is the SL.
For Short trades: the 14 period ATR high band is the SL.
T arget :
We are depending on the thump rule of 1:2 Risk Reward. It's simple and effective. No fancy thing. We are closing the trade on double the favorable price movement compared to the SL placed. Of course, this RR ratio is confiurable from the settings, as usual.
What's Unqiue in it?
The utter simplicity of this trading mechanism. No fancy things like complex chart pattern, OI data, multiple candlestick patterns, Order flow analysis etc.
Simple level determination,
Marking clearly in the chart.
Making each parameter configurable in Settings and showing tooltip adjacent to the parameter to make you understand it better for your customization,
Wait for the candle close, thus eliminating the chances of repainting menace (as much as possible)
Additional momentum and volume check to trade entry confirmation.
Works with normal candlestick (nothing special ones like HA ...)
Showing everything as a Summary Table (which, again can be turned off optionally) overlaying at the bottom-right corner of the chart,
Optionally the Summary Table can be configured to alert you back (say you get it notified in your email or SMS).
That way, a single, simple, effective trade setup will ease your journey as smooth sail as possible.
Mentions
There are plenty of friends from whom time to time we borrowed some of the ideas while working closely together over last one year.
From tradingview community, we took the spirit of @zzzcrypto123 awesome work done long back (in 2020) as the indicator "ORB - Opening Range Breakout". (We tried to reach him for his explicit consent, unable to catch hold of him).
Some other publicly available materials we have consulted to get the additional checks (like RSI, volume).
Lat word
Use it please and thank you for your constant patronage in following us in this awesome platform. Let's keep growing together.
Disclaimer :
This piece of software does not come up with any warrantee or any rights of not changing it over the future course of time.
We are not responsible for any trading/investment decision you are taking out of the outcome of this indicator.
ATR_RSI_Strategy v2 with no repaint [liwei666]🎲 Overview
🎯 this is a optimized version based on ATR_RSI_Strategy with no-repaint.
Sharpe ratio: 1.4, trade times: 116 ,
trade symbol: BINANCE:BTCUSDTPERP 15M
you can get same backtesting result with the correct settings.
🎲 Strategy Logic
🎯 the core logic is quite simple, use ATR and RSI and SMA
1. when price is in high volatility ( atr_value > atr_ma);
2. wait for a break signal (rsi_value > rsi_buy or rsi_value < rsi_sell);
3. entry Long or Short,use trailing stop-loss to max security and percent TP to keep profit.
🎲 Settings
🎯 there are 7 input properties in script, but I only finetune 4 of them ( bold field below ),
you may change other parameter to get better result by yourself.
atr_length: length to get atr value
atr_ma_length : length of smoothing atr value
atr_ma_norm_min : atr_ma normalized min value, filter high volatility ranges
atr_ma_norm_max : atr_ma normalized max value, filter high volatility ranges
rsi_length : length to get rsi value
rsi_entry: 50 +/- rsi_entry to get entry threshold
trailing_percent: trailing stop-loss percent
🎲 Usage
🎯 the commission set to 0.05% , part of exchange the commission is less than 0.05% in reality,
but I will still use 0.05% in my next script.
🎯 this script use 50% of equity to size positions follow general script position,
you can adjust the value to fix size or 100% of equity to compare result with other strategy,
but I still suggest you use 5-10% of equity for each strategy in reality.
🎯any questions please comment below. if there are any words violate House Rule, please tell me below and i will revise immediately
don't want be hiddened again 😂😂
Additionally, I plan to publish 20 profitable strategies in 2023;
let‘s witness it together!
Hope this strategy will be usefull for you :)
enjoy! 🚀🚀🚀
Selected Dates Filter by @zeusbottradingWe are presenting you feature for strategies in Pine Script.
This function/pine script is about NOT opening trades on selected days. Real usage is for bank holidays or volatile days (PPI, CPI, Interest Rates etc.) in United States and United Kingdom from 2020 to 2030 (10 years of dates of bank holidays in mentioned countries above). Strategy is simple - SMA crossover of two lengts 14 and 28 with close source.
In pine script you can see we picked US and GB bank holidays. If you add this into your strategy, your bot will not open trades on those days. You must make it a rule or a condition. We use it as a rule in opening long/short trades.
You can also add some of your prefered dates, here is just example of our idea. If you want to add your preffered days you can find them on any site like forexfactory, myfxbook and so on. But don’t forget to add function “time_tradingday ! = YourChoosedDate” as it is writen lower in the pine script.
Sometimes the date is substituted for a different day, because the day of the holiday is on Saturday or Sunday.
Made with ❤️ for this community.
If you have any questions or suggestions, let us know.
The script is for informational and educational purposes only. Use of the script does not constitutes professional and/or financial advice. You alone the sole responsibility of evaluating the script output and risks associated with the use of the script. In exchange for using the script, you agree not to hold zeusbottrading TradingView user liable for any possible claim for damages arising from any decision you make based on use of the script.
12/26-IT strategyBase of this Strategy is crossover of 12EMA on 26EMA.
Also multiple other criteria has to meet for buy signal, Criterias mentioned below
//////////////////////////////////
There two entry option to select. Either one or both can be selected:
1. Only 12/26 Cross over
a. 12/26 crossover.
b. RSI (14) value to be between a range (RSI is inbuilt, but lower and upper range can be defined in settings)
c. MACD (12, 26) to be positive and above signal line (this is inbuilt)
2. Recent 12/26 Cross over and closing above pivot point(resistance)
a. 12/26 crossover has to be recent, CrossOverLookbackCandles value will look for crossover in # previous candles..
b. RSI (14) value to be between a range (RSI is inbuilt, but lower and upper range can be defined in settings)
c. MACD (12, 26) to be positive and above signal line (this is inbuilt)
d. closing above resistance line
//////////////////////////////////
For Exit we have three options. you can select any SL as per your need, multiple SLs can also be selected
1. Trailing Stop Loss.
Source for TSL is adjustable(open, close, high or low), also you have to mention % below your source TSL has to be placed.
Once closing is below TSL, exit will be triggered.
2. Closing below 7SMA
After 7SMA SL is enabled, 7SMA will be plotted on chart and exit signal will be triggered when closing is below 7SMA.
Choose this option for LESS risk and rewards
3. 12/26 Crossdown
Once 12EMA crossdown below 26EMA, exit will be triggered.
Choose this option for HIGH risk and rewards
//////////////////////////////////
Resistance line is plotted based on left and right candles, if 10(can be changed) is used for both left and right, indicator will look for 10 candles in left and 10 candles in right and if both left and right candle are lower then a line is plotted.
Source has to be selected (close or high)
//////////////////////////////////
Qty mentioned in Buy trigger will be based on BUYVALUE entered
//////////////////////////////////
Multiple Target option is available, if first target is matched how much percentage of qty to be sold can be defined.
If you wish to have only one Target, then exit qty in first target must be 100