MACD with 1D Stochastic Confirmation Reversal StrategyOverview
The MACD with 1D Stochastic Confirmation Reversal Strategy utilizes MACD indicator in conjunction with 1 day timeframe Stochastic indicators to obtain the high probability short-term trend reversal signals. The main idea is to wait until MACD line crosses up it’s signal line, at the same time Stochastic indicator on 1D time frame shall show the uptrend (will be discussed in methodology) and not to be in the oversold territory. Strategy works on time frames from 30 min to 4 hours and opens only long trades.
Unique Features
Dynamic stop-loss system: Instead of fixed stop-loss level strategy utilizes average true range (ATR) multiplied by user given number subtracted from the position entry price as a dynamic stop loss level.
Configurable Trading Periods: Users can tailor the strategy to specific market windows, adapting to different market conditions.
Higher time frame confirmation: Strategy utilizes 1D Stochastic to establish the major trend and confirm the local reversals with the higher probability.
Trailing take profit level: After reaching the trailing profit activation level scrip activate the trailing of long trade using EMA. More information in methodology.
Methodology
The strategy opens long trade when the following price met the conditions:
MACD line of MACD indicator shall cross over the signal line of MACD indicator.
1D time frame Stochastic’s K line shall be above the D line.
1D time frame Stochastic’s K line value shall be below 80 (not overbought)
When long trade is executed, strategy set the stop-loss level at the price ATR multiplied by user-given value below the entry price. This level is recalculated on every next candle close, adjusting to the current market volatility.
At the same time strategy set up the trailing stop validation level. When the price crosses the level equals entry price plus ATR multiplied by user-given value script starts to trail the price with EMA. If price closes below EMA long trade is closed. When the trailing starts, script prints the label “Trailing Activated”.
Strategy settings
In the inputs window user can setup the following strategy settings:
ATR Stop Loss (by default = 3.25, value multiplied by ATR to be subtracted from position entry price to setup stop loss)
ATR Trailing Profit Activation Level (by default = 4.25, value multiplied by ATR to be added to position entry price to setup trailing profit activation level)
Trailing EMA Length (by default = 20, period for EMA, when price reached trailing profit activation level EMA will stop out of position if price closes below it)
User can choose the optimal parameters during backtesting on certain price chart, in our example we use default settings.
Justification of Methodology
This strategy leverages 2 time frames analysis to have the high probability reversal setups on lower time frame in the direction of the 1D time frame trend. That’s why it’s recommended to use this strategy on 30 min – 4 hours time frames.
To have an approximation of 1D time frame trend strategy utilizes classical Stochastic indicator. The Stochastic Indicator is a momentum oscillator that compares a security's closing price to its price range over a specific period. It's used to identify overbought and oversold conditions. The indicator ranges from 0 to 100, with readings above 80 indicating overbought conditions and readings below 20 indicating oversold conditions.
It consists of two lines:
%K: The main line, calculated using the formula (CurrentClose−LowestLow)/(HighestHigh−LowestLow)×100 . Highest and lowest price taken for 14 periods.
%D: A smoothed moving average of %K, often used as a signal line.
Strategy logic assumes that on 1D time frame it’s uptrend in %K line is above the %D line. Moreover, we can consider long trade only in %K line is below 80. It means that in overbought state the long trade will not be opened due to higher probability of pullback or even major trend reversal. If these conditions are met we are going to our working (lower) time frame.
On the chosen time frame, we remind you that for correct work of this strategy you shall use 30min – 4h time frames, MACD line shall cross over it’s signal line. The MACD (Moving Average Convergence Divergence) is a popular momentum and trend-following indicator used in technical analysis. It helps traders identify changes in the strength, direction, momentum, and duration of a trend in a stock's price.
The MACD consists of three components:
MACD Line: This is the difference between a short-term Exponential Moving Average (EMA) and a long-term EMA, typically calculated as: MACD Line=12-period EMA−26-period
Signal Line: This is a 9-period EMA of the MACD Line, which helps to identify buy or sell signals. When the MACD Line crosses above the Signal Line, it can be a bullish signal (suggesting a buy); when it crosses below, it can be a bearish signal (suggesting a sell).
Histogram: The histogram shows the difference between the MACD Line and the Signal Line, visually representing the momentum of the trend. Positive histogram values indicate increasing bullish momentum, while negative values indicate increasing bearish momentum.
In our script we are interested in only MACD and signal lines. When MACD line crosses signal line there is a high chance that short-term trend reversed to the upside. We use this strategy on 45 min time frame.
ATR is used to adjust the strategy risk management to the current market volatility. If volatility is low, we don’t need the large stop loss to understand the there is a high probability that we made a mistake opening the trade. User can setup the settings ATR Stop Loss and ATR Trailing Profit Activation Level to realize his own risk to reward preferences, but the unique feature of a strategy is that after reaching trailing profit activation level strategy is trying to follow the trend until it is likely to be finished instead of using fixed risk management settings. It allows sometimes to be involved in the large movements.
Backtest Results
Operating window: Date range of backtests is 2023.01.01 - 2024.08.01. It is chosen to let the strategy to close all opened positions.
Commission and Slippage: Includes a standard Binance commission of 0.1% and accounts for possible slippage over 5 ticks.
Initial capital: 10000 USDT
Percent of capital used in every trade: 30%
Maximum Single Position Loss: -4.79%
Maximum Single Profit: +20.14%
Net Profit: +2361.33 USDT (+44.72%)
Total Trades: 123 (44.72% win rate)
Profit Factor: 1.623
Maximum Accumulated Loss: 695.80 USDT (-5.48%)
Average Profit per Trade: 19.20 USDT (+0.59%)
Average Trade Duration: 30 hours
These results are obtained with realistic parameters representing trading conditions observed at major exchanges such as Binance and with realistic trading portfolio usage parameters.
How to Use
Add the script to favorites for easy access.
Apply to the desired timeframe between 30 min and 4 hours and chart (optimal performance observed on 45 min BTC/USDT).
Configure settings using the dropdown choice list in the built-in menu.
Set up alerts to automate strategy positions through web hook with the text: {{strategy.order.alert_message}}
Disclaimer:
Educational and informational tool reflecting Skyrex commitment to informed trading. Past performance does not guarantee future results. Test strategies in a simulated environment before live implementation
Stochasticoscillator
TradeBuilderOverview
TradeBuilder is an ever-growing toolbox that lets you combine and compound any number of bundled indicators and algorithms to create a compound strategy. At launch, we're including two Moving Averages (SMA, EMA), RSI, and Stochastic Oscillator, with many more to come. You can use any combination of indicators, be it just one, two, or all.
Key Concepts
Indicator Integration: Tradebuilder allows the use of Moving Averages, RSI, and Stochastic Oscillators, with customizable parameters for each. More indicators to come.
Mode Selection : Choose between Confirm Trend Mode (using indicators to confirm trends) and Momentum Mode (using indicators to spot reversals).
Trade Flexibility : Offers options for both long and short trades, enabling diverse trading strategies.
Customizable Inputs : Easily toggle indicators on or off and adjust specific settings like periods and thresholds.
Signal Generation : Combines multiple conditions to generate entry and exit signals.
Input Parameters:
Moving Average (MA):
use_ma : Enable this to include the Moving Average in your strategy.
ma_cross_type : Choose between "Close/MA" (price crossing the MA) or "MA/MA" (one MA crossing another).
ma_length : Set the period for the primary MA.
ma_type : Choose between "SMA" (Simple Moving Average) or "EMA" (Exponential Moving Average).
ma_length2 : Set the period for the secondary MA if using the "MA/MA" cross type.
ma_type2 : Set the type for the secondary MA.
Relative Strength Index (RSI):
use_rsi : Enable this to include RSI in your strategy.
rsi_length : Set the period for RSI calculation.
rsi_overbought : Define the overbought level.
rsi_oversold : Define the oversold level.
Stochastic Oscillator:
use_stoch : Enable this to include the Stochastic Oscillator in your strategy.
stoch_k : Set the %K period.
stoch_d : Set the %D period.
stoch_smooth : Define the smoothing factor.
stoch_overbought : Set the overbought level.
stoch_oversold : Set the oversold level.
Confirmation or Momentum Mode:
confirm_trend : Set this to true to use RSI and Stochastic Oscillator to confirm trends (long when above overbought, short when below oversold). Set to false to trade on momentum (short when above overbought, long when below oversold).
Tip: When set to false and used with just momentum oscillators like Stochastic or RSI, it's geared toward scalping as it essentially becomes momentum trading.
Trade Directions:
trade_long : Enable to allow long trades.
trade_short : Enable to allow short trades.
Example Strategy on E-mini S&P 500 Index Futures ( CME_MINI:ES1! ), 1-minute Chart
Let’s say you want to create a strategy to go long when:
A 5-period SMA crosses above a 100-period EMA.
RSI is above 20.
The Stochastic Oscillator is above 95.
Trend Confirmation Mode is on.
For short:
A 5-period SMA crosses below a 100-period EMA.
RSI is below 45.
The Stochastic Oscillator is below 5.
Trend Confirmation Mode is on.
Here’s how you would set it up in Tradebuilder:
use_ma = true
ma_cross_type = "MA/MA"
ma_length = 5
ma_type = "SMA"
ma_length2 = 100
ma_type2 = "EMA"
use_rsi = true
rsi_length = 14
rsi_overbought = 20
rsi_oversold = 45
use_stoch = true
stoch_k = 8
stoch_d = 1
stoch_smooth = 1
stoch_overbought = 95
stoch_oversold = 5
confirm_trend = true
trade_long = true
trade_short = false
Alerts
Here is how to set TradeBuilder alerts: open a TradingView chart, attach TradeBuilder, right-click on chart -> Add Alert. Condition: Symbol (e.g. NQ) >> TradeBuilder >> Open-Ended Alert >> Once Per Bar Close.
Development Roadmap
We plan to add many more compoundable indicators to TradeBuilder over the coming months from all walks of technical analysis, including Volume, Volatility, Trend Detection/Validation, Momentum, Divergences, Chart Patterns, Support/Resistance Analysis. etc.
Stochastic RSI Strategy (with SMA and VWAP Filters)The strategy is designed to trade on the Stochastic RSI indicator crossover signals.
Below are all of the trading conditions:
-When the Stochastic RSI crosses above 30, a long position is entered.
-When the Stochastic RSI crosses below 70, a short position is entered.
-The strategy also includes two additional conditions for entry:
-Long entries must have a positive spread value between the 9 period simple moving average and the 21 period simple moving average.
-Short entries must have a negative spread value between the 9 period simple moving average and the 21 period simple moving average.
-Long entries must also be below the volume-weighted average price.
-Short entries must also be above the volume-weighted average price.
-The strategy includes stop loss and take profit orders for risk management:
-A stop loss of 20 ticks is placed for both long and short trades.
-A take profit of 25 ticks is placed for both long and short trades.
Exponential Stochastic Strategywhat is Exponential Stochastic?
it is a modified version of the stochastic indicator. This strategy does not include pyramiding, repaint, trailing stop or take profit.
what it does?
It contains an extra input in addition to the stochastic indicator. Thanks to this input, different exponential weights can be given to the outputs and the indicator can be made more sensitive or insensitive. The strategy buys when the indicator leaves the overbought zone, sells when it leaves the oversold zone and always stays in the trade.
how it does it?
it uses this formula: i.hizliresim.com
Thanks to this formula, even if the weights given to the outputs change, the indicator always continues to take a value between 0 and 100.
how to use it ?
With the input named "exp", you can change the sensitivity of the indicator and develop different strategies. other inputs are the same as the stochastic indicator. Increasing the exp value causes the indicator to signal less, decreasing it makes it much more sensitive.
Profit Runner Strategy v2.0This is the strategy version of the recently posted Profit Runner v2.0 study. We include both together so that users can use the strategy for backtesting and figuring out the optimal settings for their specific usage and then implement those settings in the study version(which includes alerts for automated trading).
Green background highlights are buy signals and red background highlights are sell signals. Red and green filled area show the user's stop loss .