Unfilled Gap DetectorThis indicator displays gaps on a chart within a specified range which have not been filled. It offers the ability to set the minimum gap size to detect as a multiple of the average true range (ATR), as well as the allowed distance from a gap fill for the gap to be considered filled. The use of ATR allows the gap threshold to dynamically change as the stock price and volatility change over time. Lastly, it offers the ability to show gaps which have been filled in addition to unfilled gaps.
The following describes each input's effect on the indicator.
Bars to Search Back: specifies how many bars back in the chart to search for gaps and gap fills (maximum 5000).
ATR Length: specifies the length of the ATR() function used for thresholding
Minimum ATR Multiple For Gap Detection: The minimum gap size as a multiple of the ATR
Minimum ATR Multiple For Gap Fill: The minimum distance between a bar high/low and a gap for it to be considered "filled" as a multiple of ATR
Gap
Data Gap PointerUpdating the v3 script made by u/Lemrin + some mods
What this does:
Paints a blue "down arrow" pointer at an intraday bar that has occurred with a skip (e.g. a 1min bar that occurs a few minutes after the previous bar)
Checks for whether the market is open, and only paints arrows if inside open hours (because Extended Hours have lots of bar gaps)
BITCOIN CME FUTURES GAPSDisplays information about Bitcoin CME Futures Gaps over BTCUSD (or XBTUSD) charts.
You can configure a threshold percentage to only display gaps whose size is greater than that percentage. The gap precentage is calculated based on the current close price.
Gaps up are displayed in Orange, gaps down in Green
Daily GAP StatsI did not write the script from scratch but rather started editing code of an existing one. The original code came from a script called GAP DETECTOR by @Asch-
First up: I am a trader, not a programmer and therefore my code most likely is inefficient. If someone with more expertise would like to help and optimize it - feel free to get in touch, I am always happy to learn some new tricks. :)
This script does 2 things:
- It shows daily gaps stats based on user inputs
- It shows color coded labels on gap days with additional information in tooltips ( important: make sure to read 'known issues/limitations' at the end )
User Inputs
==========
Although the input dialog is pretty straight forward, I do a quick rundown:
- Length: max lookback time
- Gap Direction: self explanatory
- Show All Gaps | Cont Only | Reversal Only | Off:
This refers to the way labels are displayed on gap days (again: make sure to read known issues/limitations!)
- Show All Gaps: does what it says
- Cont Only: only shows gaps where price continued in the gap direction. If you filter for gap ups and chose 'Cont only' you will only see labels on gap days where price closed above the open (and vice versa if you scan for gap downs).
- Reversal Only: you will only see labels for closes below the open on gap up days (and the opposite on gap down days)
- Off: self explanatory
- Gap Measure in ATR/PCT: self explanatory, ATR is calculated over a 10d period
- Gap Size (Abs Values): no negative values allowed here. If you filter for gap downs and enter 3 it means it will show gaps where the stock fell more than 3 ATR/PCT on the open.
- RVOL Factor: along with significant gaps should come significant volume. RVOL = volume of the gap day / 20d average volume
- Viewing Options: Placing the stats label in the window is a bit tricky (see knonw issues/limitations) and I was not sure which way I liked better. See for yourself what works best for you.
Known Isusses/Limitations:
=======================
- Positioning of the stats table:
As to my knowledge, Tradingview only allows label positioning relative to price and not relative to the chart window. I tried to always display the gap stats table in the upper right corner, using 52wk high as y-coordinate. This works ok most of the time, but is not pretty. If anybody has some fancy way to tag the label in a fixed position, please get in touch.
- Max number of labels per script:
TradingView has a limitation that allows a maxium of ~50 labels per script. If there are more labels, TradingView will automatically cut the oldest ones, without any notification. I have found this behaviour to be rather inconsistent - sometimes it'll dump labels even if there are a lot fewer than 50. Hopefully TradingView will drop this limitation at one point in the future.
Important: The inconsistent display of the gap day labels has NO INFLUENCE on the calculations in the gap stats table - the count and the calculations are complete and correct!
Gap Down Reversal StrategyA "Gap down Reversal" is when the current days candle, opens, below the prior days close, and "finishes up" on the day with the close greater than the open. This type of price action can provide traders with favorable entry points to trade long, as anyone who was short the prior day, can get squeezed or panic out of the trade as they would see profits erode quickly from the gap down at the open.
Strategy results are shown on SHOP with 10k starting capital and 10k per trade. The strategy enters at next days close after the gap down reversal fires off, and a 5% trailing stop order is also executed. This is important to understand when experimenting with different trailing stops on different symbols and observing results to find the most viable strategy. The discretionary trader may choose to enter at the close, or at the next days open, so understand results are not calculated for those entry points.
You also may alter the start date of the strategy, so you can include, or exclude certain dates.
Experiment with different stops and symbols! More volatile symbols most likely will need looser stops and Vice Versa. Concentrate on symbols in up trends, as "the dips" usually get consistently bought in these names, but hard reversals in downtrends can happen as well.
Any questions/concerns please let me know and happy trading.
GapAnalysisI am a new Trading View user. I am trying to gain some reputation so that I can start contributing more to the community and start learning more. Therefore I have written this very simple pine script that simply adds a label to the first bar of the day if there is a gap between 2% and 8% or a gap between -2* and -8%.
Questions:
1) Lots of missing candlesticks e.g. at 16:30 and 08:00 meaning the candlestick may not of truely gapped up or down. Why are there missing bars? Is it because I have the free version? Are there any missing candlesticks on the paid for version?
2) Does the Gap filter always look at the first bar of the day and compare it to the last bar the previous day? (assuming you select 1d above the filters).
3) How does the Gap filter work if you select 1w above the filters?
4) The filter columns save for me, however the filter values do not. For example, if I select the Gap filter and select the values 'between 2% and 6%', then the column is saved but the values are not. Is this correct?
How to detect last bar of day Simple way how to detect last bar of day and close all positions
UPD: day end can be different for yours because stocks market use another timezone
Gap driven intraday trade (better in 15 Min chart)// Based on yesterday's High, Low, today's open, and Bollinger Band (20) in current minute chart,
// Defined intraday Trading opportunity: Stop, Entry, T0, Target (S.E.T.T)
// Back test in 60, 30, 15, 5 Min charts with SPY, QQQ, XOP, AAPL, TSLA, NVDA, UAL
// In 60 and 30 min chart, the stop and target are too big. 5 min is too small.
// 15 min Chart is the best time frame for this strategy;
// -------------------------------------------------------------------------------
// There will be Four lines in this study:
// 1. Entry Line,
// 1.1 Green Color line to Buy, If today's open price above Yesterday's High, and current price below BB upper line.
// 1.2 Red Color line to Short, if today's open price below Yesterday's Low, and current above BB Lower line.
//
// 2. Black line to show initial stop, one ATR in current min chart;
//
// 3. Blue Line (T0) to show where trader can move stop to make even, one ATR in current min chart;
//
// 4. Orange Line to show initial target, Three ATR in current min chart;
//
// Trading opportunity:
// If Entry line is green color, Set stop buy order at today's Open;
// Whenever price is below the green line, Prepare to buy;
//
// If Entry line is Red color, Set Stop short at today's Open;
// Whenever price is above the red line, Prepare to short;
//
// Initial Stop: One ATR in min chart;
// Initial T0: One ATR in min chart;
// Initial Target: Three ATR in min chart;
// Initial RRR: Reward Risk Ratio = 3:1;
//
// Maintain: Once the position moves to T0, Move stop to "Make even + Lunch (such as, Entry + $0.10)";
// Allow to move target bigger, such as, next demand/supply zone;
// When near target or demand/supply zone or near Market close, move stop tightly;
//
// Close position: Limit order filled, or near Market Close, or trendline break;
//
// Key Step: Move stop to "Make even" after T0, Do not turn winner to loser;
// Willing to "in and out" many times in one day, and trade the same direction, same price again and again.
//
// Basic trading platform requests:
// To use this strategy, user needs to:
// 1. Scan Stocks Before market open:
// Prepare a watch list for top 10 ETF and Top 90 stocks which are most actively traded.
// Stock might be limited by price range, Beta, optionable, ...
// Before market open, Run a scan for these stocks, find which has GAP and inside BB;
// create watch list for that day.
//
// 2. Attach OSO and OCO orders:
// User needs to Send Entry, Stop (loss), and limit (target) orders at one time;
// Order Send order ( OSO ): Entry order sends Stop order and limit order;
// Order Cancel order ( OCO ): Stop order and limit order, when one is filled, it will cancel the other instantly;
All in 1 Indikator (MAs, GAP Indikator, BB, Clouds)This indicator provides:
-> up to 5 SMAs and EMAs at the same time.
-> HullMA
-> VWMA (Volume based MA)
-> Ichimoku Cloud
-> Parabolic SAR (for Trend analysis)
-> special 1. Add up to 2 Bollinger Bands (so you can add 2 BB at the same time with different standard deviations)
-> special 2. You also can add an GAP Indikator. The red and green lines you can see in the picture. This tool finds gap's in the btc cme chart for example and shows them to you
NSDT Daily Gap RangeSimple script that plots the range between the previous day close and the current day open. This makes it easier to reference the gap up or gap down zone throughout the day.
Gap Filling Strategy Gaps are market prices structures that appear frequently in the stock market, and can be detected when the opening price is different from the previous closing price, this is why gaps are also called "opening price jumps". While gaps can occur frequently, some of them are more significant than others, and can be observed when looking at a long term chart.
The following strategy is based on the exploitation of significant gaps occurring during a new session, and posses various options that can return a wide variety of results.
Type Of Gaps And Occurence
I'am not a professional when it comes to gaps, but as you know the stock market close for the day, however it is still possible to place orders, your broker will hold them until the market open back. Once the market reopen the broker execute the pending orders, and when many orders where pending the market register really high volume and the price might differ from the precedent close.
Gaps are generally broken down into four types:
Common : Gaps occurring within a certain price range, mostly occurs during ranging markets.
Break Away : Gaps breaking a support and resistance, making a new higher high/lower low.
Runaway : Gaps occurring within a trend, followed by a continuation of the trend.
Exhaustion : Gaps occurring at the end of a trend, followed by a reversal.
As said before, some gaps are more significant than others, the significance of a gap can be determined by comparing the opening price with the previous high/low price and by looking at volume. Significant up gaps will have an opening price greater than the previous high, while significant down gap will have an opening price lower than the previous low with both high volume accompanying them.
After a gap, when the price go back to the point previous to the gap we say that it has been "filled", this characteristic is what will be exploited in this strategy.
Strategy Rules & Logic
In this strategy, the significance of a gap is determined by the position of the opening price relative to the previous high/low and make sure the bar following the gap don't fill it.
When the setting invert is set to false the strategy interpret the detected gaps as being exhaustion gaps, therefore when an up gap occur a short position is opened, when a down gap occur a long position is opened. When invert is set to true gaps are considered to be runaway or break away gaps, therefore the contrary positions are opened. Positions are exited when the gap has been filled, which in the chart is show'n when the price cross the red level who act as either a take profit (invert = false) or as a stop loss (invert = true).
There are various closing conditions available that the user can select from the "close when" setting.
New Session : This option close all previous positions when the market is in a new session.
New Gap : This option close all previous position when a new gap has been detected.
Reverse Position : This option close all previous position when a contrary position to the current one is opened. This option would reduce the number of trades.
Testing On Some Stocks
The analysis will be tested in different tech stocks with a main TF of 15 minutes with no spread and commissions applied. Default settings will be used. We'll be making our first analysis using AMD, who has recently formed a full reverse HS pattern, where the neckline has been crossed by the price. (by the way i have a bad feeling about it, hey ! feeling filling ! Lame jokes!)
Profit: $ -12.22
Trades: 272
Profitability: 65.07 %
We can see negative results, with an heavily decreasing balance. Using invert would return positive results.
We will now test the strategy on NVDA, the company is one of the biggest when it comes to the Gpu market.
Profit: $ -215.54
Trades: 297
Profitability: 60.27 %
Not better, using invert would of course create better results. Like AMD the balance is heavily decreasing.
Finally we will test the strategy on Seagate technology, a company mostly known for their mechanical hard drives.
Profit: $ -4.32
Trades: 261
Profitability: 65.9 %
Here the balance does not appear so heavily decreasing and even managed to reach back the initial balance before going down again.
Summary
A strategy based on gap filling has been briefly introduced and tested with 3 tech stocks. The results show that using invert option might be better. The advantage of this strategy against ones using technical indicators is that this one does not heavily depend on user settings, which make it way more efficient, this a big advantage of patterns based strategies.
Thx to LucF for helping with the "process_orders_on_close" element, since i had to use closing price i had to remove it tho, was afraid results would differ even more from a more realistic backtest. And thx for those who continuously support me, more cool stuff is coming up.
Thx for reading and i hope you'll have learned something new today !
Gap Finder v1.0 by Nimit ChomnawangThis indicator shows locations of price gaps (or candle stick discontinuities). It prints out the labels "Gap" under the price bars where gaps occur. Asterisk " * " is used to pin point the bars with gaps.
GAP DETECTORGAP DETECTOR is an indicator displaying price gaps that have never been completely filled (only gaps >= 5 pips are considered).
Each gap is defined by two lines (the lower and upper bound of the gap), and a label giving information on its price range
#Parameters:
length: the number of candles being considered in the indicator (max is 3000).
width: the width of the gap lines.
Gap Automatic Retrocess LevelsThis Script detects Bearish / Bullish GAP at market opening 09:30 am NY and automatically traces backward levels, of which 2 are configurable at your discretion.
Piercing Line Pattern Trading Setupthis study is the first one of a series of scripts based on the candlesticks pattern which will be published over time. There are several such scripts out there that can be found on TradingView but they seem to be inaccurate with a lot of noises and messy hard to understand code. In this script, I've tried to have a clean and easy to get
of the pattern itself and the method for detecting it with enough parameters to filter out the noises.
Piercing Pattern
A piercing pattern is a technical trading signal that is formed by a closing down day with a good-sized trading range, followed by a trading gap lower the following day with a bullish candlestick that covers at least half of the upward length of the previous day's bearish candlestick body, finishing with a close higher for the day. A piercing pattern often signals the end of a small to moderate downward trend. A piercing pattern can serve as a potential indicator for a bullish reversal. This pattern is formed by two consecutive candlestick marks. The first candlestick is bearish signifying a down day and the second is bullish signifying an up day. When a trader is watching for a bullish reversal any red candlestick followed by a green candlestick could be an alert. There are a few things that set a piercing pattern apart from a general red candlestick green candlestick pattern. In a piercing pattern, a green candlestick follows a red one with a significant gap in the red candlestick close and green candlestick open. On the second-day green candlestick, the candlestick’s body must also lengthen to cover at least half of the previous day’s red candlestick . Generally, the gap down and substantial increase to the closing price are good signs for a reversal. In a piercing pattern, the second-day green candlestick will close at or above the midpoint of the previous day’s red candlestick.
please provide me with your valuable comments,
thanks for your attention,
WhiplashClimax setup looking for a reversal the next day after a gap, this works best if the signal is triggered after a prolonged move in one direction. Enter the position at the close of the day when you get a signal and exit for a loss the next day if not profitable, otherwise, trail a stop to lock profits.
CME Gap Finder - BitcoinOnly for Bitcoin!
This indicator locates weekly gaps created by the CME Futures market for Bitcoin.
As you can see, Bitcoin tends to close the weekly gaps created in the futures market so I thought this could be a very useful tool.
Instead of having to look between multiple charts, this simply overlays the past weeks open and close should a gap appear.
I hope you find this indicator useful!
Cheers!
Gap Measure PercentMeasures the gaps between bars - bullish or bearish - as a percent of the underlying's price.
Katana Gaps Bounty Hunter (Show Gaps Counter) by RRBKatana Gaps Bounty Hunter (KGB_Hunter) by RagingRocketBull 2018
Version 1.0
This indicator shows/counts/filters gaps on a chart
There are several versions: Simple, Pro and Zones. This is the Simple version. The Differences are listed below.
- Simple: shows/counts gaps, changes color based on gap dir (2 colors), filters out price gaps within session, large gaps, and high volume gaps
- Pro: +shows all types of gaps, multi color, more filters (time gaps, doji, etc)
- Zones: +shows gaps as dynamic horiz zones
Features:
- highlights gaps using barcolor and plotchar chars (2 colors x 2 dirs)
- can show/hide gaps/chars based on gap dir
- changes color of gaps/chars based on gap dir
- displays chars above/below bar based on gap dir
- can filter out price gaps, large gaps, and high volume gaps
- counts all filtered gaps
Good Luck! Feel free to reuse the code and make it your own
Strength Candles With GapCode written by Krishna Khanna on 20/11/2017 includes the following components for NimblrTA
1) Logic for detection of strength candles, only displayed candles are of strength (BH>50%CH)
2) Wicks are not considered
3) Any Gaps are indicated with a arrow, can detect gapup and gapdown
This indicator is apt for small screen devices
Data Gap DetectionThis simple script checks for data gaps in an intra-day TradingView chart. I have found that BitMEX 1-minute data is coming in rather holey lately, so I wrote this just to see how prevalent the problem is. It should work on any intra-day timeframe, not just 1-minute.
V1: initial release.