iqow-pin-bar-inside-bar.lua 6 KB · Free, MIT license
For the IQ Option web traderoom. Quadcode does not draw HIGHER and LOWER markers on mobile.
Add it to IQ Option in 3 steps
- Get the file. Press Get the script. Your browser saves a .lua file.
- Import it in IQ Option. Open the web traderoom on the Practice balance. Click the wave icon at the bottom left of the chart, open the Scripts tab, press Import script and pick the file.
- Add it to the chart. The code opens in an editor. Click the plus button under it (Add to chart). Save is only needed after you edit the code.
Full illustrated guide, with screenshots →
Risk. Trading can lose money. A marker is a chart observation, not a prediction, and this script is checked on test data, not proven in live trading. Try it on the Practice balance first.
- Price action
- On price
- Intermediate
Finds the pin bar and inside bar combo from the related article: a rejection candle followed by a candle that stays inside its range. The marker appears when price then closes beyond the pin bar in the direction of its wick.
The rules
HIGHER marker
A bullish pin bar (lower wick at least 2x body and 50% of range) is followed by an inside bar, and within 4 further candles a candle closes above the pin bar's high.
LOWER marker
A bearish pin bar (upper wick at least 2x body and 50% of range) is followed by an inside bar, and within 4 further candles a candle closes below the pin bar's low.
A marker appears after the next candle opens and is drawn on the candle that completed the setup. It is a chart observation, not an instruction to trade.
How to read it
Small green and red dots mark the high of bullish pin bars and the low of bearish pin bars; the dot is the level that must break. A HIGHER or LOWER triangle appears on the candle that closed beyond that level after the inside bar.
Indicators used
- Pin bar candle geometry
- Inside bar pattern
Same view with built-in indicators: No native indicator; spot the pattern manually: a pin bar, an inside bar within its range, then a close beyond the pin bar.
Default settings
| Wick to body ratio | 2 |
|---|---|
| Wick share of range | 0.5 |
| Breakout window (candles) | 4 |
Every value is an input in the script settings. Platform advice is off by default.
Key points
- The combo has three parts: a pin bar, an inside bar, then a breakout candle.
- The pin bar has a long wick and a small body. The wick points against the direction we want.
- The next candle is an inside bar: its high and low stay inside the pin bar's range.
- We then wait for a close beyond the pin bar's far side, up for a bullish pin, down for a bearish pin.
- The dots show the pin bars, so you can see which candle started the pattern.
- The article also checks support and resistance. Draw those levels yourself and test on a Practice balance.
Limitations. The article adds a support or resistance level to the combo, which this script does not draw, so many markers will sit in the middle of a range. The pin bar thresholds (wick at least half the range, looser than the 60% in the Pin Bar Bollinger script) and the 4-candle breakout window are this script's own precise reading of the article's general description, and the inside-pin continuation pattern is not covered. Test on the Practice balance before risking real funds.
Complete source code
The download and this preview resolve to the same reviewed file. SHA-256: 4ace6f79134ff934c916777ac6449a2e3d1cf5b171a9541f5a533a7296058661
-- SPDX-License-Identifier: MIT
-- IQOptionWiki QCS Library
-- IQOW Pin Bar Inside Bar v1.0.0
--
-- Pin bar and inside bar combo. A pin bar (long wick, small body) shows price
-- rejection. The next candle is an inside bar: its whole range sits within the
-- pin bar's range, a pause before the move. The setup completes when a candle
-- closes beyond the pin bar's far side, in the direction of the pin.
-- Pin geometry (inputs): wick at least 2x the body and at least 50% of the range.
--
-- HIGHER: bullish pin bar (long lower wick), then an inside bar, then within
-- the breakout window a candle closes above the pin bar's high.
-- LOWER: bearish pin bar (long upper wick), then an inside bar, then within
-- the breakout window a candle closes below the pin bar's low.
--
-- Markers use the previous completed candle: they appear after the next candle
-- opens and are shifted back one bar onto the candle that qualified.
-- Educational chart tool only. It does not place trades, choose an expiry,
-- predict outcomes, or guarantee results. Test on a Practice balance first.
instrument {
name = "IQOW Pin Bar Inside Bar",
short_name = "IQOW PIN IB",
overlay = true
}
input_group {
"1. Pin bar geometry",
wick_to_body = input (2, "Wick at least X times the body", input.double, 1, 10, 0.5, false),
wick_share = input (0.5, "Wick at least this share of the range", input.double, 0.4, 0.95, 0.05, false)
}
input_group {
"2. Combo timing",
breakout_window = input (4, "Breakout window after the inside bar (candles)", input.integer, 1, 6)
}
input_group {
"Display and advice",
pins_visible = input { default = true, type = input.plot_visibility },
signals_visible = input { default = true, type = input.plot_visibility },
advice_enabled = input { default = false, name = "Enable platform advice", type = input.boolean }
}
input_group {
"Colors",
bullish_pin_color = input { default = "#25E154", type = input.color },
bearish_pin_color = input { default = "#FF6C58", type = input.color },
pin_width = input { default = 3, type = input.line_width },
higher_color = input { default = "#25E154", type = input.color },
lower_color = input { default = "#FF6C58", type = input.color },
signal_text_color = input { default = "#FFFFFF", type = input.color }
}
-- Candle geometry. A pin bar has a long wick on one side and a small body.
local open_now = get_value (open, nil)
local high_now = get_value (high, nil)
local low_now = get_value (low, nil)
local close_now = get_value (close, nil)
local data_is_ready = open_now ~= nil and high_now ~= nil and low_now ~= nil and close_now ~= nil
local candle_range = 0
local body_size = 0
local lower_wick = 0
local upper_wick = 0
if data_is_ready then
candle_range = high_now - low_now
body_size = math.abs (close_now - open_now)
lower_wick = math.min (open_now, close_now) - low_now
upper_wick = high_now - math.max (open_now, close_now)
end
local has_range = candle_range > 1e-10
bullish_pin = conditional (
data_is_ready and has_range and
lower_wick >= wick_to_body * body_size and
lower_wick >= wick_share * candle_range
)
bearish_pin = conditional (
data_is_ready and has_range and
upper_wick >= wick_to_body * body_size and
upper_wick >= wick_share * candle_range
)
-- Look back for a pin bar followed by an inside bar. The pin bar sits "back"
-- candles ago, the inside bar right after it. No candle since the pin bar may
-- have closed beyond its far side already, so only the first breakout counts.
local bullish_combo = false
local bearish_combo = false
if data_is_ready then
for back = 2, breakout_window + 1 do
local pin_high = get_value (high [back], nil)
local pin_low = get_value (low [back], nil)
local inside_high = get_value (high [back - 1], nil)
local inside_low = get_value (low [back - 1], nil)
if pin_high ~= nil and pin_low ~= nil and inside_high ~= nil and inside_low ~= nil and
inside_high <= pin_high and inside_low >= pin_low then
local broke_up_before = false
local broke_down_before = false
for later = 1, back - 1 do
local later_close = get_value (close [later], nil)
if later_close == nil or later_close > pin_high then
broke_up_before = true
end
if later_close == nil or later_close < pin_low then
broke_down_before = true
end
end
if get_value (bullish_pin [back], false) and not broke_up_before and close_now > pin_high then
bullish_combo = true
end
if get_value (bearish_pin [back], false) and not broke_down_before and close_now < pin_low then
bearish_combo = true
end
end
end
end
higher_setup = conditional (bullish_combo)
lower_setup = conditional (bearish_combo)
-- Confirm only a new setup on the previous completed candle.
confirmed_higher = conditional (
get_value (higher_setup [1], false) and
not get_value (higher_setup [2], false)
)
confirmed_lower = conditional (
get_value (lower_setup [1], false) and
not get_value (lower_setup [2], false)
)
-- Dots on the pin bars themselves (pin high for bullish, pin low for bearish),
-- so the chart shows which candle started the combo.
if pins_visible then
plot (iff (bullish_pin, high, nil), "Bullish pin high", bullish_pin_color, pin_width, 0, style.points)
plot (iff (bearish_pin, low, nil), "Bearish pin low", bearish_pin_color, pin_width, 0, style.points)
end
if signals_visible then
plot_shape (
confirmed_higher,
"PIN IB HIGHER",
shape_style.triangleup,
shape_size.small,
higher_color,
shape_location.belowbar,
-1,
"HIGHER",
signal_text_color
)
plot_shape (
confirmed_lower,
"PIN IB LOWER",
shape_style.triangledown,
shape_size.small,
lower_color,
shape_location.abovebar,
-1,
"LOWER",
signal_text_color
)
end
-- QCS advice is a platform notification state only; it does not place trades.
if advice_enabled and
get_value (confirmed_higher, false) and
not get_value (confirmed_lower, false) then
advise (advice.buy)
elseif advice_enabled and
get_value (confirmed_lower, false) and
not get_value (confirmed_higher, false) then
advise (advice.sell)
else
advise (advice.neutral)
end
More price action scripts
- Price action
- On price
- Beginner
Three Candles Continuation
Marks the candle that completes three same-colour full-bodied candles with steady closes while price is on the matching side of EMA 20. An option flips the reading to the counter-trend idea described in the article.
Indicators: Three full candles · EMA (20)
- Price action
- On price
- Beginner
Inside Bar Breakout
Marks the first close beyond the mother bar after an inside bar, within 3 candles and in the direction of EMA 50. The inside bar shows a pause; the breakout shows which way it resolved.
Indicators: Inside bar pattern · EMA (50)
- Price action
- On price
- Intermediate
Pin Bar Bollinger
Marks a pin bar whose long wick reaches an outer Bollinger Band and whose body closes back inside. The band shows where price is stretched; the pin bar shows that the stretch was rejected.
Indicators: Bollinger Bands (20, 2) · Pin bar candle geometry
Download all 70 scripts as one ZIP · MIT License, provided “as is”, without warranty. IQOptionWiki is independent of the IQ Option platform operator. Nothing here is investment advice or a guarantee of results.