50, 100, 200 EMAsA simple script that displays the 50, 100, and 200-period exponential moving averages. Reduce clutter by combining them into one indicator!
ค้นหาในสคริปต์สำหรับ "马斯克+100万"
50, 100, 200 SMAsA simple script that displays the 50, 100, and 200-period simple moving averages. Reduce clutter by combining them into one indicator!
50,100,200 MA by CryptoLife71(FIXED)Updated the code by CryptoLife71 so that the 200ma shows correctly.
EMA 20/50/100/200Plots exponential moving average on four timeframes at once for rapid indication of momentum shift as well as slower-moving confirmations.
Displays EMA 20, 50, 100, and 200... default colors are hotter for faster timeframes, cooler for slower ones
DECL: 3 X Moving Average (50, 100 and 200 day)Basic Moving Average with 3 different intervals. Default: 50 day (blue), 100 day (red) and 200 day (purple)
BB 100 with Barcolors6/19/15 I added confirmation highlight bars to the code. In other words, if a candle bounced off the lower Bollinger band, it needed one more close above the previous candle to confirm a higher probability that a change in investor sentiment has reversed. Same is true for upper Bollinger band bounces. I also added confirmation highlight bars to the 100 sma (the basis). The idea is that lower and upper bands are potential points of support and resistance. The same is true of the basis if a trend is to continue. 6/28/15 I added a plotshape to identify closes above/below TLine. One thing this system points out is it operates best in a trend reversal. Consolidations will whipsaw the indicator too much. I have found that when this happens, if using daily candles, switch to hourly, 30 min, etc., to catch a better signal. Nothing moves in a straight line. As with any indicator, it is a tool to be used in conjunction with the art AND science of trading. As always, try the indicator for a time so that you are comfortable enough to use real money. This is designed to be used with "BB 25 with Barcolors".
BB 100 with Barcolors6/19/15 I added confirmation highlight bars to the code. In other words, if a candle bounced off the lower Bollinger band, it needed one more close above the previous candle to confirm a higher probability that a change in investor sentiment has reversed. Same is true for upper Bollinger band bounces. I also added confirmation highlight bars to the 100 sma (the basis). The idea is that lower and upper bands are potential points of support and resistance. The same is true of the basis if a trend is to continue. Nothing moves in a straight line. As with any indicator, it is a tool to be used in conjunction with the art AND science of trading. As always, try the indicator for a time so that you are comfortable enough to use real money. This is designed to be used with "BB 25 with Barcolors".
BB 100 with BarcolorsI cleaned up the highlight barcolor to reflect red or lime depending if it closed > or < the open.
The description is in the code. you want to catch bounces off the 25 (upper or lower) and 100 (upper or lower).
Works well on the hourly and 30 min charts. Haven't tested it beyond that. Haven't tested Forex, just equities.
EMA Keltner Channel 1D100/200 EMAs, along with Keltner Bands based off them. Colors correspond to actions you should be ready to take in the area. Use to set macro mindset.
Uses the security function to display only the 1D values.
Red= Bad
Orange = Not as Bad, but still Bad.
Yellow = Warning, might also be Bad.
Purple = Dip a toe in.
Blue = Give it a shot but have a little caution.
Green = It's second mortgage time.
GainzAlgo V2 [Proficient]// © GainzAlgo
//@version=5
indicator('GainzAlgo V2 ', overlay=true, max_labels_count=500)
show_tp_sl = input.bool(true, 'Display TP & SL', group='Techical', tooltip='Display the exact TP & SL price levels for BUY & SELL signals.')
rrr = input.string('1:2', 'Risk to Reward Ratio', group='Techical', options= , tooltip='Set a risk to reward ratio (RRR).')
tp_sl_multi = input.float(1, 'TP & SL Multiplier', 1, group='Techical', tooltip='Multiplies both TP and SL by a chosen index. Higher - higher risk.')
tp_sl_prec = input.int(2, 'TP & SL Precision', 0, group='Techical')
candle_stability_index_param = 0.7
rsi_index_param = 60
candle_delta_length_param = 4
disable_repeating_signals_param = input.bool(true, 'Disable Repeating Signals', group='Techical', tooltip='Removes repeating signals. Useful for removing clusters of signals and general clarity.')
GREEN = color.rgb(29, 255, 40)
RED = color.rgb(255, 0, 0)
TRANSPARENT = color.rgb(0, 0, 0, 100)
label_size = input.string('huge', 'Label Size', options= , group='Cosmetic')
label_style = input.string('text bubble', 'Label Style', , group='Cosmetic')
buy_label_color = input(GREEN, 'BUY Label Color', inline='Highlight', group='Cosmetic')
sell_label_color = input(RED, 'SELL Label Color', inline='Highlight', group='Cosmetic')
label_text_color = input(color.white, 'Label Text Color', inline='Highlight', group='Cosmetic')
stable_candle = math.abs(close - open) / ta.tr > candle_stability_index_param
rsi = ta.rsi(close, 14)
atr = ta.atr(14)
bullish_engulfing = close < open and close > open and close > open
rsi_below = rsi < rsi_index_param
decrease_over = close < close
var last_signal = ''
var tp = 0.
var sl = 0.
bull_state = bullish_engulfing and stable_candle and rsi_below and decrease_over and barstate.isconfirmed
bull = bull_state and (disable_repeating_signals_param ? (last_signal != 'buy' ? true : na) : true)
bearish_engulfing = close > open and close < open and close < open
rsi_above = rsi > 100 - rsi_index_param
increase_over = close > close
bear_state = bearish_engulfing and stable_candle and rsi_above and increase_over and barstate.isconfirmed
bear = bear_state and (disable_repeating_signals_param ? (last_signal != 'sell' ? true : na) : true)
round_up(number, decimals) =>
factor = math.pow(10, decimals)
math.ceil(number * factor) / factor
if bull
last_signal := 'buy'
dist = atr * tp_sl_multi
tp_dist = rrr == '2:3' ? dist / 2 * 3 : rrr == '1:2' ? dist * 2 : rrr == '1:4' ? dist * 4 : dist
tp := round_up(close + tp_dist, tp_sl_prec)
sl := round_up(close - dist, tp_sl_prec)
if label_style == 'text bubble'
label.new(bar_index, low, 'BUY', color=buy_label_color, style=label.style_label_up, textcolor=label_text_color, size=label_size)
else if label_style == 'triangle'
label.new(bar_index, low, 'BUY', yloc=yloc.belowbar, color=buy_label_color, style=label.style_triangleup, textcolor=TRANSPARENT, size=label_size)
else if label_style == 'arrow'
label.new(bar_index, low, 'BUY', yloc=yloc.belowbar, color=buy_label_color, style=label.style_arrowup, textcolor=TRANSPARENT, size=label_size)
label.new(show_tp_sl ? bar_index : na, low, 'TP: ' + str.tostring(tp) + '\nSL: ' + str.tostring(sl), yloc=yloc.price, color=color.gray, style=label.style_label_down, textcolor=label_text_color)
if bear
last_signal := 'sell'
dist = atr * tp_sl_multi
tp_dist = rrr == '2:3' ? dist / 2 * 3 : rrr == '1:2' ? dist * 2 : rrr == '1:4' ? dist * 4 : dist
tp := round_up(close - tp_dist, tp_sl_prec)
sl := round_up(close + dist, tp_sl_prec)
if label_style == 'text bubble'
label.new(bear ? bar_index : na, high, 'SELL', color=sell_label_color, style=label.style_label_down, textcolor=label_text_color, size=label_size)
else if label_style == 'triangle'
label.new(bear ? bar_index : na, high, 'SELL', yloc=yloc.abovebar, color=sell_label_color, style=label.style_triangledown, textcolor=TRANSPARENT, size=label_size)
else if label_style == 'arrow'
label.new(bear ? bar_index : na, high, 'SELL', yloc=yloc.abovebar, color=sell_label_color, style=label.style_arrowdown, textcolor=TRANSPARENT, size=label_size)
label.new(show_tp_sl ? bar_index : na, low, 'TP: ' + str.tostring(tp) + '\nSL: ' + str.tostring(sl), yloc=yloc.price, color=color.gray, style=label.style_label_up, textcolor=label_text_color)
alertcondition(bull or bear, 'BUY & SELL Signals', 'New signal!')
alertcondition(bull, 'BUY Signals (Only)', 'New signal: BUY')
alertcondition(bear, 'SELL Signals (Only)', 'New signal: SELL')
Hurst Exponent - Detrended Fluctuation AnalysisIn stochastic processes, chaos theory and time series analysis, detrended fluctuation analysis (DFA) is a method for determining the statistical self-affinity of a signal. It is useful for analyzing time series that appear to be long-memory processes and noise.
█ OVERVIEW
We have introduced the concept of Hurst Exponent in our previous open indicator Hurst Exponent (Simple). It is an indicator that measures market state from autocorrelation. However, we apply a more advanced and accurate way to calculate Hurst Exponent rather than simple approximation. Therefore, we recommend using this version of Hurst Exponent over our previous publication going forward. The method we used here is called detrended fluctuation analysis. (For folks that are not interested in the math behind the calculation, feel free to skip to "features" and "how to use" section. However, it is recommended that you read it all to gain a better understanding of the mathematical reasoning).
█ Detrend Fluctuation Analysis
Detrended Fluctuation Analysis was first introduced by by Peng, C.K. (Original Paper) in order to measure the long-range power-law correlations in DNA sequences . DFA measures the scaling-behavior of the second moment-fluctuations, the scaling exponent is a generalization of Hurst exponent.
The traditional way of measuring Hurst exponent is the rescaled range method. However DFA provides the following benefits over the traditional rescaled range method (RS) method:
• Can be applied to non-stationary time series. While asset returns are generally stationary, DFA can measure Hurst more accurately in the instances where they are non-stationary.
• According the the asymptotic distribution value of DFA and RS, the latter usually overestimates Hurst exponent (even after Anis- Llyod correction) resulting in the expected value of RS Hurst being close to 0.54, instead of the 0.5 that it should be. Therefore it's harder to determine the autocorrelation based on the expected value. The expected value is significantly closer to 0.5 making that threshold much more useful, using the DFA method on the Hurst Exponent (HE).
• Lastly, DFA requires lower sample size relative to the RS method. While the RS method generally requires thousands of observations to reduce the variance of HE, DFA only needs a sample size greater than a hundred to accomplish the above mentioned.
█ Calculation
DFA is a modified root-mean-squares (RMS) analysis of a random walk. In short, DFA computes the RMS error of linear fits over progressively larger bins (non-overlapped “boxes” of similar size) of an integrated time series.
Our signal time series is the log returns. First we subtract the mean from the log return to calculate the demeaned returns. Then, we calculate the cumulative sum of demeaned returns resulting in the cumulative sum being mean centered and we can use the DFA method on this. The subtraction of the mean eliminates the “global trend” of the signal. The advantage of applying scaling analysis to the signal profile instead of the signal, allows the original signal to be non-stationary when needed. (For example, this process converts an i.i.d. white noise process into a random walk.)
We slice the cumulative sum into windows of equal space and run linear regression on each window to measure the linear trend. After we conduct each linear regression. We detrend the series by deducting the linear regression line from the cumulative sum in each windows. The fluctuation is the difference between cumulative sum and regression.
We use different windows sizes on the same cumulative sum series. The window sizes scales are log spaced. Eg: powers of 2, 2,4,8,16... This is where the scale free measurements come in, how we measure the fractal nature and self similarity of the time series, as well as how the well smaller scale represent the larger scale.
As the window size decreases, we uses more regression lines to measure the trend. Therefore, the fitness of regression should be better with smaller fluctuation. It allows one to zoom into the “picture” to see the details. The linear regression is like rulers. If you use more rulers to measure the smaller scale details you will get a more precise measurement.
The exponent we are measuring here is to determine the relationship between the window size and fitness of regression (the rate of change). The more complex the time series are the more it will depend on decreasing window sizes (using more linear regression lines to measure). The less complex or the more trend in the time series, it will depend less. The fitness is calculated by the average of root mean square errors (RMS) of regression from each window.
Root mean Square error is calculated by square root of the sum of the difference between cumulative sum and regression. The following chart displays average RMS of different window sizes. As the chart shows, values for smaller window sizes shows more details due to higher complexity of measurements.
The last step is to measure the exponent. In order to measure the power law exponent. We measure the slope on the log-log plot chart. The x axis is the log of the size of windows, the y axis is the log of the average RMS. We run a linear regression through the plotted points. The slope of regression is the exponent. It's easy to see the relationship between RMS and window size on the chart. Larger RMS equals less fitness of the regression. We know the RMS will increase (fitness will decrease) as we increases window size (use less regressions to measure), we focus on the rate of RMS increasing (how fast) as window size increases.
If the slope is < 0.5, It means the rate of of increase in RMS is small when window size increases. Therefore the fit is much better when it's measured by a large number of linear regression lines. So the series is more complex. (Mean reversion, negative autocorrelation).
If the slope is > 0.5, It means the rate of increase in RMS is larger when window sizes increases. Therefore even when window size is large, the larger trend can be measured well by a small number of regression lines. Therefore the series has a trend with positive autocorrelation.
If the slope = 0.5, It means the series follows a random walk.
█ FEATURES
• Sample Size is the lookback period for calculation. Even though DFA requires a lower sample size than RS, a sample size larger > 50 is recommended for accurate measurement.
• When a larger sample size is used (for example = 1000 lookback length), the loading speed may be slower due to a longer calculation. Date Range is used to limit numbers of historical calculation bars. When loading speed is too slow, change the data range "all" into numbers of weeks/days/hours to reduce loading time. (Credit to allanster)
• “show filter” option applies a smoothing moving average to smooth the exponent.
• Log scale is my work around for dynamic log space scaling. Traditionally the smallest log space for bars is power of 2. It requires at least 10 points for an accurate regression, resulting in the minimum lookback to be 1024. I made some changes to round the fractional log space into integer bars requiring the said log space to be less than 2.
• For a more accurate calculation a larger "Base Scale" and "Max Scale" should be selected. However, when the sample size is small, a larger value would cause issues. Therefore, a general rule to be followed is: A larger "Base Scale" and "Max Scale" should be selected for a larger the sample size. It is recommended for the user to try and choose a larger scale if increasing the value doesn't cause issues.
The following chart shows the change in value using various scales. As shown, sometimes increasing the value makes the value itself messy and overshoot.
When using the lowest scale (4,2), the value seems stable. When we increase the scale to (8,2), the value is still alright. However, when we increase it to (8,4), it begins to look messy. And when we increase it to (16,4), it starts overshooting. Therefore, (8,2) seems to be optimal for our use.
█ How to Use
Similar to Hurst Exponent (Simple). 0.5 is a level for determine long term memory.
• In the efficient market hypothesis, market follows a random walk and Hurst exponent should be 0.5. When Hurst Exponent is significantly different from 0.5, the market is inefficient.
• When Hurst Exponent is > 0.5. Positive Autocorrelation. Market is Trending. Positive returns tend to be followed by positive returns and vice versa.
• Hurst Exponent is < 0.5. Negative Autocorrelation. Market is Mean reverting. Positive returns trends to follow by negative return and vice versa.
However, we can't really tell if the Hurst exponent value is generated by random chance by only looking at the 0.5 level. Even if we measure a pure random walk, the Hurst Exponent will never be exactly 0.5, it will be close like 0.506 but not equal to 0.5. That's why we need a level to tell us if Hurst Exponent is significant.
So we also computed the 95% confidence interval according to Monte Carlo simulation. The confidence level adjusts itself by sample size. When Hurst Exponent is above the top or below the bottom confidence level, the value of Hurst exponent has statistical significance. The efficient market hypothesis is rejected and market has significant inefficiency.
The state of market is painted in different color as the following chart shows. The users can also tell the state from the table displayed on the right.
An important point is that Hurst Value only represents the market state according to the past value measurement. Which means it only tells you the market state now and in the past. If Hurst Exponent on sample size 100 shows significant trend, it means according to the past 100 bars, the market is trending significantly. It doesn't mean the market will continue to trend. It's not forecasting market state in the future.
However, this is also another way to use it. The market is not always random and it is not always inefficient, the state switches around from time to time. But there's one pattern, when the market stays inefficient for too long, the market participants see this and will try to take advantage of it. Therefore, the inefficiency will be traded away. That's why Hurst exponent won't stay in significant trend or mean reversion too long. When it's significant the market participants see that as well and the market adjusts itself back to normal.
The Hurst Exponent can be used as a mean reverting oscillator itself. In a liquid market, the value tends to return back inside the confidence interval after significant moves(In smaller markets, it could stay inefficient for a long time). So when Hurst Exponent shows significant values, the market has just entered significant trend or mean reversion state. However, when it stays outside of confidence interval for too long, it would suggest the market might be closer to the end of trend or mean reversion instead.
Larger sample size makes the Hurst Exponent Statistics more reliable. Therefore, if the user want to know if long term memory exist in general on the selected ticker, they can use a large sample size and maximize the log scale. Eg: 1024 sample size, scale (16,4).
Following Chart is Bitcoin on Daily timeframe with 1024 lookback. It suggests the market for bitcoin tends to have long term memory in general. It generally has significant trend and is more inefficient at it's early stage.
Expected Move BandsExpected move is the amount that an asset is predicted to increase or decrease from its current price, based on the current levels of volatility.
In this model, we assume asset price follows a log-normal distribution and the log return follows a normal distribution.
Note: Normal distribution is just an assumption, it's not the real distribution of return
Settings:
"Estimation Period Selection" is for selecting the period we want to construct the prediction interval.
For "Current Bar", the interval is calculated based on the data of the previous bar close. Therefore changes in the current price will have little effect on the range. What current bar means is that the estimated range is for when this bar close. E.g., If the Timeframe on 4 hours and 1 hour has passed, the interval is for how much time this bar has left, in this case, 3 hours.
For "Future Bars", the interval is calculated based on the current close. Therefore the range will be very much affected by the change in the current price. If the current price moves up, the range will also move up, vice versa. Future Bars is estimating the range for the period at least one bar ahead.
There are also other source selections based on high low.
Time setting is used when "Future Bars" is chosen for the period. The value in time means how many bars ahead of the current bar the range is estimating. When time = 1, it means the interval is constructing for 1 bar head. E.g., If the timeframe is on 4 hours, then it's estimating the next 4 hours range no matter how much time has passed in the current bar.
Note: It's probably better to use "probability cone" for visual presentation when time > 1
Volatility Models :
Sample SD: traditional sample standard deviation, most commonly used, use (n-1) period to adjust the bias
Parkinson: Uses High/ Low to estimate volatility, assumes continuous no gap, zero mean no drift, 5 times more efficient than Close to Close
Garman Klass: Uses OHLC volatility, zero drift, no jumps, about 7 times more efficient
Yangzhang Garman Klass Extension: Added jump calculation in Garman Klass, has the same value as Garman Klass on markets with no gaps.
about 8 x efficient
Rogers: Uses OHLC, Assume non-zero mean volatility, handles drift, does not handle jump 8 x efficient
EWMA: Exponentially Weighted Volatility. Weight recently volatility more, more reactive volatility better in taking account of volatility autocorrelation and cluster.
YangZhang: Uses OHLC, combines Rogers and Garmand Klass, handles both drift and jump, 14 times efficient, alpha is the constant to weight rogers volatility to minimize variance.
Median absolute deviation: It's a more direct way of measuring volatility. It measures volatility without using Standard deviation. The MAD used here is adjusted to be an unbiased estimator.
Volatility Period is the sample size for variance estimation. A longer period makes the estimation range more stable less reactive to recent price. Distribution is more significant on a larger sample size. A short period makes the range more responsive to recent price. Might be better for high volatility clusters.
Standard deviations:
Standard Deviation One shows the estimated range where the closing price will be about 68% of the time.
Standard Deviation two shows the estimated range where the closing price will be about 95% of the time.
Standard Deviation three shows the estimated range where the closing price will be about 99.7% of the time.
Note: All these probabilities are based on the normal distribution assumption for returns. It's the estimated probability, not the actual probability.
Manually Entered Standard Deviation shows the range of any entered standard deviation. The probability of that range will be presented on the panel.
People usually assume the mean of returns to be zero. To be more accurate, we can consider the drift in price from calculating the geometric mean of returns. Drift happens in the long run, so short lookback periods are not recommended. Assuming zero mean is recommended when time is not greater than 1.
When we are estimating the future range for time > 1, we typically assume constant volatility and the returns to be independent and identically distributed. We scale the volatility in term of time to get future range. However, when there's autocorrelation in returns( when returns are not independent), the assumption fails to take account of this effect. Volatility scaled with autocorrelation is required when returns are not iid. We use an AR(1) model to scale the first-order autocorrelation to adjust the effect. Returns typically don't have significant autocorrelation. Adjustment for autocorrelation is not usually needed. A long length is recommended in Autocorrelation calculation.
Note: The significance of autocorrelation can be checked on an ACF indicator.
ACF
The multimeframe option enables people to use higher period expected move on the lower time frame. People should only use time frame higher than the current time frame for the input. An error warning will appear when input Tf is lower. The input format is multiplier * time unit. E.g. : 1D
Unit: M for months, W for Weeks, D for Days, integers with no unit for minutes (E.g. 240 = 240 minutes). S for Seconds.
Smoothing option is using a filter to smooth out the range. The filter used here is John Ehler's supersmoother. It's an advance smoothing technique that gets rid of aliasing noise. It affects is similar to a simple moving average with half the lookback length but smoother and has less lag.
Note: The range here after smooth no long represent the probability
Panel positions can be adjusted in the settings.
X position adjusts the horizontal position of the panel. Higher X moves panel to the right and lower X moves panel to the left.
Y position adjusts the vertical position of the panel. Higher Y moves panel up and lower Y moves panel down.
Step line display changes the style of the bands from line to step line. Step line is recommended because it gets rid of the directional bias of slope of expected move when displaying the bands.
Warnings:
People should not blindly trust the probability. They should be aware of the risk evolves by using the normal distribution assumption. The real return has skewness and high kurtosis. While skewness is not very significant, the high kurtosis should be noticed. The Real returns have much fatter tails than the normal distribution, which also makes the peak higher. This property makes the tail ranges such as range more than 2SD highly underestimate the actual range and the body such as 1 SD slightly overestimate the actual range. For ranges more than 2SD, people shouldn't trust them. They should beware of extreme events in the tails.
Different volatility models provide different properties if people are interested in the accuracy and the fit of expected move, they can try expected move occurrence indicator. (The result also demonstrate the previous point about the drawback of using normal distribution assumption).
Expected move Occurrence Test
The prediction interval is only for the closing price, not wicks. It only estimates the probability of the price closing at this level, not in between. E.g., If 1 SD range is 100 - 200, the price can go to 80 or 230 intrabar, but if the bar close within 100 - 200 in the end. It's still considered a 68% one standard deviation move.
ES-VIX Expected Move - Open basedES-VIX Daily Price Bands
This indicator plots dynamic intraday price bands for ES futures based on real-time volatility levels measured by the VIX (CBOE Volatility Index). The bands evolve throughout the trading day, providing volatility-adjusted price targets.
Formulas:
Upper Band = Daily Open + (ES Price × VIX ÷ √252 ÷ 100)
Lower Band = Daily Open - (ES Price × VIX ÷ √252 ÷ 100)
The calculation uses the square root of 252 (trading days per year) to convert annualized VIX volatility into an expected daily move, then scales it as a percentage adjustment from the current day's open.
Features:
Real-time band calculation that updates throughout the trading session
Upper band (green) extends from the current day's open
Lower band (red) contracts from the current day's open
Inner upper band (green) at 50% of expected move
Inner lower band (red) at 50% of expected move
Middle Inner upper band (green) at 80% of expected move
Middle Inner lower band (red) at 80% of expected move
Information table displaying:
Current ES price and VIX level
Daily Open
Expected move
AlphaRank MA Lens – Multi-Timeframe Moving Average MapAlphaRank MA Lens – Multi-Timeframe Moving Average Map
AlphaRank MA Lens is a clean, open-source moving-average overlay that turns price action into an easy-to-read trend map. It focuses on structure and context only — no signals, no backtest, no hype — just a clear view of where price sits relative to key moving averages.
The script plots the 10 / 20 / 50 / 100 / 150 / 200 / 730 moving averages with full color control and a single “MA Type” switch, so you can flip the whole stack between SMA and EMA in one click. Instead of loading multiple separate MA indicators, this puts the full trend stack in one tool.
An optional background highlight lets you choose a reference MA (for example the 200 MA) and softly shade the chart:
Green when price is above that MA
Red when price is below it
This makes trend regime changes easy to see at a glance.
How traders typically use it (education only):
10/20/50 MAs → short-term trend and momentum.
100/150/200/730 MAs → bigger structural trend and “where price lives” in the long-term range.
Many traders consider conditions healthier when price and the short MAs are stacked above the longer MAs, and weaker when price trades below them.
Follow my work: AlphaRank
This script is for educational and analytical purposes only and does not provide trading advice or performance promises. Always combine it with your own judgment, testing, and risk management.
Abu Basel IQOption 2m Signals//@version=5
indicator("Abu Basel IQOption 2m Signals", overlay = true, timeframe = "", timeframe_gaps = true)
//========================
// الإعدادات
//========================
emaFastLen = input.int(9, "EMA سريع (9)")
emaSlowLen = input.int(21, "EMA بطيء (21)")
rsiLen = input.int(14, "RSI Length", minval = 2)
rsiBuyLevel = input.float(50.0, "RSI حد الشراء (أعلى من)", minval = 0, maxval = 100)
rsiSellLevel= input.float(50.0, "RSI حد البيع (أقل من)", minval = 0, maxval = 100)
bbLen = input.int(20, "Bollinger Length")
bbMult = input.float(2.0, "Bollinger Deviation")
showSignals = input.bool(true, "إظهار الأسهم (CALL / PUT)")
showBg = input.bool(true, "تلوين الخلفية عند الإشارات")
//========================
// المؤشرات الأساسية
//========================
emaFast = ta.ema(close, emaFastLen)
emaSlow = ta.ema(close, emaSlowLen)
basis = ta.sma(close, bbLen)
dev = bbMult * ta.stdev(close, bbLen)
bbUpper = basis + dev
bbLower = basis - dev
rsi = ta.rsi(close, rsiLen)
// رسم المتوسطات والبولينجر
plot(emaFast, title = "EMA 9", linewidth = 2)
plot(emaSlow, title = "EMA 21", linewidth = 2)
plot(basis, title = "BB Basis", linewidth = 1)
plot(bbUpper, title = "BB Upper", linewidth = 1, style = plot.style_line)
plot(bbLower, title = "BB Lower", linewidth = 1, style = plot.style_line)
//========================
// دوال أشكال الشموع الانعكاسية
//========================
bodySize = math.abs(close - open)
fullRange = high - low
upperWick = high - math.max(open, close)
lowerWick = math.min(open, close) - low
isSmallBody = bodySize <= fullRange * 0.3
// Hammer صاعدة (ذيل سفلي طويل)
bullHammer() =>
lowerWick > bodySize * 2 and upperWick <= bodySize and close > open
// Shooting Star هابطة (ذيل علوي طويل)
bearShootingStar() =>
upperWick > bodySize * 2 and lowerWick <= bodySize and close < open
// Bullish Engulfing
bullEngulfing() =>
close > open and close < open and close > open and open < close
// Bearish Engulfing
bearEngulfing() =>
close < open and close > open and close < open and open > close
// تجميع أنماط صعود/هبوط
bullPattern = bullHammer() or bullEngulfing()
bearPattern = bearShootingStar() or bearEngulfing()
//========================
// شروط الدخول
//========================
// تقاطع المتوسطات
bullCross = ta.crossover(emaFast, emaSlow) // صعود
bearCross = ta.crossunder(emaFast, emaSlow) // هبوط
// شروط شراء CALL:
// 1) تقاطع EMA9 فوق EMA21
// 2) السعر فوق خط وسط البولنجر
// 3) RSI أعلى من 50
// 4) شمعة انعكاسية صاعدة (Hammer أو Engulfing)
callCond = bullCross and close > basis and rsi > rsiBuyLevel and bullPattern
// شروط بيع PUT:
// 1) تقاطع EMA9 تحت EMA21
// 2) السعر تحت خط وسط البولنجر
// 3) RSI أقل من 50
// 4) شمعة انعكاسية هابطة (Shooting Star أو Bearish Engulfing)
putCond = bearCross and close < basis and rsi < rsiSellLevel and bearPattern
//========================
// رسم الإشارات على الشارت
//========================
plotshape(showSignals and callCond, title="CALL 2m",
style=shape.labelup, location=location.belowbar,
text="CALL\n2m", size=size.tiny)
plotshape(showSignals and putCond, title="PUT 2m",
style=shape.labeldown, location=location.abovebar,
text="PUT\n2m", size=size.tiny)
// تلوين الخلفية عند الإشارات
bgcolor(showBg and callCond ? color.new(color.green, 85) :
showBg and putCond ? color.new(color.red, 85) : na)
//========================
// شروط التنبيه (Alerts)
//========================
alertcondition(callCond, title="CALL 2m Signal",
message="Abu Basel Signal: CALL 2m on {{ticker}} at {{close}}")
alertcondition(putCond, title="PUT 2m Signal",
message="Abu Basel Signal: PUT 2m on {{ticker}} at {{close}}")






















