Four WMA Strategy with TP and SLBasically I read a research paper on how they used different moving averages for long entries and short entries, and it kind of dawned on me that I always used the same one for long entry or exit, or even swing trading. So I smashed this together to see what would happen.
The strategy combines the use of four different WMAs for identifying trade entry points, along with a predefined take profit (TP) and stop loss (SL) for risk management. Here's a detailed description of its features and how it operates:
Main Features
1. **WMAs as the Core Indicator**:
- The strategy uses four WMAs with different lengths. Two WMAs (`longM1` and `longM2`) are used for long entry signals, and the other two (`shortM1` and `shortM2`) for short entry signals.
- The lengths of these WMAs are adjustable through input parameters.
2. **Trade Entry Conditions**:
- A long entry is signaled when the shorter WMA crosses under the longer WMA .
- Conversely, a short entry is signaled when the shorter WMA crosses under the longer WMA.
3. **Take Profit and Stop Loss**:
- The strategy includes a take profit and stop loss mechanism.
- The TP and SL levels are set as a percentage of the entry price, with the percentage values being adjustable through input parameters.
4. **Visual Representation**:
- The WMAs are plotted on the chart for visual aid, each with a distinct color for easy identification.
How It Works
- The strategy continuously monitors the crossing of WMAs to detect potential entry points for long and short positions.
- Upon detecting a long or short condition, it automatically enters a trade and sets the corresponding TP and SL levels based on the current price and the specified percentages.
- The strategy then actively manages the trade, exiting the position when either the TP or SL level is reached.
Drawbacks
- **Overreliance on WMAs**: The strategy heavily relies on WMAs for trade signals. While WMAs are useful for identifying trends, they might not always provide timely entry and exit signals.
- **Market Conditions**: It may not perform well in highly volatile or sideways markets where WMA crossovers could lead to false signals.
- **Risk Management**: The fixed percentage for TP and SL might not be suitable for all market conditions. Traders might need to adjust these values frequently based on market volatility and their risk tolerance.
Apparently I need to emphasize to use brains when using indicators and setting them up to achieve the results you can or want. Also risk of 12% is considered very high so I lowered the numbers to 5%, which tanked the profits, try adjusting them on your own. Check the properties settings for more info on comission and slippage.
Conclusion
The "Four WMA Strategy with TP and SL" is suitable for traders who prefer a moving average-based approach to trading, combined with a straightforward mechanism for risk management through take profit and stop loss. However, like all strategies, it should be used with an understanding of its limitations and ideally tested thoroughly in various market conditions before applying it to live trading.
Rata-Rata Pergerakan / Moving Averages
Risk Metric combinedAttempt at replicating a simplified Risk-Metric for BTC.
Original code written by user Oakley Wood.
Based on 3 different approaches:
- deviation from 4 year sma
- ln(btc / 20 wma)
- 50D MA / 50W MA
Qullamaggie ADR and Volatility and Price Change IndicatorElevate your trading strategy with Qullamaggie ADR, a dynamic indicator inspired by the Kristjan Qullamaggie trading approach. Gain a deeper understanding of market dynamics, daily price movements, and potential turning points.
Key Features:
Qullamaggie ADR: Assess market volatility through the QullaADR, offering customizable time intervals (5, 10, 15, 20 days) to adapt to various trading styles.
Today's Change: Monitor price changes relative to the low of the current trading day, providing valuable intraday insights.
PrevDay price differentials from the previous day's low, aiding in the identification of potential trend reversals.
Track the percentage change from the opening price, offering a snapshot of intraday market sentiment.
Percent from 10-day SMA: Visualize the percentage difference between the closing price and a 10-day Simple Moving Average (SMA), a key trend-following indicator.
Usage:
Utilize QullaADR to set realistic profit targets and stop-loss levels based on current market conditions.
Identify potential trend shifts by observing changes from the previous day's low with Today's QullaChange.
Incorporate QullaPercent from 10-day SMA for trend confirmation and well-informed trading decisions.
Strategy Inspiration:
QullaADR draws inspiration from the Kristjan Qullamaggie trading strategy, aiming to complement your trading toolkit and enhance decision-making.
Disclaimer:
Trading involves risk, and past performance is not indicative of future results. Use this indicator as a supplementary tool within a comprehensive trading strategy.
Version: 1.0
LYFX-GOLD-15MIndicator Operation Method:
The indicator provides a buy signal when the price stabilizes above the moving averages. It should be close to the averages at the same time to ensure a close stop loss.
When the conditions are met, a long trade is opened, and the buy signal appears on the indicator. The stop loss is placed with the red line, and the targets are indicated with the blue balloons. Usually, the first target is twice the stop loss, and the second target is three times the stop loss.
This indicator is one of the most powerful indicators for monitoring price explosions in gold.
For clarification, this indicator is used (according to its default settings) exclusively for gold and only on the 15-minute timeframe. The indicator is created by Mr. Layth Al-Muhandis:
The indicator provides a very close stop loss compared to the first and second targets. I recommend adhering strictly to the stop loss and securing the trade after achieving profits.
This is a simple explanation of how the indicator works.
طريقة عمل المؤشر:
يوفر المؤشر إشارة شراء عند استقرار السعر فوق المتوسطات المتحركة. يجب أن يكون السعر قريبًا من المتوسطات في نفس الوقت لضمان وجود استوب لوس قريب.
عند تحقيق الشروط، يتم فتح صفقة شراء، وتظهر إشارة الشراء على المؤشر. يتم وضع الاستوب لوس بالخط الأحمر، وتوضح البالونات الزرقاء الأهداف. عادةً، يكون الهدف الأول ضعف الاستوب لوس، والهدف الثاني ثلاثة أضعاف الاستوب.
هذا المؤشر من بين أقوى المؤشرات لرصد انفجارات الأسعار في الذهب.
للتنويه، يُستخدم هذا المؤشر (وفقًا لإعداداته الافتراضية) حصريًا للذهب وعلى فاصل زمني 15 دقيقة فقط. تم إنشاء المؤشر بواسطة السيد ليث المهندس.
يوفر المؤشر استوب لوس قريب جداً مقارنة بالهدف الأول والهدف الثاني. أنصح بالالتزام الصارم بالاستوب لوس وتأمين الصفقة بعد تحقيق الأرباح.
Multi MAs mit LabelA MA (Moving Average) is useful to identify a trend of an assets. The TradingView builtin indicator "Exponential Moving Average" is useful, but limited in some aspects:
Bound to the active timeframe (e.g. h1)
One MA per indicator instance. Makes it confusing when using multiple
In reality to want to have multiple MAs with different types (EMA, SMA), length and timeframes on your chart to identify trading opportunities. As an example you can use the daily EMA12 and EMA21 to identify the trend and EMA200 on the h4 to enter a trade. That's what this script is used for.
The provided script is an extension to the indicator powered by chipmonk (link to profile below). The original script let you add up to 8 EMAs that can be bound to any timeframe and length. The timeframe and length is displayed on the chart next to EMA.
Unfortunately you can only add EMAs (Exponential Moving Averages) and no SMAs (Simple Moving Averages). That's why the script was extended. You can now choose the type (EMA or SMA) for up to 8 MAs.
Links
Profile of chipmonk
Indicator by chipmonk
Simple Volume-Based Support & Resistance IndicatorWelcome to my open-source indicator that uses trading volume and market trends to identify potential support and resistance levels. This tool is great for seeing where the price might pause or reverse, helping you make more informed trading decisions.
Why You'll Love This Indicator:
Volume Awareness: It looks at how much trading is happening to better predict support (where the price might stop falling) and resistance (where the price might stop rising).
Trend Tracking: The indicator uses the market's ups and downs to refine these support and resistance areas.
Easy to Read: We've made the lines and zones clear and simple to understand, so you can focus on what matters.
How to Use This Tool:
No complicated settings needed! Since it's open-source, feel free to explore the code and tweak it if you like.
The chart will show support zones in green and resistance zones in red. These are your clues for potential price turns.
The Open-Source Advantage:
This script is completely open for you to use, modify, and share. I believe in community-driven improvements, so dive into the code, see how it works, and if you've got a knack for coding, you can even make it better!
Understanding the Chart:
You'll see the support and resistance levels dynamically drawn on your chart. Green shades are where the price might bounce up, and red shades indicate where it might bounce down.
This indicator is my way of giving back to the trading community. By sharing it openly, I hope we can all help improve it and learn from each other. Happy trading!
Trend Change IndicatorThe Trend Change Indicator is an all-in-one, user-friendly trend-following tool designed to identify bullish and bearish trends in asset prices. It features adjustable input values and a built-in alert system that promptly notifies investors of potential shifts in both short-term and long-term price trends. This alert system is crucial for helping less active investors correctly position themselves ahead of major trend shifts and assists in risk management after a trend is established. It's important to note that this indicator is most effective with assets that historically exhibit strong trends.
At the heart of this tool is the interaction between the 30-day and 60-day Exponential Moving Averages (EMA). A bullish trend is indicated in green when the 30-day EMA is above the 60-day EMA, while a bearish trend is signaled in red when the 30-day EMA is below the 60-day EMA. The appearance of gray alerts users to potential shifts in the current trend as the EMAs converge, falling below the Average True Range (ATR) safety margin. This analysis is conducted across both hourly and daily timeframes, with the 4-hour timeframe providing early signals for daily trend changes. The band visually represents the interaction between the daily EMAs and is also displayed in the second row of the table, with the first row showing the same EMA interaction on the 4-hour timeframe.
This indicator also includes a 140-day (20-week) Simple Moving Average (SMA), visually represented by a line with predictive dots. This feature significantly enhances the investor's ability to understand long-term trends in asset prices, offering forward-looking insights by projecting the SMA value 10 days into the future. The value of this forecast lies in interpreting the slope of the dots; upward trending dots suggest a bullish underlying trend, while downward trending dots indicate a bearish trend. Generally, prices above the SMA signal bullishness, and prices below indicate bearishness.
In summary, the Trend Change Indicator is a comprehensive solution for identifying price trends and managing risk. Its intuitive, color-coded design makes it an indispensable tool for traders and investors who aim to be well-positioned ahead of trend shifts and manage risk once a trend has been established. While it has proven historically valuable in trending markets such as cryptocurrencies, tech stocks, and commodities, it is advisable to use this indicator in conjunction with other technical analysis tools for a more comprehensive and well-rounded decision-making process.
MoonFlag BTC Daily Swing PredictorThis script mainly works on BTC on the daily timeframe. Other coins also show similar usefulness with this script however, BTC on the daily timeframe is the main design for this script.
(Please note this is not trading advice this is just comments about how this indicator works.)
This script is predictive. It colors the background yellow when the script calculates a large BTC swing is potentially about to happen. It does not predict in which direction the swing will occur but it leads the price action so can be useful for leveraged trades. When the background gets colored with vertical yellow lines - this shows that a largish price swing is probably going to occur.
The scripts also shades bands around the price action that are used to estimate an acceptable volatility at any given time. If the bands are wide that means price action is volatile and large swings are not easily predicted. Over time, with reducing volatility, these price action bands narrow and then at a set point or percentage (%) which can be set in the script settings, the background gets colored yellow. This indicates present price action is not volatile and a large price swing is potentially going to happen in the near future. When price action breaks through the narrowing bands, the background is no longer presented because this is seen as an increase in volatility and a considerable portion of the time, a large sudden drop in price action or momentous gain in price is realized.
This indicator leads price action. It predicts that a swing is possibly going to happen in the near future. As the indicator works on the BTC daily, this means on a day-to-day basis if the bands continually narrow - a breakout is more likely to happen. In order to see how well this indicator works, have a look at the results on the screenshot provided. Note the regions where vertical yellow lines are present on the price action - and then look after these to see if a sizeable swing in price has occurred.
To use this indicator - wait until yellow vertical lines are presented on the BTC daily. Then use your experience to determine which way the price action might swing and consider entering a trade or leveraged trade in this direction. Alternatively wait a while to see in which direction the break-out occurs and considering and attempt to trade with this. Sometimes swings can be unexpected and breakout in one direction before then swinging much larger in the other. Its important to remember/consider that this indicator works on the BTC daily timeframe, so any consideration of entering a trade should be expected to cover a duration over many days or weeks, or possibly months. A large swing is only estimated every several plus months.
Most indicators are based on moving averages. A moving average is not predictive in the sense in that it lags price actions. This indicator creates bands that are based on the momentum of the price action. A change in momentum of price action therefore causes the bands to widen. When the bands narrow this means that the momentum of the price action is steady and price action volatility has converged/reduced over time. With BTC this generally means that a large swing in price action is going to occur as momentum in price action then pick-up again in one direction or another. Trying to view this using moving averages is not easy as a moving average lags price action which means that it is difficult to predict any sudden movements in price action ahead of when they might occur. Although, moving averages will converge over time in a similar manner as the bands calculated by this script. This script however, uses the price action momentum in a predictive manner to estimate where the price action might go based on present price momentum. This script therefore reacts to reduced volatility in price action much faster than a set of moving averages over various timescales can achieve.
MoonFlag
Golden Cross and Death Cross with ProbabilityThe Advanced Golden and Death Crossover Indicator offers traders a powerful tool for identifying potential buy and sell signals through the classic technical analysis method of moving average crossovers. This script enhances decision-making by dynamically changing the chart background color in response to Golden (bullish) and Death (bearish) crossovers, providing a visual representation of the market's momentum.
Features:
Golden and Death Crossover Detection: Utilizes a 50-period SMA and a 200-period SMA to identify potential buy (golden cross) and sell (death cross) points.
Continuous Background Coloring: Changes the chart's background color to green for golden crosses and red for death crosses, offering an intuitive grasp of market trends.
Customizable Lookback Period: Allows users to adjust the lookback period for calculating the success rate of each crossover, making the indicator adaptable to various trading strategies.
Success Rate Calculation: Provides an additional layer of analysis by calculating the historical success rate of crossovers within the specified lookback period.
Instructions:
Adding the Indicator: Search for "Advanced Golden and Death Crossover Indicator" in the TradingView Indicators & Strategies library and add it to your chart.
Customization: Access the indicator settings to adjust the lookback period according to your trading preferences.
Interpretation: Use the continuous background color as a guide to market conditions, with green indicating bullish momentum and red indicating bearish momentum. The success rate of past crossovers can help assess the reliability of the signals.
How the Script Works:
The Advanced Golden and Death Crossover Indicator operates by continuously monitoring two key moving averages (MAs) on your chart: a short-term (50-period) SMA and a long-term (200-period) SMA. Here's a step-by-step breakdown of its functionality:
Crossover Detection:
Golden Cross: When the short-term MA crosses above the long-term MA, indicating potential bullish momentum, the script identifies this as a Golden Cross signal.
Death Cross: Conversely, when the short-term MA crosses below the long-term MA, suggesting potential bearish momentum, the script flags this as a Death Cross signal.
Background Coloring:
Upon detecting a Golden Cross, the script changes the chart background to green, visually representing a bullish market condition.
Upon detecting a Death Cross, the chart background turns red, indicating bearish market conditions.
This color change remains in effect until the next crossover event, providing a continuous visual cue of the market's trend direction.
Success Rate Calculation:
The script calculates the historical success rate of these crossovers within a user-defined lookback period. This metric helps assess the reliability of the signals based on past performance.
Customization:
Users have the flexibility to adjust the lookback period for the success rate calculation, allowing for customization according to individual trading strategies and risk preferences.
Application in Trading Analysis:
Traders can use this indicator as part of their technical analysis toolkit to make informed decisions about entry and exit points. The visual cues from the continuous background coloring, combined with the success rate of past signals, provide a comprehensive overview of market trends and crossover reliability. It’s important for traders to combine this indicator with other analysis tools and consider broader market conditions to optimize their trading strategy.
Disclaimer:
This script is provided for educational and informational purposes only and should not be construed as investment advice. Trading involves risk, and you should conduct your own research or consult a financial advisor before making investment decisions. The author or distributor of this script bears no responsibility for any trading losses incurred by users.
Custom Dual SMADescription
The Custom Dual SMA Indicator is designed for traders who wish to track and compare the moving averages of two different financial instruments simultaneously on the same chart, usually if there is correlation between to different asset such as TQQQ vs SQQQ. This indicator is particularly useful for those who engage in comparative analysis or pairs trading strategies.
Features
Dual Ticker Input: Users can input any two ticker symbols (e.g., stocks, currencies, commodities) to analyze. This flexibility allows for a broad range of comparative analyses across different markets or sectors.
Customizable SMA Length: The indicator provides the option to set the length of the SMA for each ticker symbol independently. This feature is critical for traders who wish to analyze the moving averages over different time periods, depending on their trading strategy or the specific characteristics of the instruments being analyzed.
Overlay on Price Chart: The calculated SMAs are overlaid directly on the price chart, enabling users to easily visualize how the moving averages of the two instruments move in relation to each other and to their respective price actions.
Color-Coded for Clarity: Each SMA is plotted in a different color (red and blue by default), ensuring clear differentiation and easy interpretation at a glance.
Use Case
This indicator is particularly beneficial for:
Comparative Analysis: Traders can compare the performance and trends of two different instruments, observing how their moving averages converge or diverge over time.
Pairs Trading: Those involved in pairs trading can use this tool to identify potential entry and exit points by analyzing the moving averages of two correlated or inversely correlated instruments.
Diversification Analysis: Investors looking to diversify their portfolio can use this indicator to understand the moving average trends of various instruments, helping them make informed decisions about asset allocation.
Summary
The Custom Dual SMA Indicator is a versatile tool for traders and investors who require a comparative view of the moving averages of two different instruments on the same chart. Its customizable nature and ease of use make it suitable for a wide range of trading strategies and market analyses.
PKJ StrategyWelcome to the Daily Price Action Mastery Strategy, a powerful approach to navigating the financial markets using the purest form of market analysis – price action. This trading view strategy is meticulously crafted for those seeking a method that harnesses the daily price movements to make informed and strategic trading decisions.
Key Features:
Daily Candlestick Analysis: Dive into the daily candlestick patterns to identify key support and resistance levels, trend reversals, and potential breakout points. The strategy leverages the valuable information encapsulated in each day's price action to discern market sentiment.
Trend Identification: Utilize trend analysis tools and indicators to pinpoint the prevailing market direction. By understanding the dynamics of daily trends, traders can align their positions with the broader market movement for higher probability trades.
Dynamic Support and Resistance: Implement dynamic support and resistance levels derived from daily price action. These levels act as crucial markers for entry and exit points, helping traders set effective stop-loss and take-profit orders.
Chart Patterns Recognition: Uncover chart patterns such as head and shoulders, flags, and triangles on the daily timeframe. The strategy incorporates pattern recognition techniques to identify potential trend continuation or reversal scenarios, offering traders a comprehensive view of market dynamics.
Volatility Analysis: Gauge market volatility by studying daily price ranges and fluctuations. Volatility indicators are integrated to help traders adjust their risk management strategies in response to varying market conditions.
Confirmation through Indicators: Supplement price action analysis with carefully selected indicators for additional confirmation signals. These indicators are chosen to align with the philosophy of the Daily Price Action Mastery Strategy, enhancing the precision of trade entries and exits.
Risk Management Guidelines: Discover effective risk management practices tailored to the daily timeframe. Learn how to optimize position sizes, set appropriate stop-loss levels, and manage capital to ensure long-term success and sustainability in your trading journey.
Whether you are a seasoned trader or a newcomer to the markets, the Daily Price Action Mastery Strategy provides a comprehensive framework to navigate the complexities of daily price movements. Elevate your trading experience by incorporating this strategy into your analysis, and empower yourself to make well-informed decisions in the dynamic world of finance.
FlexiMA x FlexiST - Strategy [presentTrading]█ Introduction and How it is Different
The FlexiMA x FlexiST Strategy blends two analytical methods - FlexiMA and FlexiST, which are opened in my early post.
- FlexiMA calculates deviations between an indicator source and a dynamic moving average, controlled by a starting factor and increment factor.
- FlexiST, on the other hand, leverages the SuperTrend model, adjusting the Average True Range (ATR) length for a comprehensive trend-following oscillator.
This synergy offers traders a more nuanced and multifaceted tool for market analysis.
BTC 6H L/S Performance
Local
█ Strategy, How It Works: Detailed Explanation
The strategy combines two components: FlexiMA and FlexiST, each utilizing unique methodologies to analyze market trends.
🔶FlexiMA Component:
- Calculates deviations between an indicator source and moving averages of variable lengths.
- Moving average lengths are dynamically adjusted using a starting factor and increment factor.
- Deviations are normalized and analyzed to produce median and standard deviation values, forming the FlexiMA oscillator.
Length indicator (50)
🔶FlexiST Component:
- Uses SuperTrend indicators with varying ATR (Average True Range) lengths.
- Trends are identified based on the position of the indicator source relative to the SuperTrend bands.
- Deviations between the indicator source and SuperTrend values are calculated and normalized.
Starting Factor (5)
🔶Combined Strategy Logic:
- Entry Signals:
- Long Entry: Triggered when median values of both FlexiMA and FlexiST are positive.
- Short Entry: Triggered when median values of both FlexiMA and FlexiST are negative.
- Exit Signals:
- Long Exit: Triggered when median values of FlexiMA or FlexiST turn negative.
- Short Exit: Triggered when median values of FlexiMA or FlexiST turn positive.
This strategic blend of FlexiMA and FlexiST allows for a nuanced analysis of market trends, providing traders with signals based on a comprehensive view of market momentum and trend strength.
█ Trade Direction
The strategy is designed to cater to various trading preferences, offering "Long", "Short", and "Both" options. This flexibility allows traders to align the strategy with their specific market outlook, be it bullish, bearish, or a combination of both.
█ Usage
Traders can effectively utilize the FlexiMA x FlexiST Strategy by first selecting their desired trade direction. The strategy then generates entry signals when the conditions for either the FlexiMA or FlexiST are met, indicating potential entry points in the market. Conversely, exit signals are generated when the conditions for these indicators diverge, thus signaling a potential shift in market trends and suggesting a strategic exit point.
█ Default Settings
1. Indicator Source (HLC3): Provides a balanced and stable price source, reducing the impact of extreme market fluctuations.
2. Indicator Lengths (20 for FlexiMA, 10 for FlexiST): Longer FlexiMA length smooths out short-term fluctuations, while shorter FlexiST length allows for quicker response to market changes.
3. Starting Factors (1.0 for FlexiMA, 0.618 for FlexiST): Balanced start for FlexiMA and a harmonized approach for FlexiST, resonating with natural market cycles.
4. Increment Factors (1.0 for FlexiMA, 0.382 for FlexiST): FlexiMA captures a wide range of market behaviors, while FlexiST provides a gradual transition to capture finer trend shifts.
5. Normalization Methods ('None'): Uses raw deviations, suitable for markets where absolute price movements are more significant.
6. Trade Direction ('Both'): Allows strategy to consider both long and short opportunities, ideal for versatile market engagement.
*More details:
1. FlexiMA
2. FlexiST
EMA + Lower Timeframe EMA (correct display in Replay Mode)This indicator shows
one EMA for the current timeframe
one EMA for a lower timeframe
Unlike the built-in Tradingview EMA indicator, this indicator shows the correct values for the lower timeframe EMA during Replay Mode.
[MAD] Acceleration based dampened SMA projectionsThis indicator utilizes concepts of arrays inside arrays to calculate and display projections of multiple Smoothed Moving Average (SMA) lines via polylines.
This is partly an experiment as an educational post, on how to work with multidimensional arrays by using User-Defined Types
------------------
Input Controls for User Interaction:
The indicator provides several input controls, allowing users to adjust parameters like the SMA window, acceleration window, and dampening factors.
This flexibility lets users customize the behavior and appearance of the indicator to fit their analysis needs.
sma length:
Defines the length of the simple moving average (SMA).
acceleration window:
Sets the window size for calculating the acceleration of the SMA.
Input Series:
Selects the input source for calculating the SMA (typically the closing price).
Offset:
Determines the offset for the input source, affecting the positioning of the SMA. Here it´s possible to add external indicators like bollinger bands,.. in that case as double sma this sma should be very short.
(Thanks Fikira for that idea)
Startfactor dampening:
Initial dampening factor for the polynomial curve projections, influencing their starting curvature.
Growfactor dampening:
Growth rate of the dampening factor, affecting how the curvature of the projections changes over time.
Prediction length:
Sets the length of the projected polylines, extending beyond the current bar.
cleanup history:
Boolean input to control whether to clear the previous polyline projections before drawing new ones.
Key technologies used in this indicator include:
User-Defined Types (UDT) :
This indicator uses UDT to create a custom type named type_polypaths.
This type is designed to store information for each polyline, including an array of points (array), a color for the polyline, and a dampening factor.
UDTs in Pine Script enable the creation of complex data structures, which are essential for organizing and manipulating data efficiently.
type type_polypaths
array polyline_points = na
color polyline_color = na
float dampening_factor= na
Arrays and Nested Arrays:
The script heavily utilizes arrays.
For example, it uses a color array (colorpreset) to store different colors for the polyline.
Moreover, an array of type_polypaths (polypaths) is used, which is an array consisting of user-defined types. Each element of this array contains another array (polyline_points), demonstrating nested array usage.
This structure is essential for handling multiple polylines, each with its set of points and attributes.
var type_polypaths polypaths = array.new()
Polyline Creation and Manipulation:
The core visual aspect of the indicator is the creation of polylines.
Polyline points are calculated based on a dampened polynomial curve, which is influenced by the SMA's slope and acceleration.
Filling initial dampening data
array_size = 9
middle_index = math.floor(array_size / 2)
for i = 0 to array_size - 1
damp_factor = f_calculate_damp_factor(i, middle_index, Startfactor, Growfactor)
polyline_color = colorpreset.get(i)
polypaths.push(type_polypaths.new(array.new(0, na), polyline_color, damp_factor))
The script dynamically generates these polyline points and stores them in the polyline_points array of each type_polypaths instance based on those prefilled dampening factors
if barstate.islast or cleanup == false
for damp_factor_index = 0 to polypaths.size() - 1
GET_RW = polypaths.get(damp_factor_index)
GET_RW.polyline_points.clear()
for i = 0 to predictionlength
y = f_dampened_poly_curve(bar_index + i , src_input , sma_slope , sma_acceleration , GET_RW.dampening_factor)
p = chart.point.from_index(bar_index + i - src_off, y)
GET_RW.polyline_points.push(p)
polypaths.set(damp_factor_index, GET_RW)
Polyline Drawout
The polyline is then drawn on the chart using the polyline.new() function, which uses these points and additional attributes like color and width.
for pl_s = 0 to polypaths.size() - 1
GET_RO = polypaths.get(pl_s)
polyline.new(points = GET_RO.polyline_points, line_width = 1, line_color = GET_RO.polyline_color, xloc = xloc.bar_index)
If the cleanup input is enabled, existing polylines are deleted before new ones are drawn, maintaining clarity and accuracy in the visualization.
if cleanup
for pl_delete in polyline.all
pl_delete.delete()
------------------
The mathematics
in the (ABDP) indicator primarily focuses on projecting the behavior of a Smoothed Moving Average (SMA) based on its current trend and acceleration.
SMA Calculation:
The indicator computes a simple moving average (SMA) over a specified window (sma_window). This SMA serves as the baseline for further calculations.
Slope and Acceleration Analysis:
It calculates the slope of the SMA by subtracting the current SMA value from its previous value. Additionally, it computes the SMA's acceleration by evaluating the sum of differences between consecutive SMA values over an acceleration window (acceleration_window). This acceleration represents the rate of change of the SMA's slope.
sma_slope = src_input - src_input
sma_acceleration = sma_acceleration_sum_calc(src_input, acceleration_window) / acceleration_window
sma_acceleration_sum_calc(src, window) =>
sum = 0.0
for i = 0 to window - 1
if not na(src )
sum := sum + src - 2 * src + src
sum
Dampening Factors:
Custom dampening factors for each polyline, which are based on the user-defined starting and growth factors (Startfactor, Growfactor).
These factors adjust the curvature of the projected polylines, simulating various future scenarios of SMA movement.
f_calculate_damp_factor(index, middle, start_factor, growth_factor) =>
start_factor + (index - middle) * growth_factor
Polynomial Curve Projection:
Using the SMA value, its slope, acceleration, and dampening factors, the script calculates points for polynomial curves. These curves represent potential future paths of the SMA, factoring in its current direction and rate of change.
f_dampened_poly_curve(index, initial_value, initial_slope, acceleration, damp_factor) =>
delta = index - bar_index
initial_value + initial_slope * delta + 0.5 * damp_factor * acceleration * delta * delta
damp_factor = f_calculate_damp_factor(i, middle_index, Startfactor, Growfactor)
Have fun trading :-)
SMIIO + VolumeThis indicator generates long and short signals.
The operation of the indicator is as follows;
First, true strength index is calculated with closing prices. We call this the "ergodic" curve.
Then the average of the ergodic (ema) is calculated to obtain the "signal" curve.
To calculate the "oscillator", the signal is subtracted from ergodic (oscillator = ergodic - signal).
The last variable to be used in the calculation is the average volume, calculated with sma.
Calculation for long signal;
- If the ergodic curve cross up the zero line (ergodic > 0 AND ergodic < 0) and,
- If the current oscillator is greater than the previous oscillator (oscillator > oscillator ) and,
- If the current ergonic is greater than the previous signal (ergonic > signal) and,
- If the current volume is greater than the average volume (volume > averageVolume) and,
- If the current candle closing price is greater than the opening price (close > open)
If all the above conditions are fullfilled, the long input signal is issued with "Buy" label.
Calculation for short signal;
- If the ergodic curve cross down the zero line (ergodic < 0 AND ergodic > 0) and,
- If the current oscillator is smaller than the previous oscillator (oscillator < oscillator ) and,
- If the current ergonic is smaller than the previous signal (ergonic < signal) and,
- If the current volume is greater than the average volume (volume > averageVolume) and,
- If the current candle closing price is smaller than the opening price (close < open)
If all the above conditions are fullfilled, the short input signal is issued with "Sell" label.
Osmosis [ChartPrime]Osmosis is a multi indicator, multi period heatmap. Lookback periods can be mysterious as it can tend to seem very arbitrary. This tool allows users to see how price/volume reacts to short to long periods by visualizing all of the periods at the same time. This is useful because small periods are only good for short term movements while long periods are useful for long term movements. This more detailed view of market trends is analogues of multi time frame analysis. The lookback periods are arranged from bottom up, where the bottom of the indicator is the shortest period while the top is the longest period.
One major feature of this indicator is its ability to signal potential trend reversals. For example, a shift in the direction at the lower end of the heatmap can indicate a weakening of the current trend, suggesting a possible reversal. On the other hand, when the heatmap is fully saturated at all levels, it may indicate a strong trend that could be nearing a reversal point.
Another important and unique aspect of the Osmosis indicator is its automatic highlighting feature. This feature emphasizes regions within the heatmap that score exceptionally high or low, drawing attention to significant market movements or potential anomalies.
All of the indicators are normalized using min/max scaling driven by the highest highs and lows. The period of this scaling is adjustable by changing the "Lookback" parameter under settings. Delta length changes the lookback for "MA Delta" and "Volume Delta". A longer period corresponds to a smoother output. Fast Mode scales back the range of the indicator, literally halving the increment.
Here is a short description of what each input does:
Alternate Source: A choice to use a different data source for the indicator.
Source: An option to turn on or off the alternate data source.
Style: A selection menu to choose the visual style of the indicator.
Lookback: Adjusts how far back in time the indicator looks for its calculations.
Delta Length: Changes the length of time over which changes are measured.
Fast Mode: A setting that adjusts the range of the indicator for quicker analysis.
Enable Smoothing: A choice to smooth out the data for a cleaner look.
Smooth: Activates the smoothing feature.
Max Region: Highlights the highest value regions in the heatmap.
Max Threshold: Sets the threshold for what counts as a 'max' region.
Minimum Max Width: Determines the smallest size for a 'max' region to be highlighted.
Max Region Color: Chooses the color for the maximum value regions.
Max Top Line Alpha: Adjusts the transparency of the top line in max regions.
Max Bottom Line Alpha: Adjusts the transparency of the bottom line in max regions.
Line Width: Sets the thickness of the lines in the max regions.
Region Start Indication: Specifies where the max region starts.
Fill Max: Decides if the max regions should be filled with color and sets the transparency level for the color fill in max regions.
Minimum Region: Highlights the lowest value regions in the heatmap.
Minimum Threshold: Sets the threshold for what counts as a 'min' region.
Minimum Minimum Width: Determines the smallest size for a 'min' region to be highlighted.
Minimum Region Color: Chooses the color for the minimum value regions.
Minimum Top Line Alpha: Adjusts the transparency of the top line in min regions.
Minimum Bottom Line Alpha: Adjusts the transparency of the bottom line in min regions.
Minimum Line Width: Sets the thickness of the lines in the min regions.
Minimum Region Start Indication: Specifies where the min region starts.
Fill Minimum: Decides if the min regions should be filled with color and sets the transparency level for the color fill in min regions.
Color Presets: Provides pre-set color schemes.
Invert Color Scale: Flips the color scale.
Gradient Colors: Customizes individual colors for the gradient scale.
Available styles include:
'MACD Histogram'
'Normalized MACD'
'Slow MACD'
'MACD Percent Rank'
'MA Delta' (Delta Length set to 2)
'BB Width'
'BB Width Percentile'
'Stochastic'
'RSI'
'True Range OSC'
'Normalized Volume'
'Volume Delta'
'True Range'
'Rate of Change' (Smoothing set to 1)
'OBV' (Smoothing set to 1)
'MFI' (Smoothing set to 1)
'Trend Angle' (Smoothing set to 2 and fast mode off)
EXPONOVA @thejamiulNSE:NIFTY "EXPONOVA @thejamiul," is designed to provide traders with a visual tool to analyze market trends and potential entry or exit points. Here's an overview of its features and functionality:
1. Dual Exponential Moving Averages (EMAs):
The indicator utilizes two EMAs with different lengths - one set at 20 periods and the other at 55 periods. These EMAs are calculated based on the closing prices of the assets.
2. Color Gradient Feature:
A unique aspect of this indicator is its use of a color gradient to visually represent the relationship between the price and the longer EMA (55 periods). The gradient consists of a series of colors ranging from shades of red to green.
3. Dynamic Color Adaptation:
The indicator dynamically changes the color of the area between the two EMAs. This color change is based on the position of the closing price relative to the longer EMA (55 periods). The color shifts through the gradient based on the number of bars since the price last crossed the longer EMA.
4. Close Price and EMA Interaction:
The script includes functions to determine whether the closing price is above or below the longer EMA. This interaction is a crucial part of how the color gradient is applied.
5. Visualisation of Market Trends:
By plotting these EMAs and the color-filled area between them, the indicator provides a visual representation of market trends. The changing colors can help traders in identifying trend strength, potential reversals, or consolidation phases.
6. Overlay on Price Chart:
The indicator is designed to overlay directly on the price chart, making it easier for traders to correlate the EMAs and the color gradient with price movements.
7. Explicit Mention of Originality:
One of the distinctive features of 'EXPONOVA @thejamiul' is its innovative use of a color gradient to visually represent the price's relationship with the longer EMA. This approach, combined with our specific choice of EMAs and the dynamic color adaptation technique, sets this script apart from standard EMA-based indicators.
8. Acknowledgement of Potential Shortcomings or Limitations:
While 'EXPONOVA @thejamiul' provides a dynamic visual aid for trend analysis, users should note that like all indicators, it is subject to market volatility and should be used in conjunction with other analysis methods. This script is best suited for , and users may need to adjust settings for optimal performance in different market scenarios.
9. Summary:
"EXPONOVA @thejamiul" is a visually intuitive and dynamic trading tool that combines dual EMAs with a unique color gradient feature to aid traders in making informed decisions based on the relationship between price trends and moving averages.
Moving Average Dispersion Index w/ Z-Score (Adjusted MADI-Z)Overview
The Adjusted MADI-Z indicator is a custom indicator that looks to decipher trends and consolidations based on the clustering and dispersion of Moving Averages. It calculates a z-score based on the dispersion of various exponentially weighted moving averages to identify trends and consolidation. The z-score is then adjusted using a logistic function to map it between 0-100.
How can it be used?
- Identify trends and consolidation - Values above 80 indicate a strong trend while values below 20 show consolidation
- Gauge trend strength - Higher positive values suggest a stronger uptrend while lower negative values indicate a stronger downtrend
- Generate trading signals - Crossovers of key levels can act as entry/exit triggers
- Smooth noise in price action - The adjusted z-score filters out market noise
Default Values
- ma5_len = 5
- ma10_len = 10
- ma50_len = 50
- ma200_len = 200
- lookback_period = 100
Strategies
The Adjusted MADI-Z can be used for trend-following strategies across various timeframes. Specific strategies include:
- Trend trading - Enter long on crossover above 80, exit on crossover below 80. Reverse for short trades.
- Range trading - Enter short on crossover below 20, exit on crossover above 20. Reverse for long trades.
- Identifying pullbacks - Temporary moves below 80 during uptrends and above 20 during downtrends can act as retracement entry points.
Rationale
By adjusting the z-score output of the standard MADI using a logistic function, the indicator becomes bounded and easier to interpret for trading purposes. The customized moving average lengths also allow tuning the indicator to particular assets and timeframes.
Interpretation
- Above 80 - Strong uptrend
- 70 to 80 - Moderate uptrend
- 50 to 70 - Weak uptrend
- 30 to 50 - Range-bound consolidation
- 20 to 30 - Weak downtrend
- Below 20 - Strong downtrend
Values below 15 or above 85 represent extremes outside two standard deviations.
5 ema strategyThis Strategy is based of Subhashish Pani's (power of stocks) 5 EMA Strategy.strategy used for sell in 5 minutes and for buy in 15 minutes ..
Rules for this strategy ..
Sell signal -
1) if price is above 5 Ema and not touching Ema use as alert candle..
2) if price break low of alert candle strategy open trade ..
3) if price move more upside low of alert candle keep change into next candle ..
4) input we can select number of trade per day .as rule should take only 4 signal should execute
5) stop loss is fixed highest high of last 2 candle and take profit is input multiply of stop loss
buy signal-
1) if price is below 5 Ema and not touching Ema use as alert candle..
2) if price break high of alert candle strategy open trade ..
3) if price move more downside high of alert candle keep change into next candle ..
4) input we can select number of trade per day .as rule should take only 4 signal should execute
5) stop loss is fixed lowest low of last 2 candle and take profit is input multiply of stop loss
notes -input can be selected which side should take signal either buy or sell side ...number of trade can be adjusted ..
Disclaimer -Traders can use this script as a starting point for further customization or as a reference for developing their own trading strategies. It's important to note that past performance is not indicative of future results, and thorough testing and validation are recommended before deploying any trading strategy.
Donch +This is an indicator I made for trading Forex to help me see the bigger picture. It is meant for the 30min TF and it includes the following:
- 20 Day High | Low
- 5 Day High | Low
- 4 Hour High | L
- 4 Hour Bars
- Daily Simple Moving Averages
- Weekly Trend Line (connects last week's open to this week's open)
- Daily Trend Line (connects yesterday's open to today's open)
- Horizontal Lines at 0.25% increments (these can be useful for S/R... currency rarely moves more than 1% in a day).
- A table with information about what markets are open and technicals on the pair I am looking at.
- A slight white background fill to highlight the first hour of the US session. Knowing what session you are in is very important in day trading (in my opinion). This lets me go back and see how the US has been trading.
To keep the chart from being "too busy" (it's plenty busy lol), I use a step line and focus on 30min closes. I reference the white lines above and below closes for 4hr highs/lows and don't bother with looking at the high/low of every 30 min bar.
For the table, you will see bright green by the country for the first hour of trading in that session. It will turn to a regular green after the first hour. It will turn yellow the final hour of that session. It will turn red if that market is closed.
You can select from the settings 'inputs' tab to enable/disable any parts of this you don't find useful, for the table you'd go over to the 'style' tab and unselect it there. For example, I don't use the labels regularly. If I were to get confused about what a moving average was or something, I'd enable the labels and clarify.
Currency doesn't like to break out and likes to be stable. Keeping this in mind, you can see how the 20 day high / low and the 5 day high / low act as support and resistance (unless there is a news event to break out on.
I have alerts for the following:
- Price update every hour
- Crossing a trend line
- Crossing a moving average
- Crossing a 0.25% increment
- Making a new 4 hour, 5 day, or 20 day high/low
To enable the alerts, you would click add alert, select the indicator, and click save. To work properly, you'd want to be on the 30min TF before doing this. You will get a lot of alerts (personally I like this because I like to see how currency moves throughout the day). You will get one notification per 30 minutes but not more than that for the particular alert.
Envelope and Moving Average**Description:**
- This script creates an indicator that combines an envelope and a simple moving average (MA).
- The envelope is constructed using a specified length, percentage deviation, and source price (close by default).
- The moving average is calculated based on a specified length and source price.
**Inputs:**
1. Envelope:
- Length: Number of periods used for the envelope calculation (default is 20).
- Percentage Deviation: Percentage above and below the envelope basis (default is 10%).
- Source: The price used for the envelope calculation (default is close).
- Exponential MA: Option to use exponential moving average for the envelope basis (default is false).
2. Moving Average:
- Length: Number of periods used for the moving average calculation (default is 20).
- Source: The price used for the moving average calculation (default is close).
**Plotting:**
- The script plots the envelope basis, upper envelope line, and lower envelope line.
- The area between the upper and lower envelope lines is filled with a semi-transparent color for better visualization.
- The moving average is plotted on the chart with a specified color and line width.
**How to Use in a Strategy:**
1. **Envelope Crossovers:**
- Go Long (Buy): When the close price crosses above the upper envelope line.
- Go Short (Sell): When the close price crosses below the lower envelope line.
2. **Moving Average Crossovers:**
- Go Long (Buy): When the close price crosses above the moving average.
- Go Short (Sell): When the close price crosses below the moving average.
3. **Confirmation:**
- Consider additional confirmation signals or filters to improve the robustness of your strategy.
- For example, you might require a certain amount of price momentum or use other technical indicators in conjunction with envelope and moving average signals.
4. **Optimization:**
- Experiment with different parameter values (e.g., envelope length, percentage deviation, moving average length) to optimize the strategy for specific market conditions.
5. **Risk Management:**
- Implement proper risk management techniques, such as setting stop-loss orders and position sizing, to control risk.
Remember to thoroughly backtest any strategy before deploying it in a live trading environment. Additionally, consider the current market conditions and adapt your strategy accordingly.
F.B_Stochastic Trend HarmonizerThe "F.B_Stochastic Trend Harmonizer" has been developed to provide insights into market trends. It combines stochastic oscillations with moving averages. Stochastic oscillators are used to measure market fluctuations, while moving averages serve to smooth these fluctuations and identify trends. By linking these elements, the indicator aims to offer an enhanced representation of market dynamics and potential trend reversals.
You can choose various types of moving averages such as SMA, EMA, or WMA and control the sensitivity of the lines by adjusting the smoothing factors. The fast line displays harmonized stochastic values, while the slow line is smoothed by a moving average.
The "Fast Line 2" marks individual candles for better visibility. It is recommended to combine this indicator with other analysis tools to make trading decisions.
If the "Fast Line" is greater than the "Slow Line MA," it indicates an uptrend. Conversely, if the "Fast Line" is smaller than the "Slow Line MA," it signals a downtrend.