3 MA Strategy [Projeadam] OVERVIEW:
3 MA Strategy indicator displays and analyzes three types of moving averages (MAs) on a price chart. The primary function of this indicator is to identify buy and sell signals based on the crossover and crossunder events of the specified moving averages. It provides extensive customization options for the types and settings of the moving averages, and it can visualize these signals on the chart through labels and background colors.
Algorithm:
1. Initialization and Function Definition
• Define the ma_function to calculate different types of moving averages (EMA, SMA, RMA, WMA) based on user inputs.
2. Inputs and Moving Average Calculation
• Gather user inputs for three moving averages, including length, source, line width, color, and type.
• Calculate the values for the three moving averages using the ma_function.
3. Plotting Moving Averages
• Plot the calculated moving averages on the chart with the specified settings.
4. Buy and Sell Conditions
• Establish initial buy and sell conditions based on the crossover and crossunder of the first two moving averages.
• Adjust these conditions if the third moving average is enabled, considering its relationship with the close price.
5. Signal Control Logic
• Use variables (last_buy, last_sell, sinyal_control) to manage the signal generation process, ensuring a buy signal is followed by a sell signal and vice versa.
6. Signal Label and Background
• Add labels and background colors to the chart based on the generated signals if the respective settings are enabled.
7. Plotting Additional Information
• If the third moving average is enabled and the label_show_price setting is active, plot additional lines and labels to indicate the position of the moving average.
8. Alerts
• Set up alert conditions to notify the user when buy or sell conditions are met.
How Does the Indicator Work?
Moving Average Calculation
• The script calculates three different moving averages using the user-defined settings. Each moving average can be an EMA, SMA, RMA, or WMA and is calculated using the specified length and source.
Signal Generation
• Buy signals are generated when the first moving average crosses above the second moving average. If the third moving average is enabled, the close price must also be above the third moving average for a buy signal.
• Sell signals are generated when the first moving average crosses below the second moving average. If the third moving average is enabled, the close price must also be below the third moving average for a sell signal.
Visualization
• The moving averages are plotted on the chart with the colors and line widths specified by the user.
• Buy and sell signals are indicated by labels ('BUY' for buy signals, 'SELL' for sell signals) and optionally by changing the background color of the chart.
Alerts
• Alerts are set up to notify the user of buy or sell signals, as well as when either condition is met.
Settings Panel
MOVING AVERAGE SETTINGS 1 (BUY - SELL)
• Length: Length of the first moving average.
• Source: Source of the first moving average (e.g., close, open).
• Line Width: Line width of the first moving average.
• Color: Color of the first moving average.
• Moving Average Type: Type of the first moving average (EMA, SMA, RMA, WMA).
MOVING AVERAGE SETTINGS 2 (BUY - SELL)
• Length: Length of the second moving average.
• Source: Source of the second moving average.
• Line Width: Line width of the second moving average.
• Color: Color of the second moving average.
• Moving Average Type: Type of the second moving average (EMA, SMA, RMA, WMA).
FINAL MOVING AVERAGE SETTINGS
• Enable 3rd Average?: Toggle to activate the third moving average.
• Length: Length of the third moving average.
• Source: Source of the third moving average.
• Line Width: Line width of the third moving average.
• Color: Color of the third moving average.
• Moving Average Type: Type of the third moving average (EMA, SMA, RMA, WMA).
BUY - SELL SETTINGS
• Enable Background?: Toggle to activate background color changes based on signals.
• Enable Signal Labels?: Toggle to activate signal labels.
• Enable Price Labels?: Toggle to activate price labels.
• Sell Background: Background color for sell signals.
• Buy Background: Background color for buy signals.
Benefits of the 3 MA Indicator
1. Versatility and Customization
• The indicator supports multiple types of moving averages (EMA, SMA, RMA, WMA), allowing users to choose the one that best fits their trading strategy.
• Users can customize the length, source, line width, and color of each moving average, providing flexibility to tailor the indicator to their preferences.
2. Comprehensive Signal Generation
• The indicator generates clear buy and sell signals based on the crossover and crossunder events of the moving averages. This helps traders make informed decisions about entry and exit points.
• It includes an optional third moving average to filter signals, potentially reducing false signals and improving accuracy.
3. Visual Aids for Better Decision Making
• The indicator plots the moving averages on the chart, making it easy for traders to visualize trends and market conditions.
• Signal labels ('BUY' and 'SELL') are displayed on the chart, providing immediate visual cues for trading actions.
• The background color changes based on the signals, adding another layer of visual confirmation for traders.
4. Alert Notifications
• The indicator includes alert conditions for buy and sell signals, as well as a combined alert for either condition. This ensures that traders are notified in real-time when a signal is generated, allowing for timely action.
5. Historical Analysis
• By plotting moving averages and signals on the chart, traders can conduct historical analysis to see how the indicator would have performed in the past. This can help in evaluating the effectiveness of the trading strategy.
6. Enhanced Trading Confidence
• The use of multiple moving averages and customizable settings can enhance a trader's confidence in their trading decisions. By relying on objective criteria for signals, traders can reduce emotional trading and adhere to a disciplined approach.
7. Improved Market Understanding
• The indicator helps traders understand market trends and momentum by analyzing the relationships between different moving averages. This can lead to a deeper insight into market behavior and better trading strategies.
8. Ease of Use
• The indicator is straightforward to implement and use within TradingView, making it accessible to traders of all experience levels. The customizable settings panel ensures that even novice traders can set it up according to their needs.
Hareketliortalama
VARGAS"VARGAS" is an indicator that can be used in all timeframes on charts in the stock, crypto, and commodity markets. It allows trades to be opened according to the intersections of moving averages in different time periods.
It is an indicator using weighted moving averages. Using a weighted moving average has the following benefits for traders:
1) Precision and Smoothness: The WMA typically gives more weight to recent prices and therefore reacts faster to more recent data. This helps you catch price movements faster and recognize trend changes faster. On the other hand, the WMA is smoother than the simple moving average (SMA), which makes it less likely to generate false signals.
2) Trend Identification: The WMA is used to identify and analyze price trends. It is especially important for traders who want to track short-term movements. The WMA is used to assess the direction and strength of the trend.
3) Trading Signals: The WMA is used as part of various trading strategies. It is especially used in moving average crossover strategies. For example, a short-term WMA crossing the long-term WMA to the upside can be considered a buy signal, while a reversal can be interpreted as a sell signal.
4) Adaptability to Volatility: WMA can adapt to volatility by changing weighting factors. Investors can adopt a more flexible approach by assigning different weights based on market conditions and asset classes.
5) Data Correction: WMA can be helpful in reducing data noise. A single large price fluctuation can cause the SMA to be more affected, while the WMA reduces the impact of these fluctuations.
In our VARGAS coding, the intersection times of the 9-day and 15-day weighted moving averages allow us to decide the direction of the trend. The green and red cloud areas following the price candles make the strategy easy for the user to follow.
At the intersection between the 9-day weighted moving average and the 15-day weighted moving average, we can use buy and sell signals as follows:
If the 9-day weighted moving average crosses the 15-day weighted moving average upwards, buy,
Sell if the 9-day weighted moving average crosses the 15-day weighted moving average downwards.
Within the scope of this strategy, GOLDEN CROSS and DEATH CROSS intersections, which guide us for trend changes, are also included in the coding. Thus, it is aimed to add strength to our WMA 9 and WMA 15 intersection strategy as an idea.
VARGAS indicator gives better results for longer periods of 4 hours and above. As the time period increases, the probability of correct results will increase.
**
"VARGAS" hisse senedi, kripto, ve emtia piyasalarındaki grafiklerde her türlü zaman diliminde kullanılabilen bir indikatördür. Farklı zaman periyotlarındaki hareketli ortalamaların kesişimlerine göre işlem açılmasını sağlar.
Ağırlıklı hareketli ortalamalar kullanılarak hazırlanmış bir göstergedir. Ağırlıklı hareketli ortalama kullanmanın yatırımcılara aşağıdaki gibi faydaları bulunmaktadır:
1) Duyarlılık ve Pürüzsüzlük: WMA, tipik olarak son dönem fiyatlarına daha fazla ağırlık verir ve bu nedenle daha güncel verilere daha hızlı tepki verir. Bu, fiyat hareketlerini daha hızlı yakalamanıza ve daha hızlı trend değişikliklerini tanımanıza yardımcı olur. Diğer yandan, WMA, basit hareketli ortalamaya (SMA) göre daha pürüzsüzdür, bu da yanlış sinyal üretme olasılığını azaltır.
2) Trend Belirleme: WMA, fiyat trendlerini belirlemek ve analiz etmek için kullanılır. Özellikle kısa vadeli hareketleri izlemek isteyen yatırımcılar için önemlidir. WMA, trendin yönünü ve gücünü değerlendirmek için kullanılır.
3) Ticaret Sinyalleri: WMA, çeşitli ticaret stratejilerinin bir parçası olarak kullanılır. Özellikle hareketli ortalama crossover stratejilerinde kullanılır. Örneğin, kısa vadeli WMA'nın uzun vadeli WMA'yı yukarı yönlü kesmesi bir alım sinyali olarak kabul edilebilir, tersine dönmesi ise bir satış sinyali olarak yorumlanabilir.
4) Volatiliteye Uyarlanabilirlik: WMA, ağırlıklandırma faktörlerini değiştirerek volatiliteye uyum sağlayabilir. Yatırımcılar, piyasa koşullarına ve varlık sınıflarına göre farklı ağırlıklar atayarak daha esnek bir yaklaşım benimseyebilirler.
5) Veri Düzeltme: WMA, veri gürültüsünü azaltmada yardımcı olabilir. Tek bir büyük fiyat dalgalanması, SMA'nın daha fazla etkilenmesine neden olabilirken, WMA bu dalgalanmaların etkisini azaltır.
VARGAS isimli kodlamamızda ise 9 günlük ve 15 günlük ağırlıklı hareketli ortalamaların kesişme zamanları trendin yönüne karar vermemizi sağlar. Fiyat mumlarını takip eden yeşil ve kırmızı bulut alanları stratejinin kullanıcı tarafından kolaylıkla takip edilmesini sağlamaktadır.
9 Günlük Ağırlıklı hareketli ortalama, 15 Günlük Ağırlıklı hareketli ortalama arasındaki kesişimde al ve sat sinyallerini şu şekilde kullanabiliriz:
Eğer 9 günlük ağırlıklı hareketli ortalama 15 günlük ağırlıklı hareketli ortalamayı yukarı doğru kesiyorsa al,
Eğer 9 günlük ağırlıklı hareketli ortalama, 15 günlük ağırlıklı hareketli ortalamayı aşağı doğru keserse sat.
Bu strateji kapsamında trend değişimleri için bizlere yön veren GOLDEN CROSS ve DEATH CROSS kesişimleri de kodlamanın içerisinde dahil edilmiştir. Böylelikle WMA 9 ve WMA 15 kesişim stratejimize fikir olarak güç katması hedeflenmiştir.
VARGAS indikatörü 4 saat ve üzeri daha uzun periyotlarda daha iyi sonuçlar vermektedir. Zaman periyodu büyüdükçe doğru sonuç verme olasılığı artacaktır.
Three moving average strategies
If the short term (Default 7) moving average cuts the medium term (default 25) moving average, BUY. Conversely, it generates the SELL signal. If the long term (Default 99) moving average cuts its short term moving average, Quick SELL. Conversely, it can be interpreted as Fast SELL. You can change the moving average and the number of days as you wish, and you can trade in the short or long term. I hope it was useful.
Nearest Farest Moving AverageHi,
UPDATE: This version includes the source code
This tool (indicator) helps you to find the nearest and the farest moving average. It can also show you the middle Moving Average,
PS: If you use "open" as source, the indicator will not update during the live bar (or you can use shift)
Disclaimer: This is not a financial or investment advice.
Stay healthy, trade safe...
Atilla Yurtseven