Binary Option Ultimate Backtester-V.1[tanayroy]The Binary Option strategy backtester gives the user extensive power to test any kind of strategy with advance trade management rules.
The strategy tester accepts external scripts as strategy sources. You can add your strategy and test it for historical stats.
Few assumption regarding strategy tester:
We are opening position at next candle after signal come
We are taking the position at opening price
Our call will be profitable if we get a green candle and put will be profitable if we get a red candle
We can open only one trade at a time. So if we are in trade, subsequent signals will be ignored.
How to make your strategy code compatible for strategy backtesting?
In your strategy code file add following lines:
Signal = is_call ? 1 : is_put ? -1 : 0
plot(Signal, title="🔌Connector🔌", display = display.none)
Is_call and is_put is your buy and sell signal. Plot the signal without displaying it in the chart. The new TradingView feature display = display.none, will not display the plot.
All Input options
Group: STRATEGY
Add Your Binary Strategy: External strategy to back test.
Trade Call/Put: Select CALL, to trade Call, PUT, to trade Put. Default is BOTH, Trading Call and Put both.
Number of Candles to Hold: How many candles to hold per trade. Default 1. If you want to hold the option for 30 minutes and you are testing your strategy in 15m intervals, use 2 candle holding periods.
GROUP: MARTINGALE
Martingale Level: Select up to 15 Martingale. Select 1 for no Martingale.
Use Martingale At Strategy Level: Instead of using Martingale per trade basis, using Martingale per signal basis. Like if we make a loss in the first signal, instead of starting martingale immediately we’ll wait for the next signal to put the martingale amount. For example if you start with $1 and you lose, at the next signal you will invest $2 to recover your losses.
Strategy Martingale Level: Select up to 15 Martingale at strategy signal level. Only workable if Use Martingale At Strategy Level is selected.
Type of Trade: Martingale trade type. Only workable if we are using Martingale Level more than 1.
It can be:
“SAME”: If you are trading CALL and incur a loss, you are taking CALL in subsequent Martingale levels.
“OPSITE”: if you are trading CALL and incur a loss, you are taking PUT in subsequent Martingale levels.
“FOLLOW CANDLE COLOR”: You are following candle color in Martingale levels, i.e if the loss candle is RED, you are taking PUT in subsequent candles.
“OPPOSITE CANDLE COLOR”: You are taking opposite candle color trade, i.e if the loss candle is RED, you are taking CALL in subsequent candle.
GROUP: TRADE MANAGEMENT
Initial Investment Per Option: Initial investment amount per trade
Payout: Per trade payout in percentage
Use Specific Session: Select to test trade on specific session.
Trading Session: Select trading session. Only workable if Use Specific Session is selected.
Use Date Range: Select to use test trades between dates.
Start Time: Select Start Time. Only workable if Use Date Range is selected.
End Time: Select end Time. Only workable if Use Date Range is selected.
Early Quit: Select to quit trade for the day after consecutive win or loss
Quit Trading after Consecutive Win: Number of consecutive wins. Only workable if early Early Quit is selected.
Quit Trading after Consecutive Loss: Number of consecutive losses. Only workable if early Early Quit is selected.
Buy/Sell Flip: Use buy signal for sell and sell signal for buy.
GROUP:STATS
Show Recent Stats: Show win trades in last 3,5,10,15,25 and 30 trades.
Show Daily Stats: Day wise win trades and total trades.
Show Monthly Stats: Month wise win trades and total trades.
Result and stat output:
Back tester without any strategy.
Strategy added with default option.
Stats with 7 Martingales. You can test up to 15.
Optional Stats:
Example Strategy code used :
//@version=5
indicator("Binary Option Strategy",overlay = true)
length = input.int(7, minval=1)
src = input(close, title="Source")
mult = input.float(3.0, minval=0.001, maxval=50, title="StdDev")
basis = ta.sma(src, length)
dev = mult * ta.stdev(src, length)
upper = basis + dev
lower = basis - dev
fab_candle_upcross=(high< upper and low>basis)
fab_candle_downcross= (high< basis and low>lower)
up_cross=ta.barssince(ta.crossover(close,basis))
down_cross=ta.barssince(ta.crossunder(close,basis))
is_first_up=false
is_first_down=false
if fab_candle_upcross
for a=1 to up_cross
if fab_candle_upcross
is_first_up:=false
break
else
is_first_up:=true
if fab_candle_downcross
for a=1 to down_cross
if fab_candle_downcross
is_first_down:=false
break
else
is_first_down:=true
//strategy for buying call
is_call=(is_first_up or is_first_down ) and close>open
//strategy for selling call
is_put=(is_first_up or is_first_down ) and close<open
Signal = is_call ? 1 : is_put ? -1 : 0
plot(Signal, title="🔌Connector🔌", display = display.none)
Statistics
BladeSCALPER by MetaSignalsProBladeSCALPER
The sharpest tool to scalp M and W patterns
--------------------------------------------------------------------------
✔️ Get a clear signal of the next probable reversal move
✔️ Get instantly the zone where the price will probably get attracted to
✔️ Adjust TP1/TP2/TP3 accordingly to the PowerZONES
✔️ Check the winning rate of the M & W patterns on a time period
✔️ Optimize the probability of success of the M & W patterns
---------------------------------------------------------------------------
📌 For who?
---------------
Initialy, scalping is based on small moves, supposedly more predictable than big ones and repeating this operation many times.
For that, scalping means usally daytrading and not everybody can/want to be a daytrader: managing one's emotions is just critical;
But you can also use this indicator on a bigger time frame and trade when you want the M & Ws!
So basicaly BladeSCALPER is for anybody who wants to trade succesfully M&W patterns whatever Timeframe, whatever asset!
📌 For which asset?
-------------------------
BladeSCALPER is universal and works fine on all assets and all time-frames;
📌Why we made these innovations?
--------------------------------------------
"Double Tops" and "Double Bottoms", commonely called "M" and "W" as the letter explicitely shows these patterns, are some of the most predictive patterns you can find.
To exploit them, we needed to have an all in one tool:
◾ a very sharp scalping and innovative tool with embed statistics
◾ identify Risk/Reward ratio for TakeProfits
◾ and advanced Supports and Resistances information i.e the PowerZONES
📌 How to trade with BladeSCALPER ?
-----------------------------------------------
🔹 ScalpUP / ScalpDOWN Signals
The signals are given when the patterns of M and W are identified, in real time and do not repaint.
☝️ Quite often the Market will test the bottoms and the tops before validating such a figure;
👉 Only enter the trade when the candle closes clearly inside the coloured zone and not immediately on the signal.
🔹 PowerZONES
We innovated on the basic Supports and Resistances concept by adding new features with:
◾ zones that correspond better to real life trading than lines
◾ zones that change color depending of their position vs price : they turn red is the price is below them and blue if they are above.
◾ strength / attractivity of these zones = how many times the Support/Resistance have been touched in the past that will magnetize the price
◾ and distance between these zones to give a clear picture
Importance of the PowerZONES
In the current version, the TPs do not adjust to the PowerZONES, precisely to be able to keep a global statistical view;
☝️ But when you plan to trade on a signal, the real relevance is to adjust them according to the PowerZONES, of course;
👉 When buying, place your TPs just below the consecutive PowerZONES that the price could test
👉 When selling, place them just above the consecutive PowerZONES
🔹 TP1/TP2/TP3
TakeProfits are set theoretically and based on 3 risk/reward ratios: 1 / 1.5 / 2 ;
But of course this is just a setting to get an overall view of the effectiveness of the pattern on the current asset;
if you change these settings, you'll see that the Stats change accordingly.
☝️ Again, when you plan to trade on a signal, the real relevance is to adjust them according to the PowerZONES, of course;
🔹 StatsPANEL
With this innovative feature you can now see immediately
◾ the probability of win, based on the past patterns
◾ the exacts number of trades that have reached the TP1/TP2/TP3
◾ and more importantly the gains made by these trades in pips
We introduce also 2 important possibilities to improve the precision and relience of BladeSCALPER
◾ the PatternFACTOR can be changed; it defines a key percentage of the M & W patterns
◾ the MoveringAverageFILTER can be activated to
◽ suppress M patterns when the price is below the selected MovingAverage
◽ suppress W patterns when the price is over the selected MovingAverage
👉 Modifying these variables will change immediately the statistics just like the position of the TP1/TP2/TP3 and HistoryMax variables.
📌 Importance of setting up a Multi TimeFrame and doing a trend analysis
------------------------------------------------------------------------------------------
Even if you are on a scalping mode, it is crucial you set up a Multi Time Frame workspace and that you conduct a trend analysis before entering the market.
If you don't, you won't maximize your chances;
No indicator is 100% reliable, because the market cannot be modelized; anyone who tells you otherwise is lying to your face;
However, a statistical approach to the market is possible, because agents are not incoherent.
This is the meaning of stats we apply on double tops and double bottoms;
But to reinforce this point, you need to know what's happening on the next higher time unit to get a global view.
To do this, it's important to do a trend analysis or have a trend analysis tool.
---------------------------------------------------------------------------------------------------
🎛️ Configuration
----------------------
◾ Buy/Sell Signals: choose if you want to see only W or only M pattern signals
◾ PowerZones: uncheck if you don't want to see them (not recommanded)
◾ RewardBoxText: uncheck if you don't want to see the words "Entry, TP1, TP2, TP3"
◾ TakeProfit1/TakeProfit2/TakeProfit3: by default correspond to the multiple of the risk zone in grey under/above "Entry" i.e it is the classic concept of Risk/Reward ratio
◾ PowerZoneTouch: sets the number of time the zone has been touched
◾ PowerZoneDensity: increase this number if you want the number of zones to increase and reversely
◾ RewardBoxLength: adjust the standard number to the length of the anticipated move in duration
◾ StopLossExtraPoints: for a W pattern (ScalpUP) will bring lower the lower border of the RewardBOX; in a M pattern (ScalpDOWN) will bring higher the higher border of the RewardBOX; it will automatically move the distance of the TP1/TP2/TP3
◾ HistoryMax: the number of units taken into account to set the PowerZONES and the past M & W patterns
◾ PatternFactor: defines a key percentage of the M & W patterns
◾ MovingAverageFilter:
◽ untick (by default) : the filter is OFF
◽ ticked : the filter is ON
◾ MovingAveragePeriod: choose the speed of the average
◾ MovingAverageType: choose among all the types of averages available
◾ Applied to: define on which available moment of the Price the average is applied (close, open, highest...)
🛠️ Calculation & Precisions
------------------------------------
🔹 TP1/TP2/TP3
the 3 risk/reward ratios: 1 / 1.5 / 2 are multiples of the height of the grey zone = distance between your StopLoss and the entry line;
🔹 %WIN
Note that the % of success (%WIN) must be entered correctly;
Your risk/reward ratio is key and more important than the % success of the signal; you can have a % success of 30% (%WIN) which creates more points earned than a % success of 60% depending on your risk/reward ratio = the position of your TPs;
🔹 Calculation of points/pips
These are full points and we don't calculate partial outputs.
So if you have a tp1 at 20 and a tp2 at 100, if you get to tp2 you get 100 and not 20+100.
Stoplosses are of course calculated in negative.
🔹 PowerZONES
The originality of our concept is to test how many times a zone has been touched
The more the market has touched this zone the more probable it becomes a strategic zone where the liquidity will accumulate and thus will be chased!
Stablecoins market capA simple indicator that displays either the aggregated market cap of the top five stablecoins, or it displays all coins at once (look in the settings).
Because of limitations with the sourced data the indicator only works on the daily timeframe or higher.
Risk to Reward - FIXED SL BacktesterDon't know how to code? No problem! TradingView is an excellent platform for you. ✅ ✅
If you have an indicator that you want to backtest using a risk-to-reward ratio or fixed take profit/stop loss levels, then the Risk to Reward - FIXED SL Backtester script is the perfect solution for you.
introducing Risk to Reward - FIXED SL Backtester Script which will allow you to test any indicator / Signal with RR or Fixed SL system
How does it work ?!
Once you connect the script to your indicator, it will analyze your entry points and perform calculations based on them. It will then open trades for you according to the specified inputs in the script settings.
HOW TO CONNECT IT to your indicator?
simply open your indicator code and add the below line of code to it
plot(Signal ? 100 : 0,"Signal",display = display.data_window)
Replace Signal with the long condition from your own indicator. You can also modify the value 100 to any number you prefer. After that, open the settings.
Once the script is connected to your indicator, you can choose from two options:
Risk To Reward Ratio System
Fixed TP/ SL System
🔸if you select the Risk to Reward System ⤵️
The Risk-to-Reward System requires the calculation of a stop loss. That's why I have included three different types of stop-loss calculations for you to choose from:
ATR Based SL
Pivot Low SL
VWAP Based SL
Your stop loss and take profit levels will be automatically calculated based on the selected stop loss method and your risk-to-reward ratio.
You can also adjust their values to match your desired risk level. The trades will be displayed on the chart.
with the ability to change their values to match your risk.
once this is done, trades will be displayed on the chart
🔸if you select the Fixed system ⤵️
You have 2 inputs, which are FIXED TP & Fixed SL
input the values you want, and trades will be on your chart...
I have also added a Breakeven feature for you.
with this Breakeven feature the trade will not just move SL to Entry ?! NO NO, it will place it above entry by a % you input yourself, so you always win! 🚀
Here is an example
Enjoy, and have fun, if you have any questions do not hesitate to ask
Pip Counter with AlertsThis script can be used to count number of pips on a candle , use settings to change precision(decimals) , look back candles and alerts for number of pips change and percentage change on a candle. This works for only forex. Mention any suggestions or improvements in the comments. Hope it is useful for you all .
CE - Market Performance TableThe 𝓜𝓪𝓻𝓴𝓮𝓽 𝓟𝓮𝓻𝓯𝓸𝓻𝓶𝓪𝓷𝓬𝓮 𝓣𝓪𝓫𝓵𝓮 is a sophisticated market tool designed to provide valuable insights into the current market trends and the approximate current position in the Macroeconomic Regime.
Furthermore the 𝓜𝓪𝓻𝓴𝓮𝓽 𝓟𝓮𝓻𝓯𝓸𝓻𝓶𝓪𝓷𝓬𝓮 𝓣𝓪𝓫𝓵𝓮 provides the Correlation Implied Trend for the Asset on the Chart. Lastly it provides information about current "RISK ON" or "RISK OFF" periods.
Methodology:
𝓜𝓪𝓻𝓴𝓮𝓽 𝓟𝓮𝓻𝓯𝓸𝓻𝓶𝓪𝓷𝓬𝓮 𝓣𝓪𝓫𝓵𝓮 tracks the 15 underlying Stock ETF's to identify their performance and puts the combined performances together to visualize 42MACRO's GRID Equity Model.
For this it uses the below ETF's:
Dividends (SPHD)
Low Beta (SPLV)
Quality (QUAL)
Defensives (DEF)
Growth (IWF)
High Beta (SPHB)
Cyclicals (IYT, IWN)
Value (IWD)
Small Caps (IWM)
Mid Caps (IWR)
Mega Cap Growth (MGK)
Size (OEF)
Momentum (MTUM)
Large Caps (IWB)
Overall Settings:
The main time values you want to change are:
Correlation Length
- Defines the time horizon for the Correlation Table
ROC Period
- Defines the time horizon for the Performance Table
Normalization lookback
- Defines the time horizon for the Trend calculation of the ETF's
- For longer term Trends over weeks or months a length of 50 is usually pretty accurate
Visuals:
There is a variety of options to change the visual settings of what is being plotted and the two table positions and additional considerations.
Everything that is relevant in the underlying logic that can help comprehension can be visualized with these options.
Market Correlation:
The Market Correlation Table takes the Correlation of the above ETF's to the Asset on the Chart, it furthermore uses the Normalized KAMA Oscillator by IkkeOmar to analyse the current trend of every single ETF.
It then Implies a Correlation based on the Trend and the Correlation to give a probabilistically adjusted expectation for the future Chart Asset Movement. This is strengthened by taking the average of all Implied Trends.
With this the Correlation Table provides valuable insights about probabilistically likely Movement of the Asset, for Traders and Investors alike, over the defined time duration.
Market Performance:
𝓜𝓪𝓻𝓴𝓮𝓽 𝓟𝓮𝓻𝓯𝓸𝓻𝓶𝓪𝓷𝓬𝓮 𝓣𝓪𝓫𝓵𝓮 is the actual valuable part of this Indicator.
It provides valuable information about the current market environment (whether it's risk on or risk off), the rough GRID models from 42MACRO and the actual market performance.
This allows you to obtain a deeper understanding of how the market works and makes it simple to identify the actual market direction.
Utility:
The 𝓜𝓪𝓻𝓴𝓮𝓽 𝓟𝓮𝓻𝓯𝓸𝓻𝓶𝓪𝓷𝓬𝓮 𝓣𝓪𝓫𝓵𝓮 is divided in 4 Sections which are the GRID regimes:
Economic Growth:
Goldilocks
Reflation
Economic Contraction:
Inflation
Deflation
Top 5 Equity Style Factors:
Are the values green for a specific Column? If so then the market reflects the corresponding GRID behavior.
Bottom 5 Equity Style Factors:
Are the values red for a specific Column? If so then the market reflects the corresponding GRID behavior.
So if we have Goldilocks as current regime we would see green values in the Top 5 Goldilocks Cells and red values in the Bottom 5 Goldilocks Cells.
You will find that Reflation will look similar, as it is also a sign of Economic Growth.
Same is the case for the two Contraction regimes.
Premium VWAP Trendfollow Strategy [wbburgin]This is a strongly-revised version of my VWAP Trendfollow Strategy, which follows a substantial reworking to address various structural inefficiencies with the script, such as the narrowing of the standard deviation band upon anchor reset. I will continue updating the original script with planned adjustments, this is a different proof-of-concept that builds off of the original script thesis with a different calculation method and execution.
This strategy is not built for any specific asset or timeframe, and has been backtested on crypto and equities from 1 min-1 day. The previous experimental strategy was heavily-correlated with the actual movement of the asset, which added unpalatable risk to the strategy and increased drawdown. This revised form has a more stable backtesting curve, but I want to heavily emphasize that I cannot guarantee that the strategy will be profitable for your circumstances. Backtesting only goes so far and every exchange has a different fee schedule, which can substantially eat into your profits. At the bottom I will explain the parameters behind the strategy results.
**********
The VWAP Trendfollow Strategy begins with a simple premise: to enter long when the price breaks above the upper standard deviation of a VWAP, and to close the position when the price breaks below the lower standard deviation of the VWAP. This is more effective than initiating the same strategy for a VWMA because the VWAP resets its anchor depending on your chosen anchor period, and the act of resetting its anchor also resets its standard deviation value. As a consequence, in sustained uptrends, the standard deviation is pulled upward to meet the price when the anchor resets, instead of requiring the price to fall all the way back down, as in the lower standard deviation band of the VWMA. This essentially acts as the VWAP itself raising the stop loss at each anchor period, which works well for the overall trend-following strategy.
However, this narrowing can still have consequences for a simple breakout strategy; as the price gradually oscillates towards above or below its standard deviation band, it may cross over the other and produce false signals. This oscillation is worrisome especially when fees are taken into account.
Thus, the premium VWAP Trendfollow strategy has a variable width which detects abnormal narrowing of the band, and adjusts it until it is reasonable to close the variability period. Additionally, a filter is added to the open/close signals to soften the frequency of signals without impacting performance significantly.
This script contains an ATR stop loss and an ATR take profit (which is also a difference between it and the original experimental script), with customizable inputs. The strategy results shown below are with initial capital of $1000, qty entry of 10%, and commissions of 0.06%. It works best on 24/7 instruments, like crypto, but I have found it also works with FAANG stocks or other high volatility / high volume assets. The issue with stocks, however, is that the price can jump/plummet because of abnormal events after-hours, which the strategy cannot pick up on until pre-trading begins the next morning. For that reason I suggest it be used on crypto and, because of its low % profitable (but high average winning trade in relation to its average losing trade), be used on an exchange that has minimal fees or volume-based discounts. In the unfortunate case that you cannot find a minimal fee or volume-discounted fee exchange (such as fellow Americans following the liquidity-retreat on Binance.US), I encourage you to test out the higher anchor periods for the higher timeframes, which will reduce the number of trades and increase the average % per trade.
Additionally, this is a long-term strategy used best for accumulation. It is currently long-only; that may change based off of user input.
**********
Disclaimer
Copyright by wbburgin.
The information contained in my Scripts/Indicators/Algorithms does not constitute financial advice or a solicitation to buy or sell any securities of any type. I will not accept liability for any loss or damage, including without limitation any loss of profit, which may arise directly or indirectly from the use of or reliance on such information.
All investments involve risk, and the past performance of a security, industry, sector, market, financial product, trading strategy, backtest, or individual's trading does not guarantee future results or returns. Investors are fully responsible for any investment decisions they make. Such decisions should be based solely on an evaluation of their financial circumstances, investment objectives, risk tolerance, and liquidity needs.
[MAD] Support / ResistanceSupport/Resistance - Multi-Timeframe Data Plotter
This Pine Script indicator provides users with the ability to analyze various technical indicators, including Bollinger Bands, Simple Moving Averages (SMA), Exponential Moving Averages (EMA), and Pivot Points, across different timeframes. It visually represents these indicators on the chart, allowing for comprehensive analysis.
Key Features:
Bollinger Bands: The indicator supports 6 different timeframes for Bollinger Bands. Users can customize the length of the Bollinger Bands for each timeframe and choose whether to display levels and plots.
Simple Moving Averages (SMA): The indicator supports 4 different timeframes for SMAs. Users can define custom lengths for the SMAs and choose which ones to display on the chart or in the S/R Screen.
Exponential Moving Averages (EMA): Similar to SMAs, the indicator supports 4 different timeframes for EMAs. Users can define custom lengths for the EMAs and choose which ones to display on the chart or in the S/R Screen.
Pivot Points: The indicator supports 4 different timeframes for Pivot Points. Users can choose between Traditional and Fibonacci calculation methods and customize the appearance of the pivot levels.
Global Switches: Users have the option to enable or disable the display of pivots, Bollinger Bands, SMAs, EMAs, open/close/high/low values, horizon plot, and VPR-style plot (weighted Gaussian addition).
Plot Limitation: Users can limit the plotting of support and resistance lines by specifying a percentage up/down.
This indicator offers extensive customization and flexibility, allowing users to analyze the market using these technical indicators across multiple timeframes.
Please refer to this screenshot for an overview of all available settings:
Additionally, the indicator includes a multiplot-chartselect feature to address the limitation of 32 data streams with colors. This feature enables the selection of 10 SMAs or EMAs from different timeframes, along with 3 timeframes of Bollinger Bands and the daily open/close values, all in a single packed indicator. Here is an example of how the data can be displayed:
Enabling all features simultaneously may result in visual overload. However, for users who wish to view specific indicators, this indicator provides all the necessary options. Please refer to this screenshot for an example of various indicators displayed:
To enhance visibility, all lines are weighted, and line and label positions can be dynamically shifted based on these weights.
Webby's RSI 2.0Webby's RSI (Really Simple Indicator) 2.0 or version 5.150 as Mike himself calls it, builds upon the original Webby RSI by changing the way we measure extension from the 21-day exponential moving average.
Instead using the percentage of the low versus the 21-day exponential moving average, version 2 uses a multiple of the securities 50 day ATR (average true range) to determine the extension.
Version 2.0 also comes with some new additions, such as measuring the high vs 21-day exponential moving average when a security is below it, as well as an ATR extension from the 10-day simple moving average that Mike looks to as a guide to take partials.
Binary Option Strategy Tester with Martingale-Basic V.2In Binary options, strategy testing is a bit different. The strategy result depends upon expiry intervals and payout ratio.
My previous script was a try to resolve this but has some bugs in specific choices. The new version overcame those and added some new features useful for binary option strategy testing.
Assumption:
We are opening position at next candle after signal come
Chart interval is option expiry time.
We are taking the position at opening price
Our call will be profitable if we get a green candle and put will be profitable if we get a red candle
We can open only one trade at a time. So if we are in trade, subsequent signals will be ignored.
All Input Options:
Test Call/Put individually or both. Default BOTH
Select up to 5 Martingale levels. Default 2
Type of Martingale Trade. Default “SAME”
“SAME”: If you are trading CALL and incur a loss, you are taking CALL in subsequent Martingale levels.
“OPSITE”: if you are trading CALL and incur a loss, you are taking PUT in subsequent Martingale levels.
“FOLLOW CANDLE COLOR”: You are following candle color in Martingale levels, i.e if the loss candle is RED, you are taking PUT in subsequent candles.
“OPPOSITE CANDLE COLOR”: You are taking opposite candle color trade, i.e if the loss candle is RED, you are taking CALL in subsequent candle.
Select Specific Trading Session. Please select “USE SPECIFIC SESSION”. Default: TRUE
Put the investment amount per option. Default: 10
Payout ratio. Default: 80%
The strategy is taken from Vdub Binary Options SniperVX v1 (by @vdubus). I have deleted extra parts and kept only the necessary parts.
Result Table
Signal and Win Levels:
Signal and Loss:
Please note that Binary options trading is very risky. You must be aware of the risk and be willing to accept them in order to invest in binary options. Only invest what you can afford to lose. The past performance of any trading system, strategy, or methodology is not necessarily indicative of future results.
Buy&Sell Bullish Engulfing - The Quant Science🇺🇸
GENERAL OVERVIEW
Buy&Sell Bullish Engulfing - The Quant Science It is a Buy&Sell strategy based on the 'Bullish Engulfing' candlestick pattern. The main goal of the strategy is to achieve a consistent and sustainable return over time, with a manageable level of risk.
Bullish Engulfing
The template was developed at the top of the Indicator provided by TradingView called 'Engulfing - Bullish'.
ENTRY AND EXIT CRITERIA
Entry: A single long order is opened when the candlestick pattern is formed, and the percentage size of the order (%) is fixed by the trader through the user interface.
Exit: The long trade is closed on a percentage equity take profit-stop loss.
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
🇮🇹
PANORAMICA GENERALE
Buy&Sell Bullish Engulfing - The Quant Science è una strategia Buy&Sell basata sul candlestick pattern 'Bullish Engulfing'. L'obiettivo principale della strategia è ottenere un ritorno costante e sostenibile nel tempo, con un livello gestibile di rischio.
Bullish Engulfing
Il template è stato sviluppato al top dell' Indicatore fornito da Trading View chiamato 'Engulfing - Bullish'.
CRITERI DI ENTRATA E USCITA
Entrata: viene aperto un singolo ordine long quando si forma il candlestick pattern, la size percentuale dell'ordine (%) viene selezionato tramite l'interfaccia utente dal trader.
Uscita: la chiusura della posizione avviene unicamente tramite un take profit-stop loss percentuale calcolato sul capitale.
Upgraded WatermarkThis mimics the built in watermark feature, but adds the ability to change location as well as see an equities sector and industry group.
Cycles AnalysisI strongly believe in cycles, so I wanted to create something that would give a visual representation of bull/bear markets and give a prediction based on the previous data. It's up to you how to decide what is a bull/bear cycle. There is no single rule for all assets because 20% drop in SP500 starts a bear market in traditional markets, while 35% drop for Bitcoin is a Tuesday. You have two options on how to decide when markets turn: either by a % change (traditional definition) or if there is no new high/low after X days. A softer version to show periods of no new highs/lows is to use the Stagnation option. Stagnation periods hava the same logic as the cycle change by X days: if there is no new high/low then we treat this period as a stagnation. The difference is that stagnation periods do not change cycle directions and do not participate in calculations.
The script also draws a possible "predictions" zone where the current cycle might end up. There is no magic here, it just takes previous cycles' size to draw the possible boundaries. If you decide to use percentiles then the box area will be taken from the percentiles calculations, otherwise it will come from the full data. "x" in the predictions zone represents a target mean (average) value, "o" represents a target median value.
A few things to keep in mind:
- this script is not supposed to be used in trading. It was created for analysis. It repaints. And when I say "it repaints" - it might like repaint the last 6 months of data if a new low comes and we are in a stagnation period (aka not a financial advice).
- it doesn't work with replays as it does calculations only once on the last candle.
- you need at least 3 periods to be able to calculate percentiles. And after this it will remove at least 1 period on each side. Which means that 90 percentile will not be a real 90 percentile until you have enough periods for it to be (20 in this specific case).
- it assumes that a year = 360 days, and a month = 30 days. So the duration presentation might not be exact, until you move to the day level.
- I had macro analysis in mind when I created the script, but nothing stops you from using it in a 1m time frame for BTC. Just change the time duration presentation.
- the last period is not finished, so it doesn't participate in calculations.
lib_priceactionLibrary "lib_priceaction"
a library for everything related to price action, starting off with displacements
displacement(len, min_strength, o, c)
calculate if there is a displacement and how strong it is
Parameters:
len (int) : The amount of candles to consider for the deviation
min_strength (float) : The minimum displacement strength to trigger a signal
o (float) : The source series on which calculations are based
c (float) : The source series on which calculations are based
Returns: a tuple of (bool signal, float displacement_strength)
Overgeared Library Economic Calendar-----------------------------------------------------------
Base on script -> jdehorty/EconomicCalendar
Very Big Thanks to jdehorty/EconomicCalendar
-----------------------------------------------------------
Trend Correlation HeatmapHello everyone!
I am excited to release my trend correlation heatmap, or trend heatmap for short.
Per usual, I think its important to explain the theory before we get into the use of the indicator, so let's get into the theory!
The theory:
So what is a correlation?
Correlation is the relationship one variable has to another. Correlations are the basis of everything I do as a quantitative trader. From the correlation between the same variables (i.e. autocorrelation), the correlation between other variables (i.e. VIX and SPY, SPY High and SPY Low, DXY and ES1! close, etc.) and, as well, the correlation between price and time (time series correlation).
This may sound very familiar to you, especially if you are a user, observer or follower of my ideas and/or indicators. Ninety-five percent of my indicators are a function of one of those three things. Whether it be a time series based indicator (i.e.my time series indicator), whether it be autocorrelation (my autoregressive cloud indicator or my autocorrelation oscillator) or whether it be regressive in nature (i.e. my SPY Volume weighted close, or even my expected move which uses averages in lieu of regressive approaches but is foundational in regression principles. Or even my VIX oscillator which relies on the premise of correlations between tickers.) So correlation is extremely important to me and while its true I am more of a regression trader than anything, I would argue that I am more of a correlation trader, because correlations are the backbone of how I develop math models of stocks.
What I am trying to stress here is the importance of correlations. They really truly are foundational to any type of quantitative analysis for stocks. And as such, understanding the current relationship a stock has to time is pivotal for any meaningful analysis to be conducted.
So what is correlation to time and what does it tell us?
Correlation to time, otherwise known and commonly referred to as "Time Series", is the relationship a ticker's price has to the passing of time. It is displayed in the traditional Pearson Correlation Coefficient or R value and can be any value from -1 (strong negative relationship, i.e. a strong downtrend) to + 1 (i.e. a strong positive relationship, i.e. a strong uptrend). The higher or lower the value the stronger the up or downtrend is.
As such, correlation to time tells us two very important things. These are:
a) The direction of the stock; and
b) The strength of the trend.
Let's take a look at an example:
Above we have a chart of QQQ. We can see a trendline that seems to fit well. The questions we ask as traders are:
1. What is the likelihood QQQ breaks down from this trendline?
2. What is the likelihood QQQ continues up?
3. What is the likelihood QQQ does a false breakdown?
There are numerous mathematical approaches we can take to answer these questions. For example, 1 and 2 can be answered by use of a Cumulative Distribution Density analysis (CDDA) or even a linear or loglinear regression analysis and 3 can be answered, more or less, with a linear regression analysis and standard error ascertainment, or even just a general comparison using a data science approach (such as cosine similarity or Manhattan distance).
But, the reality is, all 3 of these questions can be visualized, at least in some way, by simply looking at the correlation to time. Let's look at this chart again, this time with the correlation heatmap applied:
If we look at the indicator we can see some pivotal things. These are:
1. We have 4, very strong uptrends that span both higher AND lower timeframes. We have a strong uptrend of 0.96 on the 5 minute, 50 candle period. We have a strong uptrend at the 300 candle lookback period on the 1 minute, we have a strong uptrend on the 100 day lookback on the daily timeframe period and we have a strong uptrend on the 5 minute on the 500 candle lookback period.
2. By comparison, we have 3 downtrends, all of which have correlations less than the 4 uptrends. All of the downtrends have a correlation above -0.8 (which we would want lower than -0.8 to be very strong), and all of the uptrends are greater than + 0.80.
3. We can also see that the uptrends are not confined to the smaller timeframes. We have multiple uptrends on multiple timeframes and both short term (50 to 100 candles) and long term (up to 500 candles).
4. The overall trend is strengthening to the upside manifested by a positive Max Change and a Positive Min change (to be discussed later more in-depth).
With this, we can see that QQQ is actually very strong and likely will continue at least some upside. If we let this play out:
We continued up, had one test and then bounced.
Now, I want to specify, this indicator is not a panacea for all trading. And in relation to the 3 questions posed, they are best answered, at least quantitatively, not only by correlation but also by the aforementioned methods (CDDA, etc.) but correlation will help you get a feel for the strength or weakness present with a stock.
What are some tangible applications of the indicator?
For me, this indicator is used in many ways. Let me outline some ways I generally apply this indicator in my day and swing trading:
1. Gauging the strength of the stock: The indictor tells you the most prevalent behavior of the stock. Are there more downtrends than uptrends present? Are the downtrends present on the larger timeframes vs uptrends on the shorter indicating a possible bullish reversal? or vice versa? Are the trends strengthening or weakening? All of these things can be visualized with the indicator.
2. Setting parameters for other indicators: If you trade EMAs or SMAs, you may have a "one size fits all" approach. However, its actually better to adjust your EMA or SMA length to the actual trend itself. Take a look at this:
This is QQQ on the 1 hour with the 200 EMA with 200 standard deviation bands added. If we look at the heatmap, we can see, yes indeed 200 has a fairly strong uptrend correlation of 0.70. But the strongest hourly uptrend is actually at 400 candles, with a correlation of 0.91. So what happens if we change the EMA length and standard deviation to 400? This:
The exact areas are circled and colour coded. You can see, the 400 offers more of a better reference point of supports and resistances as well as a better overall trend fit. And this is why I never advocate for getting married to a specific EMA. If you are an EMA 200 lover or 21 or 51, know that these are not always the best depending on the trend and situation.
Components of the indicator:
Ah okay, now for the boring stuff. Let's go over the functionality of the indicator. I tried to keep it simple, so it is pretty straight forward. If we open the menu here are our options:
We have the ability to toggle whichever timeframes we want. We also have the ability to toggle on or off the legend that displays the colour codes and the Max and Min highest change.
Max and Min highest change: The max and min highest change simply display the change in correlation over the previous 14 candles. An increasing Max change means that the Max trend is strengthening. If we see an increasing Max change and an increasing Min change (the Min correlation is moving up), this means the stock is bullish. Why? Because the min (i.e. ideally a big negative number) is going up closer to the positives. Therefore, the downtrend is weakening.
If we see both the Max and Min declining (red), that means the uptrend is weakening and downtrend is strengthening. Here are some examples:
Final Thoughts:
And that is the indicator and the theory behind the indicator.
In a nutshell, to summarize, the indicator simply tracks the correlation of a ticker to time on multiple timeframes. This will allow you to make judgements about strength, sentiment and also help you adjust which tools and timeframes you are using to perform your analyses.
As well, to make the indicator more user friendly, I tried to make the colours distinctively different. I was going to do different shades but it was a little difficult to visualize. As such, I have included a toggle-able legend with a breakdown of the colour codes!
That's it my friends, I hope you find it useful!
Safe trades and leave your questions, comments and feedback below!
Price Delta HeatmapThe Price Delta Heatmap is an indicator designed to visualize the price changes of an asset over time. It helps traders identify and analyze significant price movements and potential volatility. The indicator calculates the price delta, which is the difference between the current close price and the previous close price. It then categorizes the price deltas into different color ranges to create a heatmap-like display on the chart.
The indicator uses user-defined thresholds to determine the color ranges. These thresholds represent the minimum price change required for a specific color to be assigned. The thresholds are adjustable to accommodate different asset classes and trading strategies. Positive price deltas are associated with bullish movements, while negative price deltas represent bearish movements.
The indicator plots bars color-coded according to the price delta range it falls into. The color ranges can be customized to match personal preferences or specific trading strategies. Additionally, the indicator includes signal shapes below the bars to highlight significant positive or negative price deltas. Traders can adjust the threshold values based on their preferred sensitivity to price changes. Higher threshold values may filter out minor price movements and focus on more significant shifts, while lower threshold values will capture even minor fluctuations.
****The default settings have the thresholds set to levels of 100, 50, 20, 10, 0, -10, -20, -50, and -100. These numbers are well-suited for assets such as Ethereum or Bitcoin which are larger in price than an asset that has a price of $1.50, for example. To compensate, adjust the thresholds in the settings to reflect the price delta on the desired asset. All coloration and horizontal line plots will adjust to reflect these changes.****
Traders can interpret the Price Delta Heatmap as follows:
-- Bright green bars indicate the highest positive price deltas, suggesting strong bullish price movements.
-- Green bars represent positive price deltas above the third threshold, indicating significant bullish price changes.
-- Olive bars indicate positive price deltas above the second threshold, suggesting moderate bullish price movements.
-- Yellow bars represent positive price deltas above the lowest threshold, indicating minor bullish price changes. This color is reflected on the negative side as well. Yellow bars below zero indicate negative price deltas below the lowest threshold, suggesting minor bearish price changes.
-- White bars represent zero price deltas, indicating no significant price movement.
-- Orange bars represent negative price deltas below the second threshold, indicating moderate bearish price movements.
-- Red bars indicate negative price deltas below the third threshold, suggesting significant bearish price changes.
-- Maroon bars represent the lowest negative price deltas, indicating strong bearish price movements.
The coloration of the Price Delta line itself is determined by the line's relation to the second positive and second negative thresholds (default +/- 20) - if the line is above the second positive threshold, the line is colored lime (and is reflected in a lime arrow at the bottom of the indicator); if the line is below the second negative threshold, the line is colored fuchsia (also reflected as an arrow); if the line is between thresholds, it is colored aqua.
The Price Delta Heatmap can be used in various trading strategies and applications. Some potential use cases include:
-- Trend identification : The indicator helps traders identify periods of high volatility and potential trend reversals.
-- Volatility analysis : By observing the color changes in the heatmap, traders can gauge the volatility of an asset and adjust their risk management strategies accordingly.
-- Confirmation tool : The indicator can be used as a confirmation tool alongside other technical indicators, such as trend-following indicators or oscillators.
-- Breakout trading : Traders can look for price delta bars of a specific color range to identify potential breakout opportunities.
However, it's important to note that the Price Delta Heatmap has certain limitations. These include:
-- Lagging nature : The indicator relies on historical price data, which means it may not provide real-time insights into price movements.
-- Sensitivity to thresholds : The choice of threshold values affects the indicator's sensitivity and may vary depending on the asset being traded. It requires experimentation and adjustment to find optimal values.
-- Market conditions : The indicator's effectiveness may vary depending on market conditions, such as low liquidity or sudden news events.
Traders should consider using the Price Delta Heatmap in conjunction with other technical analysis tools and incorporate risk management strategies to enhance their trading decisions.
Currency Conversion ChartReleasing this utility indicator I made for myself and thought others may find it helpful.
It is a simple currency conversion indicator. I personally trade both the TSX and the NYSE and hold both CAD and USD. As such, when I take positions in either or, I like to track how the currency I hold is affecting my position.
What the indicator does:
So, as indicated above, it converts a ticker's candlestick chart into the designated currency. You can either manually set the currency exchange rate, or search the currency exchange chart on Tradingview and it will auto-convert:
Purple arrow: The purple arrow points to the auto-input. You can search the currency you want to convert and it will automatically apply the conversion. It defaults to USD to CAD, but you can do USD to JPY, AUD to CAD, whatever currency you want provided it is available on tradingview. Alternatively, you can select manual conversion and input the manual conversion rate to apply.
Green Arrow: The green arrow refers to the conversion type. The indicator will default to static auto. This will pull the previous daily close. As currency trades at all hours, real-time is not advisable because the currency is in constant flux. Static will provide more stable results. However, you can toggle between the two. You can also just toggle Manual conversion.
Yellow arrow and red arrow: These pertain to position management. The indicator will display the change in the currency price over the designated amount of days. If you want to know how much the currency has changed in price over the last 7 or 20 days, simply put that value in the change input.
When you click manage position, you can fill out the position size variable and put the number of days you have had the position in the change parameter. This is the cost of your position. It can be options or shares. It will then adjust your position cost for the current change in the currency based on the number of days you have held it.
The indicator can be viewed on any timeframe and you can see how the conversion price compares to the listed price.
And that's basically the indicator! Its a simple utility indicator and hopefully some people will find use from it like I do!
Safe trades everyone, take care.
Perp/Spot % SpreadTo be used on BINANCE USDT PERPETUAL charts.
Automatically pulls the equivalent Binance Spot pair and plots the Spread of the Close in % terms( Value of 1 means 1% difference from Perp price)
-Positive value means Spot is trading x% ABOVE the PERP
-Negative value means Spot is trading x% UNDER the PERP
Autocorrelation OscillatorReleasing the autocorrelation oscillator.
NOTE! Please be sure to read the description. This is a theoretical indicator and its important to understand the theory behind its use.
About the indicator:
Before getting into the indicator and its functionality, its important to discuss the theoretical underpinnings of the indicator.
The autocorrelation oscillator operates on two theories of market behaviour that go hand in hand. Those theories are the market efficiency theory and the random walk theory (or hypothesis ).
Market efficiency theory: The market efficiency theory or "Efficient Market Hypothesis (EMH)" postulates that all available information is reflected in a ticker's price almost instantaneously and thus it is impossible for an investor or trader to get ahead of the market because we cannot respond to the speed that the market responds. Of course, there are many holes in this theory, the most notable being that the market is a function of humans. Absent humans and their technological integrations into the market, the market would cease to react at all. But that's besides the point. This is a widely accepted theory and one in which I can mathematically observe through statistical tests. The truth behind this theory is the market is efficient for responding to evolving economic and financial information, likely owning to huge amounts of computer and algorithmic integration into trading, and thus the market is more efficient than the average person is capable (absent computerized algorithms and integration) of ascertaining nuanced financial and economic circumstances. By the time we the people can appraise information, the market has already acted on it. And that is the main premise of the EMH.
The next theory is the Random Walk Theory or Hypothesis (RWH). This builds on the EMH and essentially postulates that the market reacts so quickly to price in current circumstances that it is too random for people to truly exploit and benefit from.
The result of these two theories is two-fold and can be summarized as such:
a) The market behaves in a chaotic fashion that is seemingly random and is incapable of being predicted effectively; and
b) The market is more efficient than a person in incorporating key fundamental information, contributing to the high degree of seemingly random behaviour.
So, how does this help us?
It is said, because of the EMH and the RWH, the only way to truly exploit the market for profit is by:
a) Buying and holding and investing under the bias that stocks will eventually rise in value; or
b) For short term trading, exploiting the pricing anomalies within the data.
So how do we exploit pricing anomalies within the data?
Well, in my own research on market efficiency and behaviour, I have identified many ways of figuring out some anomalies. One of the most effective ways is by looking at simple correlation of lagged values, or autocorrelation for short.
What is autocorrelation and how to use it in relation to EMH and RWH?
Autocorrelation refers to the correlative relationship among the values in a series. Put simply, its the relationship of the same variable over time. For example, if we wanted to look at the auto-correlation of a ticker's high price, we would take, say, 5 to 7 previous high prices and correlate them with the current high price in a series dataset. If the EMH and RWH are true, the correlation among all the variables should have an average less than 0.5 or greater than -0.5. This would indicate true randomness in the dataset and thus an efficient market.
However, if the average of all of the sum's of these correlations are greater than or equal to 0.5 or less than or equal to -0.5, that indicates there is a high degree of autocorrelation and thus the EMH ad RWH is being invalidated as the market is not operating efficiently. This is an anomaly and this anomaly can be exploited.
So how do we exploit it?
Well, when the EMH and RWH hypothesis is being invalidated, we can expect what I coin as a "Regression to Chaos" i.e. the market will revert back to an efficient equilibrium state. So if we have a high correlation of the lagged variables and a strong uptrend or downtrend correlation, we can expect an inefficient market to correct back to an efficient market (i.e. have a reversal from the current trend).
So how does the indicator work?
The indicator measures the lagged correlation of the previous 5 highs and lows of a ticker. A high correlation among all of the highs and lows that exceeds 0.8 would be an invalidation of the EMH and RWH and thus signal a correction to come (i.e. a Regression to Chaos).
The indicator will display this by changing colour. Red for a bearish reversal and green for a bullish. Let's take a look below using the ticker MSFT:
Above we can see the indicator identifying observed inefficiencies within the MSFT ticker on the 1 minute timeframe. The green vertical lines correspond to potential bullish reversals as a result of bearish inefficiencies, the red correspond to bearish reversals as a result of bullish inefficiencies.
You can see these lead to reversals within the ticker.
Components of the indicator:
In the chart above we see the following that are being indicated by arrows:
Red Arrows: Show the identified inefficiencies. Red for bullish inefficiencies (i.e. bearish reversal), green for bearish inefficiencies (i.e. bullish reversal)
Yellow Arrow: The lagged variable chart. This will display the current correlation among all the lagged variables the indicator is assessing.
Teal arrow: Displays the current strength of the trend by correlating the trend to time. A strong negative value (i.e. a value less than or equal to -0.5) indicates a strong downtrend, a strong positive value indicates the inverse.
You can unselect the data-tables in the settings menu if you just want to view the correlation line itself. This part of the indicator is customizable. You can also define the lookback period; however, it is strongly recommended to leave it at 14 as this maintains the use of this indicator as an oscillator.
And that is the indicator! Let me know your comments, questions and feedback below.
Safe trades everyone!
Alpha Trading - Pseudo Laplace Z ScoreAlpha Trading - Pseudo Laplace Z Score
Slowly, very slowly a lot of quant and statistical methods have diffused the world of traditional technical analysis with the world of real math - VEPS (Volatility, Entropy, Probability and Statistics).
‘Alpha Trading' is showing the world how VEPS can show the best probabilities of success with your trading journey.
We send a big thank you to tradingview platform and pine coding team, for this great platform and the possibility to show the methods to trade with quant and statistical methods.
There appears to be resistance in the industry about these methods, so it is even more important now than ever, to support this awesome platform and amazing talented team at trading view and pine coders who enable us all with this wonderful platform to produce tools based on VEPS (Volatility, Entropy, Probability and Statistics).
The newest indicator from the Alpha Trading stable is the “Pseudo Laplace Z Score” which combines the established statistical method of z score applied on asset data. Which is based on our previous indicator called the “Alpha Trading – RMS-Z score”. We have made some optimizations, to give an even better fit to the specific returns of price. Optimizations are on the observation that returns are more Laplace distributed than Normal distributed.
figure 1: pink distribution of the real signal (BTC, 2D), gray is perfect theoretical Laplace distribution.
Therefore, the data is not Normal distributed, but Laplace distributed. Our new indicator calculates the real Z-Score of an underlying asset.
As Z Score is a standardized Normal distribution, it relies upon the definition of Normal distribution. If it deviates from this, it still can give useful information, but the absolute value (distance from the mean in standard deviations) is not reliable, and therefore the use of Normal distribution has some uncertainties.
Therefore, this indicator calculates a pseudo standard deviation, based on the Laplace distribution formulas and the relating Z Score.
By looking at the resulting distribution of the indicator itself, it is close to a perfect theoretical Normal distribution. It is much closer to the theoretical curve (gray), and thus indicates that the use of this approach is correct. Now we can show absolute values (i.e. distance to mean, in standard deviations) which can thus be considered to assist in determining the probabilities with your trading.
figure 2: distribution of indicator AT - Pseudo Laplace Z Score vs a theoretical perfect Normal distribution on BTC 4h
Looking at the indicator directly, it appears that the probability of 99% is crossed very rarely, like expected. Because only 1% of all candles we would expect this probability line to be exceeded.
figure 3: BTC 8h with AT-Pseudo Laplace Z Score
Coming back to the method of a Z Score in general. What is a Z-Score?
A Z-score is a numerical measurement that describes a value's relationship to the mean of a group of values. Z-score is measured in terms of standard deviations from the mean. If a Z-score is 0, it indicates that the data point's score is identical to the mean score. A Z-score of 1.0 would indicate a value that is one standard deviation from the mean. Z-scores may be positive or negative, with a positive value indicating the score is above the mean and a negative score indicating it is below the mean.
Simply put, a z-score (also called a standard score) gives you an idea of how far from the mean a data point is.
Basic guidelines How to Use this indicator:
Consider Entering a Long Position when the indicator is low. Best moves are generally when the indicator Turns yellow(outlier)
Consider Entering a Short Position when the indicator is high. Best moves are generally when the indicator Turns yellow(outlier)
Consider the 3 confidence interval lines (gray lines) at 90%, 95%, and 99%, as possible reversal point (with related probability that it is not getting exceeded 🡪 reversal)
Probability Box Rule of Thirds [PPI]█ Probability Box Rule of Thirds
The Probability Box Rule of Thirds , is a visual indicator that helps traders identify possible overbought and oversold conditions. It does this by dividing the price range – highest high minus the lowest low of a given lookback period or date range – into thirds. Each third has distinct probability characteristics and when combined represent a probability box.
We have spent years refining the probability box concept, and have previously published a How To on Trading View – "How to Trade Probability Ranges – The Critical Rule of 1/3" which can be found here:
To quickly summarize the How To – when using the Rule of Thirds , you are using a combination of statistics, probabilities of success, and prior price action to determine when to enter a trade. The visual range division helps remove subjectivity and clearly shows when the trading odds are stacked in your favor. By identifying and taking higher probability trades, you have a higher chance of success as trading is all about probability and risk management.
Implementing the Rule of Thirds starts with finding an instrument that is consolidating and identifying the nearest important support and resistance levels based on your targeted trading timeframe or lookback period.
The range between the support and resistance levels is divided into thirds to form three zones within the consolidation range.
When going LONG , you want to BUY in the bottom third of the range. Once you buy, your objective is to hold during the middle third and sell when the price enters the top third.
When you buy in the lower third, there's a 66.6% probability of success. If you buy in the middle third, you only have a 50% / 50% chance of success. Going long in the top third of the range gives you a 33.3% chance of success as you are already close to the identified resistance level.
When going SHORT , the sequence and odds are reversed. You want to SELL in the top third of the range, hold the middle third and exit in the bottom third of the range. This gives you a 66.6% chance of success when entering in the top third, a 50% / 50% chance when entering in the middle third, and a 33.3% chance in the bottom third given you are already close to the identified support level.
When the price lies in the middle third, the even 50% / 50% odds provide no probability edge and a trader is better off waiting until the price reaches the upper or lower thirds of the price range.
The Rule of Thirds allows us to quickly visually evaluate trades based on probabilities, selectively enter trades that have the highest odds of success, and avoid likely losing trades. The Rule of Thirds gives you confidence to hold trades based on prior trading ranges and provides clear levels where the prices are likely to either reverse or start trending.
The Probability Box Rule of Thirds automatically implements the first two steps of the Rule of Thirds by using the highest high and lowest low of a given lookback period to identify the support and resistance levels, and automatically divides the range into thirds. The rest of the Rule of Thirds rules remain the same.
Just having the price within the bottom thirds or top thirds, however, does not mean the price will immediately reverse. The GE chart below is an example of a stock that remained 'stuck' in the upper thirds of the price range for an extended amount of time:
And the CVS chart below is an example where the price is 'stuck' in the lower thirds of the price range:
While the price is in the upper or lower thirds, it is very important that the trader should use other indicators to identify when a significant trend reversal occurs. Once a trend reversal event happens, the trader either enters a trade AND/OR exits a trade if already in one.
When the price exceeds the bounds of the probability box, there are three possible outcomes – a strong continuation trend, the price consolidates around the probability box edge, or a trend reversal. Your favorite indicators will help determine which event is happening.
The CVS chart above is a good example of the probability box being exceeded with the last bar. The price exceeding the price range is temporary event as the price range will expand to encompass the revised price range on the next trading day.
█ Indicator Features
Each supported timeframe – Monthly, Weekly, and Daily – allows the selection of an appropriate lookback period for your trading style. The defaults are a good starting point for swing trading and long-term investing. You many need to experiment to find the optimal lookback period for your trading style.
Even if you only day trade, the Probability Box Rule of Thirds with the appropriate lookback periods can help you visualize the bigger picture of where the instrument is heading.
When viewing the charts, you can find the currently selected lookback period above the upper edge of the price range.
The indicator will display a dotted yellow line at 50% of the price range and show the line's value when requested.
The visibility of the actual thirds and border price values are controlled by the " Show Probability Box Values " checkbox. You may need to expand the chart's right margin to see the values.
The " Show Internal Labels " checkbox controls the display of the internal ⅓ Division labels and the percentage odds, along with the 50% label. This option by default is set to off.
The " Show Error Messages " checkbox controls the display of error messages and by default is turned on. Turn off to prevent error messages from being shown on intraday timeframes. Save as indicator default to prevent having to turn off this setting each time added to chart.
The color and transparency controls allow the user to modify the colors used for each third. The default settings are optimized for use with a DARK background.
█ Implementation Notes
IMPORTANT - the Probability Box Rule of Thirds is set up to only handle Monthly, Weekly and Daily charts. This is intentional as the indicator is designed to be used for safer multiple day and longer swing trades. When viewed on intraday charts, the indicator will be hidden.
The Probability Box Rule of Thirds uses a rolling window of the equivalent number of bars for the lookback period rather than relying on the bar starting and ending dates. This allows the use of a standard number of days in the selected lookback window across various instruments and ensures fast, efficient calculations.
The lookback periods are adjusted when non-standard timeframe multipliers are used – e.g., a 12M chart timeframe and a 3-year lookback period will result in a 3 bar lookback. Fractional bars in this calculation are rounded up and any incompatible lookback period and chart timeframe combination will generate a runtime error.
In summary, the Probability Box Rule of Thirds automates and visually identifies overbought and oversold areas, which combined with the Rule of Thirds probability risk profiles, increases your odds of success through better trade selections and higher confidence in your trades.
█ Disclaimer
There is substantial risk in trading. Losses incurred in trading can be significant. Only trade with money you can afford to lose. We make no claims whatsoever regarding the impact of past or future performance on your trading results.
Default Strategy Template© CN_FX-999
Coded By Christian Nataliano
First Coded In 14/06/2023
Last Edited In 22/06/2023
This Is A Default Strategy Template That Can Make Your Strategy Scripts More Organized With The Benefit Of Having The Same Layouts & Not Needing To Copy Over The Common Codes Such As Displaying Backtest Results, Opening & Closing Trades, Pine Connector Capabilities And A Clean User Input Interface. This Is A Blank Strategy Script So Feel Free To Use It As Your Default Template For Your Future Strategies.
Credits To Some Of The Custom Code In The Scripts To © ZenAndTheArtOfTrading, Especially The Table Data Plotting