Nitin Swing TradingThis is a CPR which indicates pivot points based on monthly price action.
The Orange line acts as a resistance area, blue lines act as pivot point/CPR and green one is support.
One can study retrospective chart to analyse how market has respected these Support and Resistance levels.
A guide on how to trade using this indicator?
1. If you see the resistance is broken after multiple attempt - We can Go Long
2.If you see price going down below CPR, We can Go Short
3.If you see price taking support at support level - We can Go Long.
Risk reward should always be 1:1 then gradually increase it to 1:2 & 1:3
It is advised to consult with your financial advisor before taking any trade just based on any indicator. You have to manage risk before entering any trade.
Educational
Inside Candle alert V1 By HARSH DEO SINGHA breakout long signal is generated when the current high crosses above the previous mother bar's high, and it's an inside bar.
A breakdown short signal is generated when the current low crosses below the previous mother bar's low, and it's an inside bar.
The script plots triangle shapes below breakout long signals and above breakdown short signals.
Alert conditions are added for inside bars, breakout long, and breakdown short.
Please note that this is a basic example, and you can further refine and optimize your strategy based on your specific trading rules and preferences. Always remember to backtest and paper trade any strategy before using it with real money.
Paytience DistributionPaytience Distribution Indicator User Guide
Overview:
The Paytience Distribution indicator is designed to visualize the distribution of any chosen data source. By default, it visualizes the distribution of a built-in Relative Strength Index (RSI). This guide provides details on its functionality and settings.
Distribution Explanation:
A distribution in statistics and data analysis represents the way values or a set of data are spread out or distributed over a range. The distribution can show where values are concentrated, values are absent or infrequent, or any other patterns. Visualizing distributions helps users understand underlying patterns and tendencies in the data.
Settings and Parameters:
Main Settings:
Window Size
- Description: This dictates the amount of data used to calculate the distribution.
- Options: A whole number (integer).
- Tooltip: A window size of 0 means it uses all the available data.
Scale
- Description: Adjusts the height of the distribution visualization.
- Options: Any integer between 20 and 499.
Round Source
- Description: Rounds the chosen data source to a specified number of decimal places.
- Options: Any whole number (integer).
Minimum Value
- Description: Specifies the minimum value you wish to account for in the distribution.
- Options: Any integer from 0 to 100.
- Tooltip: 0 being the lowest and 100 being the highest.
Smoothing
- Description: Applies a smoothing function to the distribution visualization to simplify its appearance.
- Options: Any integer between 1 and 20.
Include 0
- Description: Dictates whether zero should be included in the distribution visualization.
- Options: True (include) or False (exclude).
Standard Deviation
- Description: Enables the visualization of standard deviation, which measures the amount of variation or dispersion in the chosen data set.
- Tooltip: This is best suited for a source that has a vaguely Gaussian (bell-curved) distribution.
- Options: True (enable) or False (disable).
Color Options
- High Color and Low Color: Specifies colors for high and low data points.
- Standard Deviation Color: Designates a color for the standard deviation lines.
Example Settings:
Example Usage RSI
- Description: Enables the use of RSI as the data source.
- Options: True (enable) or False (disable).
RSI Length
- Description: Determines the period over which the RSI is calculated.
- Options: Any integer greater than 1.
Using an External Source:
To visualize the distribution of an external source:
Select the "Move to" option in the dropdown menu for the Paytience Distribution indicator on your chart.
Set it to the existing panel where your external data source is placed.
Navigate to "Pin to Scale" and pin the indicator to the same scale as your external source.
Indicator Logic and Functions:
Sinc Function: Used in signal processing, the sinc function ensures the elimination of aliasing effects.
Sinc Filter: A filtering mechanism which uses sinc function to provide estimates on the data.
Weighted Mean & Standard Deviation: These are statistical measures used to capture the central tendency and variability in the data, respectively.
Output and Visualization:
The indicator visualizes the distribution as a series of colored boxes, with the intensity of the color indicating the frequency of the data points in that range. Additionally, lines representing the standard deviation from the mean can be displayed if the "Standard Deviation" setting is enabled.
The example RSI, if enabled, is plotted along with its common threshold lines at 70 (upper) and 30 (lower).
Understanding the Paytience Distribution Indicator
1. What is a Distribution?
A distribution represents the spread of data points across different values, showing how frequently each value occurs. For instance, if you're looking at a stock's closing prices over a month, you may find that the stock closed most frequently around $100, occasionally around $105, and rarely around $110. Graphically visualizing this distribution can help you see the central tendencies, variability, and shape of your data distribution. This visualization can be essential in determining key trading points, understanding volatility, and getting an overview of the market sentiment.
2. The Rounding Mechanism
Every asset and dataset is unique. Some assets, especially cryptocurrencies or forex pairs, might have values that go up to many decimal places. Rounding these values is essential to generate a more readable and manageable distribution.
Why is Rounding Needed? If every unique value from a high-precision dataset was treated distinctly, the resulting distribution would be sparse and less informative. By rounding off, the values are grouped, making the distribution more consolidated and understandable.
Adjusting Rounding: The `Round Source` input allows users to determine the number of decimal places they'd like to consider. If you're working with an asset with many decimal places, adjust this setting to get a meaningful distribution. If the rounding is set too low for high precision assets, the distribution could lose its utility.
3. Standard Deviation and Oscillators
Standard deviation is a measure of the amount of variation or dispersion of a set of values. In the context of this indicator:
Use with Oscillators: When using oscillators like RSI, the standard deviation can provide insights into the oscillator's range. This means you can determine how much the oscillator typically deviates from its average value.
Setting Bounds: By understanding this deviation, traders can better set reasonable upper and lower bounds, identifying overbought or oversold conditions in relation to the oscillator's historical behavior.
4. Resampling
Resampling is the process of adjusting the time frame or value buckets of your data. In the context of this indicator, resampling ensures that the distribution is manageable and visually informative.
Resample Size vs. Window Size: The `Resample Resolution` dictates the number of bins or buckets the distribution will be divided into. On the other hand, the `Window Size` determines how much of the recent data will be considered. It's crucial to ensure that the resample size is smaller than the window size, or else the distribution will not accurately reflect the data's behavior.
Why Use Resampling? Especially for price-based sources, setting the window size around 500 (instead of 0) ensures that the distribution doesn't become too overloaded with data. When set to 0, the window size uses all available data, which may not always provide an actionable insight.
5. Uneven Sample Bins and Gaps
You might notice that the width of sample bins in the distribution is not uniform, and there can be gaps.
Reason for Uneven Widths: This happens because the indicator uses a 'resampled' distribution. The width represents the range of values in each bin, which might not be constant across bins. Some value ranges might have more data points, while others might have fewer.
Gaps in Distribution: Sometimes, there might be no data points in certain value ranges, leading to gaps in the distribution. These gaps are not flaws but indicate ranges where no values were observed.
In conclusion, the Paytience Distribution indicator offers a robust mechanism to visualize the distribution of data from various sources. By understanding its intricacies, users can make better-informed trading decisions based on the distribution and behavior of their chosen data source.
Time Session Filter - MACD exampleTime Session Filter in TradingView Strategy: A Comprehensive Guide
Welcome to this educational TradingView blog where we dive deep into the functionality and utility of the time session filter in trading strategies. It's interesting to note that the time session filter is a commonly overlooked feature in Pine Script, often not integrated into overall trading strategies. Yet, when used wisely, this tool can significantly enhance your trading approach. In essence, the session filter ensures that trades are only made within a specific, user-defined time frame. By incorporating this often-neglected building block, you can make your strategy more adaptable to various market conditions and trading preferences.
What is a Time Session Filter?
A time session filter is designed to:
Select Times of the Day to Trade: The filter allows you to choose specific hours during the day in which trades are allowed to be excecuted.
Toggle Days to Trade: You can decide which days of the week you want to trade, giving you the flexibility to avoid days that are historically not profitable for your strategy.
Close Trade When Session Ends: The filter can automatically close any open trade once the specified time session concludes, reducing the risk associated with holding positions outside your chosen time frame.
The user interface is streamlined, taking minimal space for the input sections, making it convenient to integrate with other indicators in your overall strategy script. In addition the script colors the background of the chart green when the timesession filter is on and makes the background red when the filter doesn't allow any trades. This helps you to visualise the selected timeframes in relation to chart patterns.
Best Practices for Time Selection
From my personal trading experience I share some input settings you can try to play around with:
Stocks: Trading stocks sometimes yield better results if you only trade in the mornings until lunchtime. This is the period when markets are generally more active, and traders are keenly participating.
Cryptocurrencies: For cryptocurrencies, it sometimes makes sense to avoid trading on Fridays, a day when futures contracts often expire. Various other market-moving events also typically occur on Fridays.
Random Selection: Interestingly, sometimes choosing a random selection of times and days can improve the script's performance, adding an element of unpredictability that might outperform more systematic approaches.
Strategy Overview
This strategy script incorporates various elements, including risk position size and MACD indicator, to provide a comprehensive trading strategy. For a detailed explanation of risk position sizing, please refer to this article:
For a complete understanding of the MACD indicator utilized, visit the following explanation:
Additionally, for high time frame trend filters, consult this resource for more info:
Educational Purposes and Risks
Please note that this script is for educational purposes and serves merely as an example of how to incorporate a time session filter into a trading strategy for pinescript. It is a simplified strategy without a fixed stop-loss, which can result in higher exposure to significant losses. The time session filter can be a powerful addition to your trading strategy, providing you with the tools to tailor your approach according to time-specific market conditions. By understanding its functionalities and best practices, you can make more informed trading decisions, but always remember that trading carries inherent risks.
Happy trading!
Equity Trade Risk ManagerEquity Trade Risk Manager is a simple indicator that helps you protect your portfolio by going into each trade risk first !
Equity Trade Risk Manager does this by calculating your ideal position size or ideal stop loss based on your account size, purchase price and risk tolerance. This ensures you are never risking more than your predetermined amount on each trade.
Unlike most position size calculators, that will only tell traders how many shares to purchase, Equity Trade Risk Manger allows the trader to choose whether they want to calculate the ideal number of shares to purchase or where to set the trades stop loss based on the number of shares owned. Not only that, but knowing traders need to act fast, the indicator also gives the option to quickly use the current price and low of the day as an entry and stop. Lastly, your stop loss will be plotted onto the chart for a visual aid.
Features:
Dynamic Risk Settings:
Account Customization: Input your account size to get metrics tailored to you.
Calculation Choices: Decide if you want the tool to calculate the number of shares you should buy or where to set your stop-loss.
Custom Risk Parameters: Use preset risk percentages or set your own to match your comfort level.
Price Point Flexibility:
Enter your entry and stop price or opt to use the current price and the low of the day.
Interactive Display Settings:
Customizable Interface: Adjust table positions, text size, and color schemes to match your trading dashboard aesthetic.
On-Chart Stop-Loss Indication: Visualize your stop loss on the chart itself.
Get a snapshot of your dollar risk, position size, shares to buy, and stop-loss.
Amols Magic LevelsThis Script showing Levels determined by previous day data. and its open for educational purpose.
IV Squeeze - Sunil Bhave This script calculates both Bollinger Bands and Keltner Channels on a 5-minute chart. It identifies IV squeeze conditions when the lower Bollinger Band is above the lower Keltner Channel and the upper Bollinger Band is below the upper Keltner Channel. When a squeeze is detected, it plots a red triangle below the chart bars and alerts you with a message.
Please note that this script is for educational purposes only.
ADX Combined Strategy IPadx Mmmentume in index options trading.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Label_Trades Enter your trade information to display on chartThis indicator is an overlay for your main chart. It will display your trade entry and trade close positions on your chart.
After you place the indicator on you shart you will need to enter the trade information that you want to display.
You can open thte input setting by clicking on the gear sprocket that appears when you hover your mouse over the indicator name. There are 7 seting you will want to fill in.
Date and Time Bought
Date and Time Sold
Trade Lot Size
Select whether the trades was 'long' or 'short'
The price for buying the Trade
The price for selling the Trade
On the third tab
The code is straightforward. Using a conditional based on whtehr the trade was 'long' or 'short' determines where the labels will be placed and whether they show a long trade or short trade. It also displays a tool tip when you hover over the label. The tooltip will display the number of lots bought or sold and the price.
The lable.new() function is the meat of the indicator. I will go over a line to explainthe options available.
Pinscript manual(www.tradingview.com)
The function parameters can be called out as in the example above or the values can be placed comma seperated. If you do the latter you must enter the parameters in order. I like anming the parameters as I place them so I can easily see what I did.
label.new(
x=t_bot, // x is the time the transaction occured
y=na, // y is the for the y-axis it is not used here so 'na' tells pinescript to ignore the parameter
xloc=xloc.bar_time, // x_loc is specifying that x is a time value
yloc=yloc.belowbar, // y-loc specifies to place the label under the bar. There are other locations to use. See language reference ((www.tradingview.com)
style=label.style_triangleup, // This parameter selects the lable style. There are many other style to use, see the manual.
color=color.green, // the Label fill color
size=size.small, // the label size
tooltip=str.tostring(lot_size) + " lots bought at $" + str.tostring(bot_val)) // Some parameters are tricky. This one needs to be a string but we are using an integer value(lot_size) and a float value(bol_val). They are all concatenated via the "+" sign. In oorder to do this the numeric values need to be cast or converted into strings. The string function str.tostring() does this.
Cynical Cold IndexThis TradingView indicator calculates the Cynical Cold Index, which is a weighted basket of commodity prices designed to track economic conditions. It compares the price of a given asset to the index value.
Weights the commodities as percentages:
Gold: 10%
Oil: 15%
Coffee: 5%
Natural Gas: 10%
Silver: 15%
Sugar: 5%
Corn: 5%
Wheat: 5%
Cotton: 10%
Copper: 10%
Iron Ore: 5%
Live Cattle: 5%
Urea: 5%
How To Input CSV List Of Symbol Data Used For ScreenerExample of how to input multiple symbols at once using a CSV list of ticker IDs. The input list is extracted into individual ticker IDs which are then each used within an example screener function that calculates their rate of change. The results for each of the rate of changes are then plotted.
For code brevity this example only demonstrates using up to 4 symbols, but the logic is annotated to show how it can easily be expanded for use with up to 40 ticker IDs.
The CSV list used for input may contain spaces or no spaces after each comma separator, but whichever format (space or no space) is used must be used consistently throughout the list. If the list contains any invalid symbols the script will display a red exclamation mark that when clicked will display those invalid symbols.
If more than 4 ticker IDs are input then only the first 4 are used. If less than 4 ticker IDs are used then the unused screener calls will return `float(na)`. In the published chart the input list is using only 3 ticker IDs so there are only 3 plots shown instead of 4.
NOTICE: This is an example script and not meant to be used as an actual strategy. By using this script or any portion thereof, you acknowledge that you have read and understood that this is for research purposes only and I am not responsible for any financial losses you may incur by using this script!
Volume Profile - BearJust another Volume Profile but you can fit into your chart better by moving back and forth horizontally. also note you can fix the number of bars to show the volume by that way you can use a fib retracment to line up high/low volume nodes with fib levels... see where price as bad structure. or just play with the colors to make a cool gradient?
Volume Profile is a technical analysis tool used by traders to analyze the distribution of trading volume at different price levels within a specified time frame. It helps traders identify key support and resistance levels, potential areas of price reversals, and areas of high trading interest. Here's how to read Volume Profile on a trading chart:
1. **Choose a Time Frame**: Decide on the time frame you want to analyze. Volume Profile can be applied to various time frames, such as daily, hourly, or even minute charts. The choice depends on your trading style and goals.
2. **Plot the Volume Profile**: Once you have your chart open, add the Volume Profile indicator. Most trading platforms offer this tool. It typically appears as a histogram or a series of horizontal bars alongside the price chart.
3. **Identify Key Elements**:
a. **Value Area**: The Value Area represents the price range where the majority of trading volume occurred. It is often divided into three parts: the Point of Control (POC) and the upper and lower value areas. The POC is the price level where the most trading activity occurred and is considered a significant support or resistance level.
b. **High-Volume Nodes**: High-volume nodes are price levels where there was a significant amount of trading volume. These nodes can act as support or resistance levels because they represent areas where many traders had their positions.
c. **Low-Volume Areas**: Conversely, low-volume areas are price levels with little trading activity. These areas may not provide strong support or resistance because they lack significant trader interest.
4. **Interpretation**:
- If the price is trading above the POC and the upper value area, it suggests bullish sentiment, and these levels may act as support.
- If the price is trading below the POC and the lower value area, it suggests bearish sentiment, and these levels may act as resistance.
- High-volume nodes can also act as support or resistance, depending on the price's current position relative to them.
5. **Confirmation**: Volume Profile should be used in conjunction with other technical analysis tools and indicators to confirm trading decisions. Consider using trendlines, moving averages, or other price patterns to validate your trading strategy.
6. **Adjust for Different Time Frames**: Keep in mind that Volume Profile analysis can yield different results on different time frames. For example, a support level on a daily chart may not hold on a shorter time frame due to intraday volatility.
7. **Practice and Experience**: Like any trading tool, reading Volume Profile requires practice and experience. Analyze historical charts, paper trade, and refine your strategies over time to gain proficiency.
8. **Stay Informed**: Stay updated with market news and events that can impact trading volume. Sudden news can change the significance of volume levels.
High/Low Fibs using Bullish Anchors I do Love me some fibs!!
i used a lot of 30 min Opening Range Fibs for interday trading, but have found that using more bars back can make for stronger levels just like when we use higher time frame to see support & resistant levels.
You can just find high and lows for making an easy auto draw fib retracment, I think you will find these to be fairly accurate or at least just entertaining .
Here are some basics on how to use FIb Retracments
Fibonacci retracement is a popular technical analysis tool used by traders to identify potential levels of support and resistance in financial markets, including stocks. It is based on the Fibonacci sequence, a series of numbers where each number is the sum of the two preceding ones (e.g., 0, 1, 1, 2, 3, 5, 8, 13, 21, ...). The key Fibonacci retracement levels are 23.6%, 38.2%, 50%, 61.8%, and 78.6%. These levels are used to identify potential reversal points or areas of price consolidation. Here's how to use Fibonacci retracement in stock trading:
1. Identify a Significant Price Move:
Start by identifying a significant price move in the stock you are analyzing. This move can be either an uptrend or a downtrend. For uptrends, you'll be measuring from the low point to the high point, and for downtrends, you'll measure from the high point to the low point.
2. Draw Fibonacci Levels: *With this indicator We do this for you
Once you have identified the price move, use a Fibonacci retracement tool available on most trading platforms to draw the retracement levels. Typically, you will draw lines from the low point to the high point for uptrends and vice versa for downtrends.
3. Analyze Key Levels:
Pay attention to the key Fibonacci retracement levels, especially the most commonly used ones, which are 38.2%, 50%, and 61.8%. These levels are considered significant in determining potential support and resistance areas. The 23.6% and 78.6% levels are also used but are considered secondary.
4. Look for Confluence:
Consider other technical analysis tools and indicators to look for confluence at these Fibonacci retracement levels. For example, if a 50% retracement level coincides with a moving average or a trendline, it may strengthen the level's significance.
5. Monitor Price Action:
Watch how the stock's price reacts when it approaches these Fibonacci retracement levels. If the price stalls, reverses direction, or shows signs of consolidation around a particular level, it may act as support or resistance.
6. Set Entry and Exit Points:
Based on your analysis, you can set entry and exit points for your trades. Traders often look for buying opportunities near Fibonacci support levels and selling opportunities near resistance levels. Stop-loss orders can be placed just below support or above resistance levels to manage risk.
7. Practice Risk Management:
Always use proper risk management techniques in your trading. This includes setting stop-loss orders, determining your position size, and not risking more than you can afford to lose on a single trade.
8. Monitor Market Conditions:
Be aware that Fibonacci retracement levels are not foolproof and should be used in conjunction with other analysis methods and market conditions. Market sentiment, news events, and economic factors can also influence stock prices.
9. Continuously Learn and Adapt:
As with any trading strategy, it's essential to continuously learn and adapt. Test the effectiveness of Fibonacci retracement levels on different time frames and with different stocks to refine your trading strategy.
** Special Thanks to @KioseffTrading for doing most all of the HEAVY LIFTING on the code here... he is beyond a Top G!!
Trade Warehouse (SPOT trades)Hello there!
Let's imagine You are trading SPOT, buy more and more every new dump, but bear market is not going to stop... and your first trade was 3 YEARS AGO!!!
Can't believe it is true.
The problem is - exchanges allow You to see only new trades last 6 months(Binance). But I want to see all of them! How do I know AVG Price?
This script is my solution. Just use it to track and store your trade, so You can see AVG without uploading old trades everytime and using calculator.
Script description:
Here You can see the "Trade" type of variable. Python script using Pandas converts trades from .csv file into string type that You can input as trade(price, pair, amount, date..). After it uppends to the trades_array and pushed into the loop.
If trade date is more than current cundle - it pushes new trade to other arrays such a "pair", "avg_tot" etc. to comput it later.
If trade was buy - it increase invested capital and owned amount, opposite for sell and recomputs AVG price.
Since script has at least 1 trade it starts to plot AVG price.
There are 2 AVG price:
1. For total invested counting(You can get negative value if traded successful)
2. Current AVG price since last 0 currency amount(there is dust value to set how many usd we take as dust)
Table represents all assets statistics
Just upload your trades only 1 time, use script to convert it into pine code, and use as indicator. This script allow You to see ALL trades from oldest to the newest.
github.com/Arivadis/...w_Tradings_warehouse
If this script helped You - press Star (on GitHub) Like (on TradingView)
Warning -
Does not include free/earn/withdraw/deposit counting. Only Buy and Sell =>
This script has no idea about your side currency deposits, so if You got Your BTC or EUR or .. from another wallet and sold later - it can break your statistical data. Add this transfer manually(see examples inside script).
Use my github manual to get this script workin.
Installing takes around 3 minutes and contains 3-5 steps
ICT Time Indicator - MinimalisticThis indicator is intended to make backtesting and journaling a lot easier.
This script will automatically plot the sessions you selec.t
You don't have to worry about your timezone because this indicator will automatically handle that.
For best results please don't go any higher than the Hourly.
I aimed to keep this indicator very minimalistic to reduce the 'lipstick' on your chart.
Enabling any of the follow settings will quickly show you on your chart the times you want to be looking at:
Morning Session
Lunch
Afternoon Session
Marco 0950-1010
Marco 1050-1110
Marco 1450-1510
Silver Bullet London Open
Silver Bullet AM
Silver Bullet PM
You can also customize the color of any time session to suite your color scheme.
If you have any requests please leave a comment (I'm sure there are more marcos) :)
ICT True Day Range [MK]The indicator displays the following:
Vertical line day separator from 00:00 to 00:00 EST
High/Low lines for the days true range from 00:00 to EOD
Opening line from 00:00 EST to EOD
Opening line from 08:30 EST to EOD
Weekly Opening line from Sunday open at 18:00 EST to last bar in the week
Monday range high/low/mid line, which can be extended to EOW
Text displaying Days of the Week
All functions can be fully customized regarding color/style and line width.
Below shows image of indicator with day separator: (it didn't show on the main chart despite being enabled?)
All of the above are to be used to give the user all the tools necessary to analyze the following concepts which can be studied on ICTs you tube channel:
Weekly profile, eg, has the weekly manipulated below the weekly open to then rise the rest of the week?
Daily profile, eg, has the day manipulated below the daily open (00:00 EST) to then rise the rest of the day?
Daily liquidity grab, eg has the current day taken PDH/PDL at the start of the current day?
Daily targets, eg will the current day end up taking liquidity from the PDH/PDL?
Monday range, will Mondays high/low range act as the accumulation phase of the weekly AMD profile?
Tuesday/Wednesday/Thursday/Friday reversal, eg, does a day of the week line up with a HTF target and a high volatility news event which could see price reverse after the manipulation phase of the weekly AMD profile?
In strong trending markets, will the 0830 open line be used in the NY session as manipulation reference in the same manner as the 00:00 line is normally used?
The above examples of how the indicator 'could' be used are not the only ways to use the indicator.
The indicator is by no means a trading strategy on its own. Users should be fully aware of ICT concepts and have performed extensive back-testing before using the indicator with live accounts.
Show-BiasThe script looks at the current bar and prints the bullishness or bearishness bias based on the high, low and close values.
Bullish bias:
----------------
Higher High
Higher Low
Higher Close
Green candle
Bearish bias:
----------------
Lower High
Lower Low
Lower Close
Red candle
ATR Trend Reversal Zone indicatorThis indicator helps avoid taking reversal trades too close to the 21 EMA, which may fail since the market often continues its trend after retracing from the 21 EMA level. It does not generate a direct signal for reversal trades but rather indicates points where you can consider potential reversal trades based on your trading methodology
This script defines an indicator that calculates the 21 Exponential Moving Average (EMA) and the Average True Range (ATR) for a given period. It then computes the distance between the most recent closing price and the 21 EMA in terms of ATR units. If this distance is equal to or greater than 3 ATRs, a small green circle is plotted below the corresponding bar on the chart, indicating a potential reversal condition.
Risk Management and Positionsize - MACD exampleMastering Risk Management
Risk management is the cornerstone of successful trading, and it's often the difference between turning a profit and suffering a loss. In light of its importance, I share a risk management tool which you can use for your trading strategies. The script not only assists in position sizing but also comes with built-in technical features that help in market timing. Let's delve into the nitty-gritty details.
Input Parameter: MarginFactor
One of the key features of the script is the MarginFactor input parameter. This element lets you control the portion of your equity used for placing each trade. A MarginFactor of -0.5 means 50% of your total equity will be deployed in placing the position size. Although Tradingview has a built-in option to adjust position sizing in a same way, I personally prefer to have the logic in my pinecode script. The main reason is userexperience in managing and testing different settings for different charts, timeframes and instruments (with the same strategy).
Stoploss and MarginFactor
If your strategy has a 4% stop-loss, you can choose to use only 50% of your equity by setting the MarginFactor to -0.5. In this case, you are effectively risking only 2% of your total capital per trade, which aligns well with the widely-accepted rule of thumb suggesting a 1-2% risk per trade. Similar if your stoploss is only 1% you can choose to change the MarginFactor to 1, resulting in a positionsize of 200% of your equity. The total risk would be again 2% per trade if your stoploss is set to 1%.
Max Drawdown and MarginFactor
Your MarginFactor setting can also be aligned with the maximum drawdown of your strategy, seen during a backtested period of 2-3 years. For example, if the max drawdown is 15%, you could calibrate your MarginFactor accordingly to limit your risk exposure.
Option to Toggle Number of Contracts
The script offers the option to toggle between using a percentage of equity for position sizing or specifying a fixed number of contracts. Utilizing a percentage of equity might yield unrealistic backtest results, especially over longer periods. This occurs because as the capital grows, the absolute position size also increases, potentially inflating the accumulated returns generated by the backtester. On the other hand, setting a fixed number of contracts as your position size offers a more stable and realistic ROI over the backtested period, as it removes the compounding effect on position sizes.
Key Features Strategy
MACD High Time Frame Entry and Exit Logic
The strategy employs a high time frame MACD (Moving Average Convergence Divergence) to make entry and exit decisions. You can easily adjust the timeframe settings and MACD settings in the inputsection to trade on lower timeframes. For more information on the HTF MACD with dynamic smoothing see:
Moving Average High Time Frame Filter
To reduce market 'noise', the strategy incorporates a high time frame moving average filter. This ensures that the trades are aligned with the dominant market trend (trading the trend). In the inputsection traders can easily switch between different type of moving averages. For more information about this HTF filter see:
Dynamic Smoothing
The script includes a feature for dynamic smoothing. The script contains The timeframeToMinutes(tf) function to convert any given time frame into its equivalent in minutes. For example, a daily (D) time frame is converted into 1440 minutes, a weekly (W) into 10,080 minutes, and so forth. Next the smoothing factor is calculated by dividing the minutes of the higher time frame by those of the current time frame. Finally, the script applies a Simple Moving Average (SMA) over the MACD, SIGNAL, and HIST values, MA filter using the dynamically calculated smoothing factor.
User Convenience: One of the major benefits is that traders don't need to manually adjust the smoothing factor when switching between different time frames. The script does this dynamically.
Visual Consistency: Dynamic smoothing helps traders to more accurately visualize and interpret HTF indicators when trading on lower time frames.
Time Frame Restriction: It's crucial to note that the operational time frame should always be lower than the time frame selected in the input sections for dynamic smoothing to function as intended.
By incorporating this dynamic smoothing logic, the script offers traders a nuanced yet straightforward way to adapt High Time Frame indicators for lower time frame trading, enhancing both adaptability and user experience.
Limitations: Exit Strategy
It's crucial to note that the script comes with a simplified exit strategy, devoid of features like a stop-loss, trailing stop-loss or multiple take profits. This means that while the script focuses on entries and risk management, it might result in higher losses if market conditions unexpectedly turn unfavorable.
Conclusion
Effective risk management is pivotal for trading success, and this TradingView script is designed to give you a better idea how to implement positions sizing with your preferred strategy. However, it's essential to note that this tool should not be considered financial advice. Always perform your due diligence and consult with financial advisors before making any trading decisions.
Feel free to use this risk management tool as building block in your trading scripts, Happy Trading!
Personal Trading Hours (timezone Europe/Amsterdam)This Personal Trading Hours indicator is intended to specify the times you can trade and make them visible on the chart. Multiple sessions can be specified per specific day of the week and you can give each day its own color if you want.
This can be used perfectly if you are backtesting your strategy manually. You can indicate exactly when you have time to look at the charts and therefore only perform your backtest at those times. Making mistakes that you open en close trades during your sleeptime or worktime in your backtest are gone.
But this indicator is also suitable for live trading.
Filter out the times when you don't want to trade, for example during lunchtime, during opening hours of the exchanges or when you know that big news events will take place during your tradingweek. All the timesessions you do want to trade you can make visible on you chart.
The timezone that is used for this indicator is the timezone: Europe/Amsterdam and therefor only usable for traders in this timezone.
You can use this indicator for timeframes lower then the Daily timeframe with the normal settings. If you want to use this indicator on the Daily timeframe, all the settings in the upper part of the settingsmenu must be unchecked and only the part at the bottom of the settingsmenu can then be used.
This indicator doesn't work on timeframes higher than the Daily timeframe.
If you do not use all the tradingsessions on each day, you have to make sure that all the boxes are filled. So unused session boxes must have the same timeperiodes as the used boxes, otherwise the whole day will be highlighted on the chart.
Machine Learning: Trend Pulse⚠️❗ Important Limitations: Due to the way this script is designed, it operates specifically under certain conditions:
Stocks & Forex : Only compatible with timeframes of 8 hours and above ⏰
Crypto : Only works with timeframes starting from 4 hours and higher ⏰
❗Please note that the script will not work on lower timeframes.❗
Feature Extraction : It begins by identifying a window of past price changes. Think of this as capturing the "mood" of the market over a certain period.
Distance Calculation : For each historical data point, it computes a distance to the current window. This distance measures how similar past and present market conditions are. The smaller the distance, the more similar they are.
Neighbor Selection : From these, it selects 'k' closest neighbors. The variable 'k' is a user-defined parameter indicating how many of the closest historical points to consider.
Price Estimation : It then takes the average price of these 'k' neighbors to generate a forecast for the next stock price.
Z-Score Scaling: Lastly, this forecast is normalized using the Z-score to make it more robust and comparable over time.
Inputs:
histCap (Historical Cap) : histCap limits the number of past bars the script will consider. Think of it as setting the "memory" of model—how far back in time it should look.
sampleSpeed (Sampling Rate) : sampleSpeed is like a time-saving shortcut, allowing the script to skip bars and only sample data points at certain intervals. This makes the process faster but could potentially miss some nuances in the data.
winSpan (Window Size) : This is the size of the "snapshot" of market data the script will look at each time. The window size sets how many bars the algorithm will include when it's measuring how "similar" the current market conditions are to past conditions.
All these variables help to simplify and streamline the k-NN model, making it workable within limitations. You could see them as tuning knobs, letting you balance between computational efficiency and predictive accuracy.
Price Variation and Projection IndicatorThis indicator calculates and visualizes various aspects of price variation and projection based on certain parameters such as rate of change, time interval, constant value, and more. It helps traders understand potential price movements and provides insights into potential support and resistance levels.
The indicator displays the following information:
Resistance and support levels based on the highest and lowest prices over a specified period.
∆P (Price Variation) calculated between two high oscillations.
∆t (Time Variation) calculated between two high oscillations.
Price variation rate.
Price projections based on rate of change and the most occurred variation.
Additionally, parallel lines are drawn to illustrate projected price ranges, and the most frequent ∆P value is shown for reference.
in short the indicator does it projects possible support and resistance for you to add a mark for example you see that it gave a projection you mark it on the chart with horizontal line or horizontal ray you can configure it by Period or by ∆t calculation limit au increase the period it will increase the projection of all targets interesting periods to use 20 50 80 120 200 since the ∆t calculation limit au decrease increases the projection in the Price projection that is showing the information in blue color when increasing it decreases the projection target ∆t calculation interesting limit to use 3 4 6 7 8 9
it works for all timeframes can be used for Swing trade or day trade
use I like to use it with a closed market that helps me to trace possible support and resistance can be used with open market as well
Choose your preferred language to display the information
Please note that this indicator is designed for educational and informational purposes. Always conduct your own analysis and consider risk management strategies before making trading decisions.