PresentTrend - Strategy [presentTrading]- Introduction and how it is different
The PresentTrend strategy is a unique custom trend-following strategy. This combination allows the strategy to take advantage of both short-term and long-term market trends, making it suitable for various market conditions.
BTCUSDT 4hr chart
(700.hk) 3D chart
- Strategy, How it Works
RSI or MFI: The first part uses a custom indicator based on either the Relative Strength Index (RSI) or the Money Flow Index (MFI). The indicator calculates a PresentTrend value, which generates buy and sell signals based on its crossover and crossunder, indicating potential trend reversals.
ATR: The second part is a popular trend-following indicator that uses the Average True Range (ATR).
The strategy enters a long position when all buy signals from both strategies are true, and a short position when all sell signals are true. This ensures trades are entered when both short-term and long-term trends align, potentially increasing the strategy's reliability.
- Trade direction
The strategy also includes a trade direction parameter, allowing the user to choose whether to enter long trades, short trades, or both. This makes the strategy adaptable to different market conditions and trading styles.
- Usage
1. Set the input parameters for the custom trend-following strategy.
2. Choose whether to use the RSI or MFI for the custom strategy.
3. Choose the trade direction: long, short, or both.
4. The strategy will generate buy and sell signals based on the conditions of both strategies.
5. Enter a trade when a buy or sell signal is generated, depending on the chosen trade direction.
Please note that this strategy is meant to be a tool to aid in your trading decisions and not a standalone trading system. Always use proper risk management and make sure to test the strategy thoroughly before using it in live trading.
- Default settings
1. Source: 'hlc3', a balanced price level for calculations.
2. Length: 14, a common setting for many technical indicators.
3. Multiplier: 1.618 (the golden ratio), used in calculating the upper and lower thresholds.
4. RSI or MFI: Set to use MFI by default, both are momentum indicators.
5. Trade Direction: 'Both', allowing for both long and short trades.
The default settings are designed to provide a balanced approach to trend detection. However, these can be adjusted based on the user's preferences and the specific characteristics of the market being traded.
- Strategy's default Properties
1. Default Quantity Type: 'strategy.percent_of_equity'
2. commission_value= 0.1, commission_type=strategy.commission.percent, slippage= 1: These parameters set the commission and slippage for the strategy. The commission is set to 0.1% of the trade value, and the slippage (the difference between the expected price of a trade and the price at which the trade is executed) is set to 1.
3. default_qty_type = strategy.percent_of_equity, default_qty_value = 10: These parameters set the default quantity for trades. The default_qty_type is set to strategy.percent_of_equity, which means that the size of each trade will be a percentage of the account equity. The default_qty_value is set to 10, which means that each trade will be 10% of the account equity.
4. initial_capital= 10000: This parameter sets the initial capital for the strategy to $10,000.
Indicatori e strategie
Bollinger Bands Modified (Stormer)This strategy is based and shown by trader and investor Alexandre Wolwacz "Stormer".
Overview
The strategy uses two indicators Bollinger Bands and EMA (optional for EMA).
Calculates Bollinger Bands, EMA, highest high, and lowest low values based on the input parameters, evaluating the conditions to determine potential long and short entry signals.
The conditions include checks for crossovers and crossunders of the price with the upper and lower Bollinger Bands, as well as the position of the price relative to the EMA.
The script also incorporates the option to add an inside bar pattern check for additional information.
Entry Position
Long Position:
Price cross over the superior band of bollinger bands.
The EMA is used to add support for trend analysis, it is an optional input, when used, it checks if price is above EMA.
Short Position:
Price cross under the inferior band of bollinger bands.
The EMA is used to add support for trend analysis, it is an optional input, when used, it checks if price is under EMA.
Risk Management
Stop Loss:
The stop loss is calculated based on the input highest high (for short position) and lowest low (for long position).
It gets the length based on the input from the last candles to set which is the highest high and which is the lowest low.
Take Profit:
According to the author, the profit target should be at least 1:1.6 the risk, so to have the strategy mathematically positive.
The profit target is configured input, can be increased or decreased.
It calculates the take profit based on the price of the stop loss with the profit target input.
Risk to Reward - FIXED SL BacktesterDon't know how to code? No problem! TradingView is an excellent platform for you. ✅ ✅
If you have an indicator that you want to backtest using a risk-to-reward ratio or fixed take profit/stop loss levels, then the Risk to Reward - FIXED SL Backtester script is the perfect solution for you.
introducing Risk to Reward - FIXED SL Backtester Script which will allow you to test any indicator / Signal with RR or Fixed SL system
How does it work ?!
Once you connect the script to your indicator, it will analyze your entry points and perform calculations based on them. It will then open trades for you according to the specified inputs in the script settings.
HOW TO CONNECT IT to your indicator?
simply open your indicator code and add the below line of code to it
plot(Signal ? 100 : 0,"Signal",display = display.data_window)
Replace Signal with the long condition from your own indicator. You can also modify the value 100 to any number you prefer. After that, open the settings.
Once the script is connected to your indicator, you can choose from two options:
Risk To Reward Ratio System
Fixed TP/ SL System
🔸if you select the Risk to Reward System ⤵️
The Risk-to-Reward System requires the calculation of a stop loss. That's why I have included three different types of stop-loss calculations for you to choose from:
ATR Based SL
Pivot Low SL
VWAP Based SL
Your stop loss and take profit levels will be automatically calculated based on the selected stop loss method and your risk-to-reward ratio.
You can also adjust their values to match your desired risk level. The trades will be displayed on the chart.
with the ability to change their values to match your risk.
once this is done, trades will be displayed on the chart
🔸if you select the Fixed system ⤵️
You have 2 inputs, which are FIXED TP & Fixed SL
input the values you want, and trades will be on your chart...
I have also added a Breakeven feature for you.
with this Breakeven feature the trade will not just move SL to Entry ?! NO NO, it will place it above entry by a % you input yourself, so you always win! 🚀
Here is an example
Enjoy, and have fun, if you have any questions do not hesitate to ask
twisted SMA strategy [4h] Hello
I would like to introduce a very simple strategy that uses a combination of 3 simple moving averages ( SMA 4 , SMA 9 , SMA 18 )
this is a classic combination showing the most probable trend directions
Crosses were marked on the basis of the color of the candles (bulish cross - blue / bearish cross - maroon)
ma 100 was used to determine the main trend, which is one of the most popular 4-hour candles
We define main trend while price crosses SMA100 ( for bullish trend I use green candle color )
The long position strategy was created in combination of 3 moving averages with Kaufman's adaptive moving average by alexgrover
The strategy is very accurate and is easy to use indicators
the strategy uses only Buy (Long) signals in a combination of crossovers of the SMA 4, SMA 9, SMA 18 and the Kaufman Adaptive Moving Average.
As a signal to close a long position, only the opposite signal of the intersection of 3 different moving averages is used
the current strategy is recommended for higher time zones (4h +) due to the strength of the closing candles, which translates into signal strength
works fascinatingly well for long-term bullish market assets (for example 4h Apple, Tesla charts)
Enjoy and trade safe ;)
Grid Strategy with MA0. Preface
Hello traders,
This is a strategy script that allows you to utilize a Grid Strategy using moving averages.
It is very simple, but I decided to post it because it was hard to find such shared open-source codes in Pine Script.
1. Main
This is a very simple trading method.
Based on the moving average line you set, if the price drops by a certain ATR (or percent) below it, you buy, and when it goes back up, you sell.
In basic settings, you choose the moving average line and its length, and decide how much to set the distance between each grid through the 'Band Multiplier/Percent' item.
I believe that it is advantageous to widen the bandwidth for stocks with strong upward momentum.
2. Conclusion
I have confirmed that this works better in the stock market than in the crypto market,
and that it is suitable for use on index stocks like NASDAQ because it follows trends.
In addition, through backtesting, I have confirmed that this grid strategy is more suitable for buying strategies than selling strategies, so I uploaded it as a strategy focused on buying strategies.
Personally, I have developed my own strategy by adjusting buying and selling strategies according to trends and managing risks.
I hope you can use this to create a script that suits you.
Thank you.
Buy&Sell Bullish Engulfing - The Quant Science🇺🇸
GENERAL OVERVIEW
Buy&Sell Bullish Engulfing - The Quant Science It is a Buy&Sell strategy based on the 'Bullish Engulfing' candlestick pattern. The main goal of the strategy is to achieve a consistent and sustainable return over time, with a manageable level of risk.
Bullish Engulfing
The template was developed at the top of the Indicator provided by TradingView called 'Engulfing - Bullish'.
ENTRY AND EXIT CRITERIA
Entry: A single long order is opened when the candlestick pattern is formed, and the percentage size of the order (%) is fixed by the trader through the user interface.
Exit: The long trade is closed on a percentage equity take profit-stop loss.
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
🇮🇹
PANORAMICA GENERALE
Buy&Sell Bullish Engulfing - The Quant Science è una strategia Buy&Sell basata sul candlestick pattern 'Bullish Engulfing'. L'obiettivo principale della strategia è ottenere un ritorno costante e sostenibile nel tempo, con un livello gestibile di rischio.
Bullish Engulfing
Il template è stato sviluppato al top dell' Indicatore fornito da Trading View chiamato 'Engulfing - Bullish'.
CRITERI DI ENTRATA E USCITA
Entrata: viene aperto un singolo ordine long quando si forma il candlestick pattern, la size percentuale dell'ordine (%) viene selezionato tramite l'interfaccia utente dal trader.
Uscita: la chiusura della posizione avviene unicamente tramite un take profit-stop loss percentuale calcolato sul capitale.
ATR GOD Strategy by TradeSmart (PineConnector-compatible)This is a highly-customizable trading strategy made by TradeSmart, focusing mainly on ATR-based indicators and filters. The strategy is mainly intended for trading forex , and has been optimized using the Deep Backtest feature on the 2018.01.01 - 2023.06.01 interval on the EUR/USD (FXCM) 15M chart, with a Slippage value of 3, and a Commission set to 0.00004 USD per contract. The strategy is also made compatible with PineConnector , to provide an easy option to automate the strategy using a connection to MetaTrader. See tooltips for details on how to set up the bot, and check out our website for a detailed guide with images on how to automate the strategy.
The strategy was implemented using the following logic:
Entry strategy:
A total of 4 Supertrend values can be used to determine the entry logic. There is option to set up all 4 Supertrend parameters individually, as well as their potential to be used as an entry signal/or a trend filter. Long/Short entry signals will be determined based on the selected potential Supertrend entry signals, and filtered based on them being in an uptrend/downtrend (also available for setup). Please use the provided tooltips for each setup to see every detail.
Exit strategy:
4 different types of Stop Losses are available: ATR-based/Candle Low/High Based/Percentage Based/Pip Based. Additionally, Force exiting can also be applied, where there is option to set up 4 custom sessions, and exits will happen after the session has closed.
Parameters of every indicator used in the strategy can be tuned in the strategy settings as follows:
Plot settings:
Plot Signals: true by default, Show all Long and Short signals on the signal candle
Plot SL/TP lines: false by default, Checking this option will result in the TP and SL lines to be plotted on the chart.
Supertrend 1-4:
All the parameters of the Supertrends can be set up here, as well as their individual role in the entry logic.
Exit Strategy:
ATR Based Stop Loss: true by default
ATR Length (of the SL): 100 by default
ATR Smoothing (of the SL): RMA/SMMA by default
Candle Low/High Based Stop Loss: false by default, recent lowest or highest point (depending on long/short position) will be used to calculate stop loss value. Set 'Base Risk Multiplier' to 1 if you would like to use the calculated value as is. Setting it to a different value will count as an additional multiplier.
Candle Lookback (of the SL): 50 by default
Percentage Based Stop Loss: false by default, Set the stop loss to current price - % of current price (long) or price + % of current price (short).
Percentage (of the SL): 0.3 by default
Pip Based Stop Loss: Set the stop loss to current price - x pips (long) or price + x pips (short). Set 'Base Risk Multiplier' to 1 if you would like to use the calculated value as is. Setting it to a different value will count as an additional multiplier.
Pip (of the SL): 10 by default
Base Risk Multiplier: 4.5 by default, the stop loss will be placed at this risk level (meaning in case of ATR SL that the ATR value will be multiplied by this factor and the SL will be placed that value away from the entry level)
Risk to Reward Ratio: 1.5 by default, the take profit level will be placed such as this Risk/Reward ratio is met
Force Exiting:
4 total Force exit on custom session close options: none applied by default. If enabled, trades will close automatically after the set session is closed (on next candle's open).
Base Setups:
Allow Long Entries: true by default
Allow Short Entries: true by default
Order Size: 10 by default
Order Type: Capital Percentage by default, allows adjustment on how the position size is calculated: Cash: only the set cash amount will be used for each trade Contract(s): the adjusted number of contracts will be used for each trade Capital Percentage: a % of the current available capital will be used for each trade
ATR Limiter:
Use ATR Limiter: true by default, Only enter into any position (long/short) if ATR value is higher than the Low Boundary and lower than the High Boundary.
ATR Limiter Length: 50 by default
ATR Limiter Smoothing: RMA/SMMA by default
High Boundary: 1000 by default
Low Boundary: 0.0003 by default
MA based calculation: ATR value under MA by default, If not Unspecified, an MA is calculated with the ATR value as source. Only enter into position (long/short) if ATR value is higher/lower than the MA.
MA Type: RMA/SMMA by default
MA Length: 400 by default
Waddah Attar Filter:
Explosion/Deadzone relation: Not specified by default, Explosion over Deadzone: trades will only happen if the explosion line is over the deadzone line; Explosion under Deadzone: trades will only happen if the explosion line is under the deadzone line; Not specified: the opening of trades will not be based on the relation between the explosion and deadzone lines.
Limit trades based on trends: Not specified by default, Strong Trends: only enter long if the WA bar is colored green (there is an uptrend and the current bar is higher then the previous); only enter short if the WA bar is colored red (there is a downtrend and the current bar is higher then the previous); Soft Trends: only enter long if the WA bar is colored lime (there is an uptrend and the current bar is lower then the previous); only enter short if the WA bar is colored orange (there is a downtrend and the current bar is lower then the previous); All Trends: only enter long if the WA bar is colored green or lime (there is an uptrend); only enter short if the WA bar is colored red or orange (there is a downtrend); Not specified: the color of the WA bar (trend) is not relevant when considering entries.
WA bar value: Not specified by default, Over Explosion and Deadzone: only enter trades when the WA bar value is over the Explosion and Deadzone lines; Not specified: the relation between the explosion/deadzone lines to the value of the WA bar will not be used to filter opening trades.
Sensitivity: 150 by default
Fast MA Type: SMA by default
Fast MA Length: 10 by default
Slow MA Type: SMA
Slow MA Length: 20 by default
Channel MA Type: EMA by default
BB Channel Length: 20 by default
BB Stdev Multiplier: 2 by default
Trend Filter:
Use long trend filter 1: false by default, Only enter long if price is above Long MA.
Show long trend filter 1: false by default, Plot the selected MA on the chart.
TF1 - MA Type: EMA by default
TF1 - MA Length: 120 by default
TF1 - MA Source: close by default
Use short trend filter 1: false by default, Only enter long if price is above Long MA.
Show short trend filter 1: false by default, Plot the selected MA on the chart.
TF2 - MA Type: EMA by default
TF2 - MA Length: 120 by default
TF2 - MA Source: close by default
Volume Filter:
Only enter trades where volume is higher then the volume-based MA: true by default, a set type of MA will be calculated with the volume as source, and set length
MA Type: RMA/SMMA by default
MA Length: 200 by default
Date Range Limiter:
Limit Between Dates: false by default
Start Date: Jan 01 2023 00:00:00 by default
End Date: Jun 24 2023 00:00:00 by default
Session Limiter:
Show session plots: false by default, show market sessions on chart: Sidney (red), Tokyo (orange), London (yellow), New York (green)
Use session limiter: false by default, if enabled, trades will only happen in the ticked sessions below.
Sidney session: false by default, session between: 15:00 - 00:00 (EST)
Tokyo session: false by default, session between: 19:00 - 04:00 (EST)
London session: false by default, session between: 03:00 - 11:00 (EST)
New York session: false by default, session between: 08:00 - 17:00 (EST)
Trading Time:
Limit Trading Time: true by default, tick this together with the options below to enable limiting based on day and time
Valid Trading Days Global: 123567 by default, if the Limit Trading Time is on, trades will only happen on days that are present in this field. If any of the not global Valid Trading Days is used, this field will be neglected. Values represent days: Sunday (1), Monday (2), ..., Friday (6), Saturday(7) To trade on all days use: 123457
(1) Valid Trading Days: false, 123456 by default, values represent days: Sunday (1), Monday (2), ..., Friday (6), Saturday(7) The script will trade on days that are present in this field. Please make sure that this field and also (1) Valid Trading Hours Between is checked
(1) Valid Trading Hours Between: false, 1800-2000 by default, hours between which the trades can happen. The time is always in the exchange's timezone
All other options are also disabled by default
PineConnector Automation:
Use PineConnector Automation: false by default, In order for the connection to MetaTrader to work, you will need do perform prerequisite steps, you can follow our full guide at our website, or refer to the official PineConnector Documentation. To set up PineConnector Automation on the TradingView side, you will need to do the following:
1. Fill out the License ID field with your PineConnector License ID;
2. Fill out the Risk (trading volume) with the desired volume to be traded in each trade (the meaning of this value depends on the EA settings in Metatrader. Follow the detailed guide for additional information);
3. After filling out the fields, you need to enable the 'Use PineConnector Automation' option (check the box in the strategy settings);
4. Check if the chart has updated and you can see the appropriate order comments on your chart;
5. Create an alert with the strategy selected as Condition, and the Message as {{strategy.order.comment}} (should be there by default);
6. Enable the Webhook URL in the Notifications section, set it as the official PineConnector webhook address and enjoy your connection with MetaTrader.
License ID: 60123456789 by default
Risk (trading volume): 1 by default
NOTE! Fine-tuning/re-optimization is highly recommended when using other asset/timeframe combinations.
Powertrend - Volume Range Filter Strategy [wbburgin]The Powertrend is a range filter that is based off of volume, instead of price. This helps the range filter capture trends more accurately than a price-based range filter, because the range filter will update itself from changes in volume instead of changes in price. In certain scenarios this means that the Powertrend will be more profitable than a normal range filter.
Essentials of the Strategy
This is a breakout strategy which works best on trending assets with high volume and liquidity. It should be used on middle to higher timeframes and can be used on all assets that have volume provided by the data source (stocks, crypto, forex). It is long-only as of now. It can work on lower timeframes if you optimize the strategy filters to make less trades or if your exchange/broker is low/no fees, provided that your exchange/broker has high liquidity and volume.
The strategy enters a long position if the range filter is trending upwards and the price crosses over the upper range band, which signifies a price-volume breakout. The strategy closes the long position if the range filter is trending downwards and the price crosses under the lower range band, which signifies a breakdown. Both these conditions can be altered by the three filter options in the settings. The default trend filter is not alterable because it helps prevent false entries and exits that are against the trend.
Settings
The Length setting is the lookback period for the range smoothing.
The ADX Filter setting enables you to turn on an ADX filter, which will halt entries and exits unless the ADX of your customizable length is above a ADX VWMA of that length.
The Range Supertrend setting creates a supertrend from the top and bottom ranges, which can be used to filter entries and exits. The length is customizable. The filter can show you whether the range is making higher highs and lower lows. Below is an example of the Range Supertrend being used as a filter and plotted on-chart:
The VWMA setting halts entries if they are below a customizable length VWMA.
Both the Range Supertrend and the VWMA can also be plotted separately without actually filtering the strategy, so that you can use them independently if you wish. You can turn off the bar color, the highlighting, and the labels if you wish in the settings. A note about the bar color: if the color changes but the strategy does not signal an exit or entry this means that the crossover was against the trend. In these circumstances it may be indicative of a pullback to enter or exit or to add onto your position.
About the Strategy Results Below
A range filter is normally composed of two components - the range filter itself and a smoothing function. In the development of this script I tested both normal and volume-based varieties of the range filter and the smoothing function:
Tests Performed
Volume-based Range x VWMA smoothing
Price-based Range x VWMA smoothing
Price-based Range x EMA smoothing
Volume-based Range x EMA smoothing (final result)
The highest-performing was a volume-based range filter and a normal EMA-based smoothing function, but that does not mean that this strategy will be profitable - exits are based off of signal reversion so I strongly encourage you to develop your own take profits/stop losses for the strategy if you think it may be a good fit for you. The results below are with a commission value of 0.05% (because I built the strategy first for equities), slippage of 3, so if your exchange/broker has a higher fee schedule, I recommend adding filters and/or moving to higher timeframes for the strategy. Additionally, I used 10% of equity in each trade, while using the Range Supertrend filter (the previous upload was unrealistic because it used 100% of equity - missed a 0, apologies, and added in slippage).
Ta StrategyHello guys
This script follows traditional technical indicators
MACD, ADX, RSI and pivot points
If the price is above the resistance and the MACD has crossover ,and the RSI 14 is above 50
ADX is higher than 20, and DI+ is higher than DI-. This is a buy signal and vice versa for a sell signal
The script moves the stop loss to the entry price after the first target is reached
You can specify the quantity you want to sell when the price reaches the first target
There are also options like if you want the script to entry long or short, or both
you can reverse the strategy if it does not work well
If you want to inquire about any details, please let me know in the comments
Volume-Weighted Supertrend Strategy [wbburgin]This is a script that can be used as a strategy or a standalone indicator.
The Volume-Weighted Supertrend is a supertrend based on a rolling VWAP, instead of a normal price source. The strategy has two components - a supertrend based off of this VWAP (shown on the chart) and a supertrend from volume itself (not plotted on the chart directly). The supertrend from volume is an example of my "Supertrend Any Source" indicator, where a custom ATR is created from non-OHLC data; this is available as both a separate public script and also in my "wbburgin_utils" library for you to use in your own script creation.
The supertrend from volume acts as a confirmation filter for the VWAP-supertrend shown on-chart. If the volume supertrend is trending up and the VWAP-based supertrend is also trending up, a buy signal is generated. Likewise, if the volume supertrend is trending down and the VWAP-supertrend is trending down, a sell signal is generated. The colors are based off of whether both supertrends are trending up or down: green for both up, blue for only price up, orange for only price down, and red for both down.
The settings enable you to change the volume length and the ATR length separately, as well as the multiplier and the source for the price supertrend. If you load the indicator for the first time and see no entries and exits, this is because "Show Strategy Entries and Exits" is disabled in the settings. This is if you plan on using the strategy as an indicator and don't want to be bothered by the entry and exit symbols on the chart. Additionally, for those who like clean charts (like me), you can turn all the labels off in the settings, as well as the highlighting.
My default strategy settings for the strategy results shown below are as follows: 5% equity per trade, 5 degrees of pyramiding, commissions of 0.08% per trade. This strategy doesn't come with stops yet, so please be aware of that before using it to trade - I highly suggest you create your own stops based off of your R/R ratio and personal risk tolerance. Additionally, it works best on trending assets (b/c of the supertrends) with high volume. This might mean it does not work as well on lower timeframes.
[SMT] Buy & Sell Renko Based - StrategyThis is a custom indicator that implements a trading strategy based on Renko charts, but they can be used on regular candlestick charts and on any time frame. Renko charts are known for filtering market noise and displaying price movements in a clearer way. However, it is important to note that this indicator is provided for educational and informational purposes only and is not a guarantee of profitable returns.
Features:
- The indicator uses Renko charts to generate buy and sell signals.
- Renko bricks are built based on a predefined price variation, rather than time.
- The length of the Average True Range (ATR) used to calculate Renko bricks can be customized.
- Buy signals are generated when the price crosses below the current Renko brick.
- Sell signals are generated when the price crosses above the current Renko brick.
- Entry points are marked with "Buy" and "Sell" arrows on the chart.
It is essential to emphasize that no indicator or trading strategy guarantees profitable results. The financial market is complex and subject to unpredictable changes. It is recommended to perform additional tests and analysis before using this indicator on a real trading account.
Always remember to manage your risks properly and consider other factors such as fundamental analysis and market conditions when making trading decisions. The use of this indicator is entirely the user's responsibility.
DISCLAIMER: This indicator is not financial advice and should not be interpreted as such. Always consult with a qualified financial professional before making any investment decisions.
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!
Trailing Stop with RSI - Momentum-Based StrategyTrailing Stop with RSI - Momentum-Based Strategy
Description:
The Trailing Stop with RSI strategy combines momentum analysis and trailing stop functionality to help traders identify potential entry and exit points in their trading decisions. This strategy is suitable for various markets and timeframes.
Key Features:
Momentum Analysis: The strategy incorporates momentum indicators to identify potential buying and selling opportunities based on momentum shifts in the price.
Trailing Stop Functionality: The strategy utilizes a trailing stop to protect profits and dynamically adjust the stop loss level as the trade moves in the desired direction.
RSI Confirmation: The Relative Strength Index (RSI) is included to provide additional confirmation for trade entries by considering overbought and oversold conditions.
How to Use:
Entry Conditions: Long positions are triggered when positive momentum is detected, and the RSI confirms an oversold condition. Short positions are triggered when negative momentum is detected, and the RSI confirms an overbought condition.
Trailing Stop Activation: Once a position is opened, the trailing stop is activated when the specified profit level (as a percentage) is reached.
Trailing Stop Level: The trailing stop maintains a stop loss level at a specified distance (as a percentage) from the highest profit achieved since opening the position.
Exit Conditions: The trailing stop will trigger an exit and close all positions when the trailing stop level is breached.
Markets and Conditions:
This strategy can be applied to various markets, including stocks, forex, cryptocurrencies, and commodities. It can be used in trending and ranging market conditions, making it versatile for different market environments.
Important Considerations:
Adjust Parameters: Traders can modify the length of the momentum and RSI indicators to suit their preferred timeframe and trading style.
Risk Management: It is recommended to consider appropriate position sizing, risk-to-reward ratios, and overall risk management practices when using this strategy.
Backtesting and Optimization: Traders are encouraged to backtest the strategy on historical data and optimize the parameters to find the best settings for their chosen market and timeframe.
By incorporating momentum analysis, trailing stop functionality, and RSI confirmation, this strategy aims to provide traders with a systematic approach to capturing profitable trades while managing risk effectively.
Williams %R Cross Strategy with 200 MA Filter
1. The script is a trading strategy based on the Williams %R indicator and a 200-period moving average (MA) filter.
2. The user can input the length of the Williams %R indicator (`wrLength`), the threshold for %R crossing (`crossPips`), the take profit level in pips (`takeProfitPips`), and the stop loss level in pips (`stopLossPips`).
3. The script calculates the Williams %R using the `ta.highest` and `ta.lowest` functions to find the highest high and lowest low over the specified length (`wrLength`).
4. It also calculates a 200-period simple moving average (`ma200`) using the `ta.sma` function.
5. The entry conditions are defined as follows:
- For a long entry, it checks if the Williams %R crosses above the -50 line by a threshold of `crossPips` and if the close price is above the 200-period MA.
- For a short entry, it checks if the Williams %R crosses below the -50 line by a threshold of `crossPips` and if the close price is below the 200-period MA.
6. The exit conditions are defined as follows:
- For a long position, it checks if the close price reaches the take profit level (defined as the average entry price plus `takeProfitPips` in pips) or the stop loss level (defined as the average entry price minus `stopLossPips` in pips).
- For a short position, it checks if the close price reaches the take profit level (defined as the average entry price minus `takeProfitPips` in pips) or the stop loss level (defined as the average entry price plus `stopLossPips` in pips).
7. The script uses the `strategy.entry` function to place long and short orders when the respective entry conditions are met.
8. It uses the `strategy.close` function to close the long and short positions when the respective exit conditions are met.
The script allows you to customize the parameters such as the length of Williams %R, the crossing threshold, take profit and stop loss levels, and the moving average period to suit your trading preferences.
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.
RSI-CCI Fusion StrategyRSI-CCI Fusion Strategy: Harnessing the Power of RSI and CCI
The "RSI-CCI Fusion Strategy" is a powerful trading approach that combines the strengths of the Relative Strength Index (RSI) and the Commodity Channel Index (CCI) to provide enhanced trading insights. This strategy is based on the popular "RSI & CCI Fusion + Alerts" indicator, which utilizes the RSI and CCI indicators from TradingView .
1. Overview of RSI and CCI:
The Relative Strength Index (RSI) is a widely used momentum oscillator that measures the speed and change of price movements. It helps traders identify overbought and oversold conditions in the market. On the other hand, the Commodity Channel Index (CCI) is a versatile indicator that identifies cyclical trends and provides insights into overbought and oversold levels.
2. The RSI-CCI Fusion Strategy:
The RSI-CCI Fusion Strategy harnesses the combined power of the RSI and CCI indicators to generate robust trading signals. By blending the RSI and CCI, this strategy captures both momentum and cyclical trend dynamics, offering a more comprehensive view of the market.
3. Utilizing the RSI-CCI Fusion Indicator + Alerts:
The "RSI & CCI Fusion + Alerts" indicator serves as the backbone of the RSI-CCI Fusion Strategy. It integrates the RSI and CCI indicators from TradingView, providing traders with a clear and actionable trading signal.
4. How it Works:
- The indicator calculates the RSI and CCI values, standardizes them using z-score, and combines them with a weighted fusion approach.
- The resulting RSI-CCI Fusion indicator is plotted on the chart, accompanied by dynamic upper and lower bands, which help identify potential overbought and oversold conditions.
- Traders can customize alerts based on their preferred thresholds and timeframes, enabling them to receive timely notifications for potential buy and sell signals.
5. Implementing the RSI-CCI Fusion Strategy:
Traders following the RSI-CCI Fusion Strategy can utilize the buy and sell signals generated by the RSI-CCI Fusion indicator. When the indicator crosses below the upper band, it may signal a potential selling opportunity. Conversely, when it crosses above the lower band, it may indicate a potential buying opportunity. Traders can also consider additional factors and technical analysis tools to validate the signals before making trading decisions.
Conclusion: The RSI-CCI Fusion Strategy provides traders with a robust approach to analyze the market and make well-informed trading decisions. By incorporating the RSI and CCI indicators through the "RSI & CCI Fusion + Alerts" indicator, traders can take advantage of the combined strengths of these indicators. However, it is important to remember that no strategy guarantees success, and traders should always practice risk management and conduct thorough analysis before executing trades using this strategy.
Disclaimer: Trading involves risks, and it is important to conduct your own research and consult with a financial advisor before making any investment decisions.
Note: The RSI-CCI Fusion Strategy serves as a general guide, and individual traders may have different preferences and trading styles.
Ultimate Balance StrategyThe Ultimate Balance Oscillator Strategy harnesses the power of the Ultimate Balance Oscillator to deliver a comprehensive and disciplined approach to trading. By combining the insights of the Rate of Change (ROC), Relative Strength Index (RSI), Commodity Channel Index (CCI), Williams Percent Range, and Average Directional Index (ADX) from TradingView, this strategy offers traders a systematic way to navigate the markets with precision.
The core principle of this strategy lies in its ability to identify optimal entry and exit points based on the movement of the Ultimate Balance Oscillator. When the oscillator line crosses below the 0.75 level, a buy signal is generated, indicating a potential opportunity for a bullish trend reversal. Conversely, when the oscillator line crosses above the 0.25 level, it triggers an exit signal, suggesting a possible end to a bullish trend.
Key Features:
1. Objective Market Analysis: The Ultimate Balance Oscillator Strategy provides a disciplined and objective approach to market analysis. By relying on the quantified insights of multiple indicators, it helps traders cut through market noise and focus on key signals, improving decision-making and reducing emotional biases.
2. Enhanced Timing and Precision: This strategy's entry and exit signals are based on the specific thresholds of the Ultimate Balance Oscillator. By waiting for confirmation through the crossing of these levels, traders can potentially enter trades at opportune moments and exit with greater precision, maximizing profit potential and minimizing risk exposure.
3. Customizability and Adaptability: The strategy offers flexibility, allowing traders to customize the parameters to fit their preferred trading style and timeframes. Whether you're a short-term trader or a long-term investor, the Ultimate Balance Oscillator Strategy can be adjusted to suit your specific needs, making it adaptable to various market conditions.
4. Real-time Alerts: Stay informed and never miss a potential trade opportunity with the strategy's built-in alert system. Set personalized alerts for buy and exit signals to receive timely notifications, ensuring you're always aware of the latest developments in the market.
5. Backtesting and Optimization: Before applying the strategy to live trading, it's recommended to conduct thorough backtesting and optimization. By testing the strategy's performance over historical data and fine-tuning the parameters, you can gain insights into its strengths and weaknesses, enabling you to make informed adjustments and increase its effectiveness.
Trading involves risk. Use the Ultimate Balance Oscillator Strategy at your own discretion. Past performance is not indicative of future results.
DZ Strategy ICTThe script presented is a trading strategy called "Breaker Block Strategy with Price Channel". This strategy uses multiple time frames (1 minute, 5 minutes, 15 minutes, 1 hour, and 4 hours) to detect support and resistance areas on the chart.
The strategy uses parameters such as length, deviations, multiplier, Fibonacci level, move lag and volume threshold for each time frame. These parameters are adjustable by the user.
The script then calculates support and resistance levels using the simple moving average (SMA) and standard deviation (STDEV) of closing prices for each time frame.
It also detects "Breaker Blocks" based on price movement from support and resistance levels, as well as trade volume. A Breaker Block occurs when there is a significant breakout of a support or resistance level with high volume.
Buy and sell signals are generated based on the presence of a Breaker Block and price movement from support and resistance levels. When a buy signal is generated, a buy order is placed, and when a sell signal is generated, a sell order is placed.
The script also plots price channels for each time frame, representing resistance and support levels.
Profit limit levels are set for each time range, indicating that the price levels assigned to positions should be closed with a profit. Stop-loss levels are also set to limit losses in the event of canceled price movements.
In summary, this trading strategy uses a combination of Breaker Block detection, support and resistance levels, price channels and profit limit levels to generate buy and sell signals and manage positions on different time ranges.
Williams %R Strategy
The Williams %R Strategy is a trading approach that is based on the Williams Percent Range indicator, available on the TradingView platform.
This strategy aims to identify potential overbought and oversold conditions in the market, providing clear buy and sell signals for entry and exit.
The strategy utilizes the Williams %R indicator, which measures the momentum of the market by comparing the current close price with the highest high and lowest low over a specified period. When the Williams %R crosses above the oversold level, a buy signal is generated, indicating a potential upward price movement. Conversely, when the indicator crosses below the overbought level, a sell signal is generated, suggesting a possible downward price movement.
Position management is straightforward with this strategy. Upon receiving a buy signal, a long position is initiated, and the position is closed when a sell signal is generated. This strategy allows traders to capture potential price reversals and take advantage of short-term market movements.
To manage risk, it is recommended to adjust the position size based on the available capital. In this strategy, the position size is set to 10% of the initial capital, ensuring proper risk allocation and capital preservation.
It is important to note that the Williams %R Strategy should be used in conjunction with other technical analysis tools and risk management techniques. Backtesting and paper trading can help evaluate the strategy's performance and fine-tune the parameters before deploying it with real funds.
Remember, trading involves risks, and past performance is not indicative of future results. It is always advised to do thorough research, seek professional advice, and carefully consider your financial goals and risk tolerance before making any investment decisions.