- Reversal
- On price
- Beginner
Marks a Stochastic %K/%D cross that starts in the oversold or overbought zone while the Parabolic SAR dot is on the matching side of price. The Stochastic gives the timing and the SAR checks the trailing stop agrees.
The rules
HIGHER marker
Stochastic %K crosses above %D after %K was at or below 20 on the previous candle, and the Parabolic SAR dot is below the close.
LOWER marker
Stochastic %K crosses below %D after %K was at or above 80 on the previous candle, and the Parabolic SAR dot is above the close.
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
The dots are the Parabolic SAR. A green HIGHER triangle under a candle means the Stochastic just crossed up from the oversold zone while SAR dots sit below price; a red LOWER triangle above a candle is the mirror case. The Stochastic is not drawn on the price chart.
Indicators used
- Stochastic (14, 3, 3)
- Parabolic SAR (0.02, 0.2)
Same view with built-in indicators: Add IQ Option's Stochastic Oscillator (14, 3, 3, levels 80/20) and Parabolic SAR (0.02, 0.2).
Default settings
| Stochastic %K | 14 |
|---|---|
| Stochastic smoothing | 3 |
| Stochastic %D | 3 |
| Oversold | 20 |
| Overbought | 80 |
| SAR start | 0.02 |
| SAR step | 0.02 |
| SAR maximum | 0.2 |
Every value is an input in the script settings. Platform advice is off by default.
Key points
- The Stochastic has two lines, %K and %D, and moves between 0 and 100.
- Below 20 is oversold and above 80 is overbought.
- We want %K to cross %D after sitting in one of those zones.
- The Parabolic SAR dots must support the direction: below price for HIGHER, above price for LOWER.
- Both signals must appear on the same completed candle, and the marker is drawn one candle later.
- Test it on a Practice balance and note how SAR timing changes the number of marks.
Limitations. The article describes the Stochastic cross and the SAR as a combination but gives no exact oversold or overbought rule, so 20 and 80 are used. Because the SAR dot must already be on the other side of price, the mark can arrive late, and in strong trends the Stochastic stays in its zone for a long time. The Stochastic is calculated from closing prices as in IQ Option's built-in version. Test on the Practice balance before risking real funds.
Install it in four steps
- Download and inspectDownload one .lua file and open it in a plain-text editor if you want to read it first. If you downloaded the ZIP, extract it.
- Open Chart Analysis → ScriptsIn the IQ Option traderoom, choose the Practice balance, open the chart analysis panel, select Scripts and choose Import script.
- Save and add to chartSelect the downloaded file, review the imported code, choose Save, then use the + control to add it to the chart.
- Change one input at a timeConfirm the default view first. Then adjust periods, levels or colours one setting at a time and note what changes.
Complete source code
The download and this preview resolve to the same reviewed file. SHA-256: 9920e6d199f5590cfb23e1a51f1ec0ca88b56cba742c21197b9d67abebbec234
-- SPDX-License-Identifier: MIT
-- IQOptionWiki QCS Library
-- IQOW Stochastic PSAR v1.0.0
--
-- Combines the Stochastic oscillator (14, 3, 3) with the Parabolic SAR, as in
-- the related article. The Stochastic cross out of an extreme zone gives the
-- timing; the SAR confirms that its dots are on the matching side of price.
--
-- HIGHER: %K crosses above %D after %K was at or below 20 on the previous
-- candle, and the Parabolic SAR dot is below the close.
-- LOWER: %K crosses below %D after %K was at or above 80 on the previous
-- candle, and the Parabolic SAR dot is above the close.
--
-- 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 Stochastic PSAR",
short_name = "IQOW STO PSAR",
overlay = true
}
input_group {
"1. Parabolic SAR",
sar_start = input (0.02, "Start", input.double, 0.01, 1, 0.01),
sar_step = input (0.02, "Step", input.double, 0.01, 1, 0.01),
sar_maximum = input (0.2, "Maximum", input.double, 0.01, 1, 0.01)
}
input_group {
"2. Stochastic",
k_period = input (14, "%K period", input.integer, 2, 100),
k_smoothing = input (3, "%K smoothing", input.integer, 1, 20),
d_period = input (3, "%D period", input.integer, 1, 20),
oversold_level = input (20, "Oversold level", input.double, 1, 45, 1, false),
overbought_level = input (80, "Overbought level", input.double, 55, 99, 1, false)
}
input_group {
"Display and advice",
sar_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",
sar_color = input { default = "#56CEFF", type = input.color },
sar_width = input { default = 2, 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 }
}
psar = sar (sar_start, sar_step, sar_maximum)
-- Stochastic as in the official indicator: %K smoothed, %D = SMA of %K.
stoch_k = sma (stochastic (close, k_period), k_smoothing) * 100
stoch_d = sma (stoch_k, d_period)
local sar_now = get_value (psar, nil)
local k_now = get_value (stoch_k, nil)
local d_now = get_value (stoch_d, nil)
local k_previous = get_value (stoch_k [1], nil)
local d_previous = get_value (stoch_d [1], nil)
local close_now = get_value (close, nil)
local levels_are_valid = oversold_level < 50 and overbought_level > 50
local data_is_ready =
levels_are_valid and
sar_now ~= nil and
k_now ~= nil and
d_now ~= nil and
k_previous ~= nil and
d_previous ~= nil and
close_now ~= nil
-- Event: %K crosses %D on this candle, starting from the extreme zone.
local cross_up_from_oversold =
data_is_ready and k_previous <= d_previous and k_now > d_now and k_previous <= oversold_level
local cross_down_from_overbought =
data_is_ready and k_previous >= d_previous and k_now < d_now and k_previous >= overbought_level
higher_setup = conditional (cross_up_from_oversold and sar_now < close_now)
lower_setup = conditional (cross_down_from_overbought and sar_now > close_now)
-- 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)
)
if sar_visible then
plot (psar, "Parabolic SAR", sar_color, sar_width, 0, style.points)
end
if signals_visible then
plot_shape (
confirmed_higher,
"STO PSAR HIGHER",
shape_style.triangleup,
shape_size.small,
higher_color,
shape_location.belowbar,
-1,
"HIGHER",
signal_text_color
)
plot_shape (
confirmed_lower,
"STO PSAR 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 reversal scripts
- Reversal
- Own panel
- Intermediate
Fisher Transform Reversal
Marks a Fisher Transform cross of its trigger line while the indicator is in an extreme zone. This is the extreme-then-cross confirmation the related article describes.
Indicators: Ehlers Fisher Transform (10)
- Reversal
- On price
- Beginner
Harami RSI
Marks bullish and bearish harami candle pairs when RSI is in a low or high zone. RSI helps check that the pair follows a push in the opposite direction.
Indicators: Harami candle pair · RSI (14, 40/60)
- Reversal
- Own panel
- Intermediate
KDJ Cross
Marks K/D crosses that happen while the faster J line is already stretched below 20 or above 80. J reaches the extremes first, so the cross after it is used as the timing event.
Indicators: KDJ (9, 3, 3)
Download all 56 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.