Pine Script v5 · Strategy
Solution Zigma - Fibonacci Impulse
A Pine Script v5 strategy built on EMA (src, 26), Highest (close_p, 4) and Lowest (close_p, 4). It has 14 order rules and no entry of its own. Exits use a stop loss and a profit target. Each trade is one contract and pays no commission. 45 settings; defaults include Fibonaci Level source 0.5, Fibo level session 60 and Fibonaci lookback Length 12.
Generated from the script's code by a template: every clause is a fact read from the source. Not written by a person or a model, and not taken from the author's description.
- Does Solution Zigma - Fibonacci Impulse repaint?
- Yes
- At least one pattern in the source can repaint: intrabar recalculation.
- Does Solution Zigma - Fibonacci Impulse run in Pine Script v6?
- Not tested
- The v5 script does not run in Zeal Terminal's engine (Pine Script v5 Error at @L5:C0: no source was supplied for the library 'ZoomerXeus/AutoFiboRetrace/2'. Libraries cannot be fetched from TradingView; supply the source in the 'libraries' option. No libraries were supplied.), so this step could not be checked. The v6 version is shown for reference and is not offered as a download.
- Does Solution Zigma - Fibonacci Impulse use a stop loss?
- Yes
- strategy.exit sets a stop on line 302, 303.
- Does Solution Zigma - Fibonacci Impulse run in Zeal Terminal?
- No
- Not yet: it imports the library ZoomerXeus/AutoFiboRetrace/2, whose source is not available here, so it does not run here
Review
What a careful reader of this script would point out, found by checking the source.
-
Likely bug
ta.ema(src, 26) ignores the settings line 75
Line 75 hard-codes 26 where line 120 uses “Fast Length”. Changing those settings moves one band but not this one.
ta.ema(src, 26)ta.ema(src, fast_length) -
Likely bug
ta.ema(src, 12) ignores the settings line 76
Line 76 hard-codes 12 where line 120 uses “Fast Length”. Changing those settings moves one band but not this one.
ta.ema(src, 12)ta.ema(src, fast_length) -
Likely bug
ta.highest(high, rrAutoSLCalLength) ignores the settings line 272
Line 272 hard-codes high where line 104 uses “ATR Chandelier Exit Length”. Changing those settings moves one band but not this one.
ta.highest(high, rrAutoSLCalLength)ta.highest(ce_length, rrAutoSLCalLength) -
Likely bug
ta.lowest(low, rrAutoSLCalLength) ignores the settings line 273
Line 273 hard-codes low where line 107 uses “ATR Chandelier Exit Length”. Changing those settings moves one band but not this one.
ta.lowest(low, rrAutoSLCalLength)ta.lowest(ce_length, rrAutoSLCalLength) -
Likely bug
ta.sma(wt1, 4) ignores the settings line 147
Line 147 hard-codes 4 where line 167 uses “Sma1length”. Changing those settings moves one band but not this one.
ta.sma(wt1, 4)ta.sma(wt1, sma1length) -
Check
5 settings do nothing
“Up Color”, “Down Color”, “Color candles based on Hull\'s Trend?”, “Over Bought Level”, “Over Sold Level” are declared but never read.
-
Check
No commission
The backtest assumes free trading. Results on any real exchange will be lower.
-
Note
8 settings have no label
In the settings dialog fibo_level_session (line 13), source (line 27), length (line 28), offset (line 29), smoothing (line 30), mtf_val (line 31), sma1length (line 43), sma2length (line 44) show an empty name. The labels on this page come from the variable names.
-
Note
No slippage
Fills are assumed at the exact open price. Add slippage in the properties for a more realistic test.
-
Note
Uses an argument v6 removed
when = on line 250, 251, 253, 254, 256, 257, 259, 260, 262, 263, 305, 306. The upgraded version below moves each call inside an if block.
Settings
Every input the script declares, with its default and what it feeds. Bounds are the ones the script enforces.
| Setting | Default | Type and range | Feeds |
|---|---|---|---|
| General (Default setting for Binance's BTCUSDTPERP) | |||
| Fibonaci Level source | 0.5 | string · options ['0.786', '0.618', '0.5', '0.382', '0.236'] | src |
| Fibo level session (no label in the script) | 60 | timeframe · options ["W", "D", "240", "60", "30", "15", "5", "1"] | FL236M FL382M FL500M FL618M FL786M FL0 FL236 FL382 FL500 FL618 FL786 FL1000 FL1236 FL1382 FL1500 FL1618 FL1786 FL2 line 88 line 92 |
| Fibonaci lookback Length | 12 | int · min 1 · step 1 | FL236M FL382M FL500M FL618M FL786M FL0 FL236 FL382 FL500 FL618 FL786 FL1000 FL1236 FL1382 FL1500 FL1618 FL1786 FL2 |
| Show Candle Mode | true | bool | candle_color line_color |
| Alex Orekhov (everget)'s Chandelier Exit (Filter) | |||
| Show On Chart | false | bool | Long Stop Short Stop Long Stop Start Short Stop Start |
| ATR Chandelier Exit Length | 1 | int · min 1 · step 1 | atr longStop shortStop |
| ATR Chandelier Exit Multiply | 3.0 | float · min 0.1 · step 0.1 | atr |
| Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter) | |||
| Show On Chart | false | bool | Regression Line RL |
| Fast Length | 3 | int | trend_60 prev_trend_60 |
| Slow Length | 10 | int | trend_60 prev_trend_60 |
| Source | close | source | trend_60 prev_trend_60 |
| Higher Time Frame 1 | 60 | string | trend_60 prev_trend_60 |
| RSI period | 14 | int · min 1 · step 1 | myrsi |
| Source (no label in the script) | close | source | linreg linreg_p |
| Length (no label in the script) | 100 | int · min 1 | linreg linreg_p |
| Offset (no label in the script) | 0 | int · min 0 | linreg linreg_p |
| Smoothing (no label in the script) | 17 | int · min 1 | line 132 |
| Mtf val (no label in the script) | | timeframe | line 132 |
| Up Color | Lime | string · options ['Red', 'Lime', 'Orange', 'Teal', 'Yellow', 'White', 'Black'] | unused |
| Down Color | Red | string · options ['Red', 'Lime', 'Orange', 'Teal', 'Yellow', 'White', 'Black'] | unused |
| Color Regression according to trend? | true | bool | hullColor |
| Color candles based on Hull\'s Trend? | false | bool | unused |
| Show as a Band? | true | bool | RL |
| Line Thickness | 1 | int | Regression Line RL |
| Band Transparency | 40 | int · step 5 | Band Filler |
| Channel Length | 10 | int | esa d |
| Average Length | 21 | int | tci |
| Over Bought Level | 53 | int | unused |
| Over Sold Level | -53 | int | unused |
| Sma1length (no label in the script) | 5 | int | sma_1 sma_3 |
| Sma2length (no label in the script) | 35 | int | sma_2 sma_4 |
| Show Dif as percent of current Candle | true | bool | smadif |
| Open order type | ord_con_4 | string · options [ord_con_1, ord_con_2, ord_con_3, ord_con_4, ord_con_5] | order Long order Short order Long order Short order Long order Short order Long order Short order Long order Short Buy Signal Label Sell Signal Label line 249 line 252 line 255 line 258 line 261 line 300 |
| Alert Message and order Management | |||
| Order Sizeorder size 1:Price e.g 1:38000(BTCUSDTPERP) | 0.001 | float · min 0.001 · step 0.1 | order Long order Short |
| Leverage Size | 10 | int · min 1 · step 1 | order Long order Short |
| Close Order Option | Condition | string · options ['RR', 'Condition'] | exit Exit Long exit Exit Short close Long close Short Short's SL Line Short's TP Line line 301 |
| Use auto Calculate Stoploss | false | bool | sl_percent_bull sl_percent_bear |
| Open order type | Zigma Swing H/L | string · options ['Zigma Swing H/L', 'Candle Swing H/L'] | line 268 |
| Auto SL Calculate LengthUse for fing Lowest and Highest. | 5 | int · min 1 · step 1 | auto_sl_high auto_sl_low |
| RR Stoploss percent | 1.00 | float · min 0.1 · step 0.1 | sl_percent_bull_fix sl_percent_bear_fix |
| RR ratio | 2.00 | float · min 0.1 · step 0.1 | takeProfitBull takeProfitBear |
| Alert Message Long | Open Long | string | order Long |
| Alert Message Short | Open Short | string | order Short |
| Alert Message Close Long | Close Long | string | exit Exit Long close Long |
| Alert Message Close Short | Close Short | string | exit Exit Short close Short |
What it calculates
- EMAsrc, 26
open_p · line 75 - EMAsrc, 12
close_p · line 76 - Highestclose_p, 4
high_p · line 77 - Lowestclose_p, 4
low_p · line 78 - DMI14, 14
diplus_4h · line 85 - DMI14, 14
diminus_4h · line 85 - DMI14, 14
adx_4h · line 85 - DMI14, 14
diplus_1h · line 86 - DMI14, 14
diminus_1h · line 86 - DMI14, 14
adx_1h · line 86 - DMI14, 14
diplus_15m · line 87 - DMI14, 14
diminus_15m · line 87 - DMI14, 14
adx_15m · line 87 - ATRATR Chandelier Exit Length (1)
atr · line 103 - HighestATR Chandelier Exit Length (1)
longStop · line 104 - LowestATR Chandelier Exit Length (1)
shortStop · line 107 - EMASource (close), Fast Length (3)
trend_60 · line 120 - EMAsrc_sh[5], Fast Length (3)
prev_trend_60 · line 121 - RSIclose, RSI period (14)
myrsi · line 125 - Crossundermyrsi, 70
rsi1 · line 126 - LinregSource (close), Length (100), Offset (0)
linreg · line 133 - LinregSource (close), Length (100), offset + 1
linreg_p · line 134 - EMAap, Channel Length (10)
esa · line 142 - EMAmath.abs(ap - esa), Channel Length (10)
d · line 143 - EMAci, Average Length (21)
tci · line 145 - SMAwt1, 4
wt2 · line 147 - Changehlc3
mfi_upper · line 149 - Changehlc3
mfi_lower · line 150 - SMAsrc, Sma1length (5)
sma_1 · line 167 - SMAsrc, Sma2length (35)
sma_2 · line 168 - SMAsrc, Sma1length (5)
sma_3 · line 169 - SMAsrc, Sma2length (35)
sma_4 · line 170 - Crossunderclose, open_p
fibo_impulse_bear_over · line 203 - Crossoverclose, open_p
fibo_impulse_bull_over · line 204 - Highesthigh_p, Auto SL Calculate Length (5)
auto_sl_high · line 269 - Lowestlow_p, Auto SL Calculate Length (5)
auto_sl_low · line 270
Signal flow
How price data and settings reach the orders. Each box is a name in the script, or several computed the same way; each arrow is a value one of them reads. Hover a box for its members.
The script has 130 named inputs, calculations, conditions and outputs, too many to draw legibly here; the tables above list them.
Order rules
| Order | Fires when | By default | Line |
|---|---|---|---|
| order Long long | LongConditionfibo_impulse_bull_over and (ce_bull_controll or ce_bull_rejection) and sh_bull and position_size == 0.0 | On | 250 |
| order Short short | ShortConditionfibo_impulse_bear_over and (ce_bear_controll or ce_bear_rejection) and sh_bear and position_size == 0.0 | On | 251 |
| order Long long | LongCondition_extrafibo_impulse_bull_over and dmi_Bull and (ce_bull_controll or ce_bull_rejection) and sh_bull and position_size == 0.0 | On | 253 |
| order Short short | ShortCondition_extrafibo_impulse_bear_over and dmi_Bear and (ce_bear_controll or ce_bear_rejection) and sh_bear and position_size == 0.0 | On | 254 |
| order Long long | LongCondition_std1fibo_impulse_bull_over and (ce_bull_controll or ce_bull_rejection) and position_size == 0.0 | On | 256 |
| order Short short | ShortCondition_std1fibo_impulse_bear_over and (ce_bear_controll or ce_bear_rejection) and position_size == 0.0 | On | 257 |
| order Long long | LongCondition_std1extrafibo_impulse_bull_over and dmi_Bull and (ce_bull_controll or ce_bull_rejection) and position_size == 0.0 | On | 259 |
| order Short short | ShortCondition_std1extrafibo_impulse_bear_over and dmi_Bear and (ce_bear_controll or ce_bear_rejection) and position_size == 0.0 | On | 260 |
| order Long long | LongCondition_CombLongCondition or LongCondition_extra or LongCondition_std1 or LongCondition_std1extra | On | 262 |
| order Short short | ShortCondition_CombShortCondition or ShortCondition_extra or ShortCondition_std1 or ShortCondition_std1extra | On | 263 |
| Exit Exit Long stop and limit | close_order_type == 'RR' | On | 302 |
| Exit Exit Short stop and limit | close_order_type == 'RR' | On | 303 |
| Close Long | closeLongCondition(ta.crossunder(close, open_p) or close < open_p) and (ce_bear_controll or ce_bear_rejection) | On | 305 |
| Close Short | closeShortCondition(ta.crossover(close, open_p) or close > open_p) and (ce_bull_controll or ce_bull_rejection) | On | 306 |
Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.
Does it repaint?
Yes
At least one pattern in the source can repaint; it is marked Check below.
The live replay needs a run, and this script does not run in Zeal Terminal yet; the answer comes from the checks on the source alone.
- ClearHigher-timeframe data7 request.security call(s), none with lookahead on.
- ClearFuture-bar referencesNo negative history offsets such as close[-1].
- CheckIntrabar recalculationcalc_on_every_tick = true. Live values can differ from history.
- ClearOrder timingOrders fill at the next bar's open, after the signal bar has closed.
The checks read the source; the replay runs it. Together they catch the common causes, not every possible one.
Similar scripts
Indicators and strategies built from the same calculations.
| Script | Shares | Type | Net | Trades | Max drawdown |
|---|---|---|---|---|---|
| CHOP Zone Entry Strategy + DMI-PSAR Exit by IronCasper | atr highest lowest sma linreg ema | v4 strategy | +17.1% | 8 | 20.0% |
| ATR + STC + MA by Romedius | ema lowest highest atr sma | v5 strategy | −1.2% | 15 | 3.3% |
| M0PB (Momentum Pullback) by Marcns_ | rsi ema highest lowest atr | v5 strategy | +51.3% | 3 | 17.5% |
| -NoSKi Hammer-Star -w angle of ema Backtester - by noski1 | atr ema sma highest lowest | v5 strategy | does not run in Zeal Terminal | ||
| sma RSI & sudden buy and sell Strategy v1 by samwillington | ema rsi highest lowest sma | v5 strategy | +7.6% | 15 | 3.7% |
Upgrade and export
Written in Pine Script v5. The clean-v5 step types the settings and moves when = into if blocks, which v6 requires; it is run before and after like any upgrade.
- 12 strategy calls use the when = argument (line 250, 251, 253, 254, 256, 257, 259, 260, 262, 263, 305, 306). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
- 12 settings use the untyped input() (line 22, 23, 24, 25, 27, 34, 35, 36, 37, 43, 44, 45). It still compiles in v6; input.int, input.float or input.source state the type.
- No v6-only features. v6 is not needed to run this script.
Clean v5
Not verifiedThe v5 script does not run in Zeal Terminal's engine (Pine Script v5 Error at @L5:C0: no source was supplied for the library 'ZoomerXeus/AutoFiboRetrace/2'. Libraries cannot be fetched from TradingView; supply the source in the 'libraries' option. No libraries were supplied.), so this step could not be checked.
- Line 22: input() → input.int()
- Line 23: input() → input.int()
- Line 24: input() → input.source()
- Line 25: input() → input.string()
- Line 27: input() → input.source()
- Line 34: input() → input.bool()
18 more edits
- Line 35: input() → input.bool()
- Line 36: input() → input.bool()
- Line 37: input() → input.int()
- Line 43: input() → input.int()
- Line 44: input() → input.int()
- Line 45: input() → input.bool()
- Line 250: when = LongCondition → if block
- Line 251: when = ShortCondition → if block
- Line 253: when = LongCondition_extra → if block
- Line 254: when = ShortCondition_extra → if block
- Line 256: when = LongCondition_std1 → if block
- Line 257: when = ShortCondition_std1 → if block
- Line 259: when = LongCondition_std1extra → if block
- Line 260: when = ShortCondition_std1extra → if block
- Line 262: when = LongCondition_Comb → if block
- Line 263: when = ShortCondition_Comb → if block
- Line 305: when = closeLongCondition → if block
- Line 306: when = closeShortCondition → if block
⋯isShowFilterIndicator_subh = input.bool(false, 'Show On Chart', group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")-fast_length = input(title='Fast Length', defval=3, group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")+fast_length = input.int(title='Fast Length', defval=3, group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")-slow_length = input(title='Slow Length', defval=10, group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")+slow_length = input.int(title='Slow Length', defval=10, group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")-src_sh = input(title='Source', defval=close, group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")+src_sh = input.source(title='Source', defval=close, group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")-res_60 = input('60', title='Higher Time Frame 1', group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")+res_60 = input.string('60', title='Higher Time Frame 1', group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")rsi_period = input.int(14, title='RSI period', minval=1, step=1, group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")-source = input(close, group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")+source = input.source(close, group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")length = input.int(100, minval=1, group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")⋯q = input.string('Red', 'Down Color', options=['Red', 'Lime', 'Orange', 'Teal', 'Yellow', 'White', 'Black'], group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")-switchColor = input(true, 'Color Regression according to trend?', group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")+switchColor = input.bool(true, 'Color Regression according to trend?', group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")-candleCol = input(false, title='Color candles based on Hull\'s Trend?', group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")+candleCol = input.bool(false, title='Color candles based on Hull\'s Trend?', group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")-visualSwitch = input(true, title='Show as a Band?', group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")+visualSwitch = input.bool(true, title='Show as a Band?', group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")-thicknesSwitch = input(1, title='Line Thickness', group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")+thicknesSwitch = input.int(1, title='Line Thickness', group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")transpSwitch = input.int(40, title='Band Transparency', step=5, group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")⋯over_sold_level = input.int(-53, 'Over Sold Level', group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")-sma1length = input(5, group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")+sma1length = input.int(5, group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")-sma2length = input(35, group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")+sma2length = input.int(35, group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")-UsePercent = input(title='Show Dif as percent of current Candle', defval=true, group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")+UsePercent = input.bool(title='Show Dif as percent of current Candle', defval=true, group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")conditionType = input.string(ord_con_4, "Open order type", options=[ord_con_1, ord_con_2, ord_con_3, ord_con_4, ord_con_5])⋯if conditionType == 'Original (Zigma Candle + CE + Subhag)'- strategy.order('Long', strategy.long, order_size*leverage_mult, when=LongCondition, alert_message=msg_open_long)+ if LongCondition+ strategy.order('Long', strategy.long, order_size*leverage_mult, alert_message=msg_open_long)- strategy.order('Short', strategy.short, order_size*leverage_mult, when=ShortCondition, alert_message=msg_open_short)+ if ShortCondition+ strategy.order('Short', strategy.short, order_size*leverage_mult, alert_message=msg_open_short)else if conditionType == 'Original Extra (Zigma Candle with DMI + CE + Subhag)'- strategy.order('Long', strategy.long, order_size*leverage_mult, when=LongCondition_extra, alert_message=msg_open_long)+ if LongCondition_extra+ strategy.order('Long', strategy.long, order_size*leverage_mult, alert_message=msg_open_long)- strategy.order('Short', strategy.short, order_size*leverage_mult, when=ShortCondition_extra, alert_message=msg_open_short)+ if ShortCondition_extra+ strategy.order('Short', strategy.short, order_size*leverage_mult, alert_message=msg_open_short)else if conditionType == 'Original 0 (Zigma + CE)'- strategy.order('Long', strategy.long, order_size*leverage_mult, when=LongCondition_std1, alert_message=msg_open_long)+ if LongCondition_std1+ strategy.order('Long', strategy.long, order_size*leverage_mult, alert_message=msg_open_long)- strategy.order('Short', strategy.short, order_size*leverage_mult, when=ShortCondition_std1, alert_message=msg_open_short)+ if ShortCondition_std1+ strategy.order('Short', strategy.short, order_size*leverage_mult, alert_message=msg_open_short)else if conditionType == 'Original 0 Extra (Zigma with DMI + CE)'- strategy.order('Long', strategy.long, order_size*leverage_mult, when=LongCondition_std1extra, alert_message=msg_open_long)+ if LongCondition_std1extra+ strategy.order('Long', strategy.long, order_size*leverage_mult, alert_message=msg_open_long)- strategy.order('Short', strategy.short, order_size*leverage_mult, when=ShortCondition_std1extra, alert_message=msg_open_short)+ if ShortCondition_std1extra+ strategy.order('Short', strategy.short, order_size*leverage_mult, alert_message=msg_open_short)else if conditionType == 'Original Combination (Combo since Original to Original 0)'- strategy.order('Long', strategy.long, order_size*leverage_mult, when=LongCondition_Comb, alert_message=msg_open_long)+ if LongCondition_Comb+ strategy.order('Long', strategy.long, order_size*leverage_mult, alert_message=msg_open_long)- strategy.order('Short', strategy.short, order_size*leverage_mult, when=ShortCondition_Comb, alert_message=msg_open_short)+ if ShortCondition_Comb+ strategy.order('Short', strategy.short, order_size*leverage_mult, alert_message=msg_open_short)// exit order⋯ else- strategy.close('Long', when=closeLongCondition, qty_percent=100, alert_message=msg_close_long)+ if closeLongCondition+ strategy.close('Long', qty_percent=100, alert_message=msg_close_long)- strategy.close('Short', when=closeShortCondition, qty_percent=100, alert_message=msg_close_short)+ if closeShortCondition+ strategy.close('Short', qty_percent=100, alert_message=msg_close_short) ⋯Does it run in Pine Script v6?
Not tested
The v5 script does not run in Zeal Terminal's engine (Pine Script v5 Error at @L5:C0: no source was supplied for the library 'ZoomerXeus/AutoFiboRetrace/2'. Libraries cannot be fetched from TradingView; supply the source in the 'libraries' option. No libraries were supplied.), so this step could not be checked. The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.
⋯// © ZoomerXeus-//@version=5+//@version=6strategy("Solution Zigma", overlay=true, calc_on_every_tick=true)⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | No It imports the library ZoomerXeus/AutoFiboRetrace/2, whose source is not available here, so it does not run here | Not measured | |
| PineTS | Not tested | Not tested | Not measured |
“Matches TradingView” needs this script's own output exported from TradingView and compared bar by bar, which has not been done for this script. The engine is built on OpenPineScript, whose conformance results are in its conformance report.
Source
Copied verbatim from the author's published script, with its licence header intact. The author may have updated the original since this snapshot.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © ZoomerXeus//@version=5strategy("Solution Zigma", overlay=true, calc_on_every_tick=true)import ZoomerXeus/AutoFiboRetrace/2 as autoFibo// Input Dataord_con_1 = 'Original (Zigma Candle + CE + Subhag)'ord_con_2 = 'Original Extra (Zigma Candle with DMI + CE + Subhag)'ord_con_3 = 'Original 0 (Zigma + CE)'ord_con_4 = 'Original 0 Extra (Zigma with DMI + CE)'ord_con_5 = 'Original Combination (Combo since Original to Original 0)'fibo_level_source = input.string('0.5', 'Fibonaci Level source', options=['0.786', '0.618', '0.5', '0.382', '0.236'], group="General (Default setting for Binance's BTCUSDTPERP)")fibo_level_session = input.timeframe('60', 'Timeframe', options=["W", "D", "240", "60", "30", "15", "5", "1"], group="General (Default setting for Binance's BTCUSDTPERP)")fibo_lookback_length = input.int(12, 'Fibonaci lookback Length', minval=1, step=1, group="General (Default setting for Binance's BTCUSDTPERP)")isShowCandleMode = input.bool(true, 'Show Candle Mode', group="General (Default setting for Binance's BTCUSDTPERP)")//Alex Orekhov (everget)'s Chandelier ExitisShowFilterIndicator_ce = input.bool(false, 'Show On Chart', group="Alex Orekhov (everget)'s Chandelier Exit (Filter)")ce_length = input.int(1, 'ATR Chandelier Exit Length', minval=1, step=1, group="Alex Orekhov (everget)'s Chandelier Exit (Filter)")ce_mult = input.float(3.0, 'ATR Chandelier Exit Multiply', minval=0.1, step=0.1, group="Alex Orekhov (everget)'s Chandelier Exit (Filter)")// Subhag + TSD + EWO original by subhagghosh and edit by PumpithisShowFilterIndicator_subh = input.bool(false, 'Show On Chart', group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")fast_length = input(title='Fast Length', defval=3, group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")slow_length = input(title='Slow Length', defval=10, group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")src_sh = input(title='Source', defval=close, group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")res_60 = input('60', title='Higher Time Frame 1', group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")rsi_period = input.int(14, title='RSI period', minval=1, step=1, group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")source = input(close, group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")length = input.int(100, minval=1, group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")offset = input.int(0, minval=0, group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")smoothing = input.int(17, minval=1, group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")mtf_val = input.timeframe('', 'Resolution', group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")p = input.string('Lime', 'Up Color', options=['Red', 'Lime', 'Orange', 'Teal', 'Yellow', 'White', 'Black'], group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")q = input.string('Red', 'Down Color', options=['Red', 'Lime', 'Orange', 'Teal', 'Yellow', 'White', 'Black'], group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")switchColor = input(true, 'Color Regression according to trend?', group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")candleCol = input(false, title='Color candles based on Hull\'s Trend?', group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")visualSwitch = input(true, title='Show as a Band?', group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")thicknesSwitch = input(1, title='Line Thickness', group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")transpSwitch = input.int(40, title='Band Transparency', step=5, group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")n1 = input.int(10, 'Channel Length', group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")n2 = input.int(21, 'Average Length', group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")over_bought_level = input.int(53, 'Over Bought Level', group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")over_sold_level = input.int(-53, 'Over Sold Level', group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")sma1length = input(5, group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")sma2length = input(35, group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")UsePercent = input(title='Show Dif as percent of current Candle', defval=true, group="Subhag + TSD + EWO original by subhagghosh and edit by Pumpith (Filter)")conditionType = input.string(ord_con_4, "Open order type", options=[ord_con_1, ord_con_2, ord_con_3, ord_con_4, ord_con_5])order_size = input.float(0.001, 'Order Size', minval=0.001, step=0.1, tooltip="order size 1:Price e.g 1:38000(BTCUSDTPERP)", group="Alert Message and order Management")leverage_mult = input.int(10, 'Leverage Size', minval=1, step=1, group="Alert Message and order Management")close_order_type = input.string('Condition', 'Close Order Option', options=['RR', 'Condition'], group="Alert Message and order Management")rrUseAutoSL = input.bool(false, 'Use auto Calculate Stoploss', group="Alert Message and order Management")rrAutoSLType = input.string('Zigma Swing H/L', "Open order type", options=['Zigma Swing H/L', 'Candle Swing H/L'], group="Alert Message and order Management")rrAutoSLCalLength = input.int(5, 'Auto SL Calculate Length', tooltip="Use for fing Lowest and Highest.", step=1, minval=1, group="Alert Message and order Management")SLPer = input.float(1.00, "RR Stoploss percent", minval = 0.1, step=0.1, group="Alert Message and order Management")/100rrPer = input.float(2.00, "RR ratio", minval = 0.1, step=0.1, group="Alert Message and order Management")msg_open_long = input.string('Open Long', 'Alert Message Long', group="Alert Message and order Management")msg_open_short = input.string('Open Short', 'Alert Message Short', group="Alert Message and order Management")msg_close_long = input.string('Close Long', 'Alert Message Close Long', group="Alert Message and order Management")msg_close_short = input.string('Close Short', 'Alert Message Close Short', group="Alert Message and order Management")// -------------------------------------------- Fibonacci Impulse -----------------------------------------------------[FL236M, FL382M, FL500M, FL618M, FL786M, FL0,FL236, FL382, FL500, FL618, FL786, FL1000, FL1236, FL1382, FL1500, FL1618, FL1786, FL2] = request.security(syminfo.tickerid, fibo_level_session, autoFibo.original(fibo_lookback_length, low, high), gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_off)src = switch fibo_level_source '0.618' => FL618 '0.786' => FL786 '0.5' => FL500 '0.382' => FL382 '0.236' => FL236 //src = switch fibo_level_source// '0.618' => FL618// '0.786' => FL786// '0.5' => FL500// '0.382' => FL382// '0.236' => FL236// CDC Impulse candle dataopen_p = ta.ema(src, 26)close_p = ta.ema(src, 12)high_p = ta.highest(close_p, 4)low_p = ta.lowest(close_p, 4)// ------------------------------ controller -----------------------------------// tradingview's DMIsetDMI () => float diplus = 0.0 float diminus = 0.0 float adx = 0.0 [diplus_4h, diminus_4h, adx_4h] = request.security(syminfo.tickerid, "240", ta.dmi(14, 14), gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_off) [diplus_1h, diminus_1h, adx_1h] = request.security(syminfo.tickerid, "60", ta.dmi(14, 14), gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_off) [diplus_15m, diminus_15m, adx_15m] = request.security(syminfo.tickerid, "15", ta.dmi(14, 14), gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_off) if fibo_level_session == 'LongTrade(4H)' diplus := diplus_4h diminus := diminus_4h adx := adx_4h else if fibo_level_session == 'MediumTrade(1H)' diplus := diplus_1h diminus := diminus_1h adx := adx_1h else diplus := diplus_15m diminus := diminus_15m adx := adx_15m [diplus, diminus, adx][diplus, diminus, adx] = setDMI()// Alex Orekhov (everget)'s Chandelier Exitatr = ce_mult * ta.atr(ce_length)longStop = ta.highest(ce_length) - atrlongStopPrev = nz(longStop[1], longStop)longStop := close[1] > longStopPrev ? math.max(longStop, longStopPrev) : longStopshortStop = ta.lowest(ce_length) + atrshortStopPrev = nz(shortStop[1], shortStop)shortStop := close[1] < shortStopPrev ? math.min(shortStop, shortStopPrev) : shortStopvar int dir = 1dir := close > shortStopPrev ? 1 : close < longStopPrev ? -1 : dir// Subhag + TSD + EWO original by subhagghosh and edit by Pumpith/////////////////////////////////////////////////////////////////////// Check Trend Strengthha_t = syminfo.tickeridcol_red = #ff0000col_green = #00ff00TSB = trueTSS = falsetrend_60 = request.security(ha_t, res_60, (ta.ema(src_sh, fast_length) - ta.ema(src_sh, slow_length)) / src_sh * 100)prev_trend_60 = request.security(ha_t, res_60, (ta.ema(src_sh[5], fast_length) - ta.ema(src_sh[5], slow_length)) / src_sh[5] * 100)trend_status_60 = trend_60 > prev_trend_60/////////////////////////////////////////////////////////////////////End of checking stengthmyrsi = ta.rsi(close, rsi_period)rsi1 = ta.crossunder(myrsi, 70)rsi2 = myrsi > 75// Regression Linescc(x) => x == 'Red' ? color.red : x == 'Lime' ? color.lime : x == 'Orange' ? color.orange : x == 'Teal' ? color.teal : x == 'Yellow' ? color.yellow : x == 'Black' ? color.black : color.whitedata(x) => ta.ema(request.security(syminfo.tickerid, mtf_val != '' ? mtf_val : timeframe.period, x), smoothing)linreg = data(ta.linreg(source, length, offset))linreg_p = data(ta.linreg(source, length, offset + 1))// Regression End//##################################// TSD//##################################//// Indicators// Blue Waveap = hlc3esa = ta.ema(ap, n1)d = ta.ema(math.abs(ap - esa), n1)ci = (ap - esa) / (0.015 * d)tci = ta.ema(ci, n2)wt1 = tciwt2 = ta.sma(wt1, 4)// MFImfi_upper = math.sum(volume * (ta.change(hlc3) <= 0 ? 0 : hlc3), 58)mfi_lower = math.sum(volume * (ta.change(hlc3) >= 0 ? 0 : hlc3), 58)_mfi_rsi(mfi_upper, mfi_lower) => if mfi_lower == 0 100 if mfi_upper == 0 0 100.0 - 100.0 / (1.0 + mfi_upper / mfi_lower)mf = _mfi_rsi(mfi_upper, mfi_lower)mfi = (mf - 50) * 3//// Plotsmfi_color = mfi > 0 ? #4CAF50 : #FF5252dot_color = wt1 < wt2 ? #FF0000 : #4CAF50//##################################// EWO//##################################//@author Koryu//src = input(close, title="source")sma_1 = ta.sma(src, sma1length)sma_2 = ta.sma(src, sma2length)sma_3 = ta.sma(src, sma1length)sma_4 = ta.sma(src, sma2length)smadif = UsePercent ? (sma_1 - sma_2) / src * 100 : sma_3 - sma_4//col=smadif <= 0 ? red : green//plot(smadif, color=col, style=histogram, linewidth=2)//----------------------------------------------- Plot & Order -----------------------------------------------//// fibonacci impulsecandle_color = open_p < close_p ? color.new(color.green, isShowCandleMode ? 60 : 100) : (open_p > close_p ? color.new(color.red, isShowCandleMode ? 60 : 100) : color.new(color.white, isShowCandleMode ? 60 : 100))line_color = open_p < close_p ? color.new(color.green, isShowCandleMode ? 100 : 0) : (open_p > close_p ? color.new(color.red, isShowCandleMode ? 100 : 0) : color.new(color.white, isShowCandleMode ? 100 : 0))plotcandle(open_p, high_p, low_p, close_p, "Fibo Level Candle", color=candle_color, wickcolor=candle_color, bordercolor=candle_color)//plot(close > open_p ? open_p : na, title='Zigma Bull impulse', style=plot.style_linebr, linewidth=2, color=color.lime)//plot(close < open_p ? open_p : na, title='Zigma Bear impulse', style=plot.style_linebr, linewidth=2, color=color.red)var color longColor = color.greenvar color shortColor = color.red// SunhaghullColor = switchColor ? linreg > linreg[1] ? #00ff00 : #ff0000 : #ff9800//PLOTFi1 = plot(isShowFilterIndicator_subh ? linreg : na, title='Regression Line', color=hullColor, linewidth=thicknesSwitch, transp=50)Fi2 = plot(visualSwitch and isShowFilterIndicator_subh ? linreg[3] : na, title='RL', color=hullColor, linewidth=thicknesSwitch, transp=50)fill(Fi1, Fi2, title='Band Filler', color=hullColor, transp=transpSwitch)// CElongStopPlot = plot(isShowFilterIndicator_ce ? (dir == 1 ? longStop : na) : na, title='Long Stop', style=plot.style_linebr, linewidth=2, color=color.new(longColor, 0))buySignal = dir == 1 and dir[1] == -1plotshape(buySignal and isShowFilterIndicator_ce ? longStop : na, title='Long Stop Start', location=location.absolute, style=shape.circle, size=size.tiny, color=color.new(longColor, 0))shortStopPlot = plot(isShowFilterIndicator_ce ? (dir == 1 ? na : shortStop) : na, title='Short Stop', style=plot.style_linebr, linewidth=2, color=color.new(shortColor, 0))sellSignal = dir == -1 and dir[1] == 1plotshape(sellSignal and isShowFilterIndicator_ce ? shortStop : na, title='Short Stop Start', location=location.absolute, style=shape.circle, size=size.tiny, color=color.new(shortColor, 0))midPricePlot = plot(ohlc4, title='', style=plot.style_circles, linewidth=0, display=display.none, editable=false)//-----------------------------------------------------------------------------------------------------------////----------------------------------------------- order -----------------------------------------------//position_avg_price = strategy.position_avg_priceposition_size = strategy.position_size//*************************** Indicator Condition *****************************//// Fibonacci Impulsefibo_impulse_bear_over = ta.crossunder(close, open_p)fibo_impulse_bull_over = ta.crossover(close, open_p)// DMIdmi_Bull = diplus >= 25 and diplus > adxdmi_Bear = diminus >= 25 and diminus > adx// CEce_bull_rejection = dir == 1 and dir[1] != 1ce_bear_rejection = dir != 1 and dir[1] == 1ce_bull_controll = dir == 1ce_bear_controll = dir != 1// subhagsh_bull = close > linreg and close > linreg[3]sh_bear = close < linreg and close < linreg[3]//*************************** END Indicator Condition *****************************////*************** Original ***************//LongCondition = fibo_impulse_bull_over and (ce_bull_controll or ce_bull_rejection) and sh_bull and position_size == 0.0ShortCondition = fibo_impulse_bear_over and (ce_bear_controll or ce_bear_rejection) and sh_bear and position_size == 0.0//***************************************////*************** Original Extra ***************//LongCondition_extra = fibo_impulse_bull_over and dmi_Bull and (ce_bull_controll or ce_bull_rejection) and sh_bull and position_size == 0.0ShortCondition_extra = fibo_impulse_bear_over and dmi_Bear and (ce_bear_controll or ce_bear_rejection) and sh_bear and position_size == 0.0//***************************************////*************** Original 0 ***************//LongCondition_std1 = fibo_impulse_bull_over and (ce_bull_controll or ce_bull_rejection) and position_size == 0.0ShortCondition_std1 = fibo_impulse_bear_over and (ce_bear_controll or ce_bear_rejection) and position_size == 0.0//***************************************////*************** Original 0 Extra ***************//LongCondition_std1extra = fibo_impulse_bull_over and dmi_Bull and (ce_bull_controll or ce_bull_rejection) and position_size == 0.0ShortCondition_std1extra = fibo_impulse_bear_over and dmi_Bear and (ce_bear_controll or ce_bear_rejection) and position_size == 0.0//***************************************////*************** Original Combination ***************//LongCondition_Comb = LongCondition or LongCondition_extra or LongCondition_std1 or LongCondition_std1extraShortCondition_Comb = ShortCondition or ShortCondition_extra or ShortCondition_std1 or ShortCondition_std1extra//***************************************//// plot Labelplotshape(conditionType == 'Original (Zigma Candle + CE + Subhag)' ? LongCondition : na, title='Buy Signal Label', text='Buy', location=location.belowbar, style=shape.labelup, size=size.tiny, color=color.lime, textcolor=color.new(color.white, 0))plotshape(conditionType == 'Original (Zigma Candle + CE + Subhag)' ? ShortCondition : na, title='Sell Signal Label', text='Sell', location=location.abovebar, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.new(color.white, 0))plotshape(conditionType == 'Original Extra (Zigma Candle with DMI + CE + Subhag)' ? LongCondition_extra : na, title='Buy Signal Label', text='Buy', location=location.belowbar, style=shape.labelup, size=size.tiny, color=color.lime, textcolor=color.new(color.white, 0))plotshape(conditionType == 'Original Extra (Zigma Candle with DMI + CE + Subhag)' ? ShortCondition_extra : na, title='Sell Signal Label', text='Sell', location=location.abovebar, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.new(color.white, 0))plotshape(conditionType == 'Original 0 (Zigma + CE)' ? LongCondition_std1 : na, title='Buy Signal Label', text='Buy', location=location.belowbar, style=shape.labelup, size=size.tiny, color=color.lime, textcolor=color.new(color.white, 0))plotshape(conditionType == 'Original 0 (Zigma + CE)' ? ShortCondition_std1 : na, title='Sell Signal Label', text='Sell', location=location.abovebar, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.new(color.white, 0))plotshape(conditionType == 'Original 0 Extra (Zigma with DMI + CE)' ? LongCondition_std1extra : na, title='Buy Signal Label', text='Buy', location=location.belowbar, style=shape.labelup, size=size.tiny, color=color.lime, textcolor=color.new(color.white, 0))plotshape(conditionType == 'Original 0 Extra (Zigma with DMI + CE)' ? ShortCondition_std1extra : na, title='Sell Signal Label', text='Sell', location=location.abovebar, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.new(color.white, 0))plotshape(conditionType == 'Original Combination (Combo since Original to Original 0)' ? LongCondition_Comb : na, title='Buy Signal Label', text='Buy', location=location.belowbar, style=shape.labelup, size=size.tiny, color=color.lime, textcolor=color.new(color.white, 0))plotshape(conditionType == 'Original Combination (Combo since Original to Original 0)' ? ShortCondition_Comb : na, title='Sell Signal Label', text='Sell', location=location.abovebar, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.new(color.white, 0))// open orderif conditionType == 'Original (Zigma Candle + CE + Subhag)' strategy.order('Long', strategy.long, order_size*leverage_mult, when=LongCondition, alert_message=msg_open_long) strategy.order('Short', strategy.short, order_size*leverage_mult, when=ShortCondition, alert_message=msg_open_short)else if conditionType == 'Original Extra (Zigma Candle with DMI + CE + Subhag)' strategy.order('Long', strategy.long, order_size*leverage_mult, when=LongCondition_extra, alert_message=msg_open_long) strategy.order('Short', strategy.short, order_size*leverage_mult, when=ShortCondition_extra, alert_message=msg_open_short)else if conditionType == 'Original 0 (Zigma + CE)' strategy.order('Long', strategy.long, order_size*leverage_mult, when=LongCondition_std1, alert_message=msg_open_long) strategy.order('Short', strategy.short, order_size*leverage_mult, when=ShortCondition_std1, alert_message=msg_open_short)else if conditionType == 'Original 0 Extra (Zigma with DMI + CE)' strategy.order('Long', strategy.long, order_size*leverage_mult, when=LongCondition_std1extra, alert_message=msg_open_long) strategy.order('Short', strategy.short, order_size*leverage_mult, when=ShortCondition_std1extra, alert_message=msg_open_short)else if conditionType == 'Original Combination (Combo since Original to Original 0)' strategy.order('Long', strategy.long, order_size*leverage_mult, when=LongCondition_Comb, alert_message=msg_open_long) strategy.order('Short', strategy.short, order_size*leverage_mult, when=ShortCondition_Comb, alert_message=msg_open_short)// exit order// sltpfloat auto_sl_high = 0.0float auto_sl_low = 0.0if rrAutoSLType == 'Zigma Swing H/L' auto_sl_high := ta.highest(high_p, rrAutoSLCalLength) auto_sl_low := ta.lowest(low_p, rrAutoSLCalLength)else auto_sl_high := ta.highest(high, rrAutoSLCalLength) auto_sl_low := ta.lowest(low, rrAutoSLCalLength)float sl_percent_bull = 0.0float sl_percent_bear = 0.0sl_percent_bull_auto = sl_percent_bull[1] == 0.0 and position_size != 0 ? (position_avg_price - auto_sl_low)/position_avg_price : (position_size != 0 ? sl_percent_bull[1] : 0.0)sl_percent_bull_fix = sl_percent_bull[1] == 0.0 and position_size != 0 ? SLPer : 0.0sl_percent_bull := rrUseAutoSL ? sl_percent_bull_auto : sl_percent_bull_fixstopPriceBull = position_avg_price * (1 - sl_percent_bull)takeProfitBull = position_avg_price * (1 + (sl_percent_bull*rrPer))sl_percent_bear_auto = sl_percent_bear[1] == 0.0 and position_size != 0 ? (auto_sl_high - position_avg_price) / position_avg_price : (position_size != 0 ? sl_percent_bear[1] : 0.0)sl_percent_bear_fix = sl_percent_bear[1] == 0.0 and position_size != 0 ? SLPer : 0.0sl_percent_bear := rrUseAutoSL ? sl_percent_bear_auto : sl_percent_bear_fixstopPriceBear = position_avg_price * (1 + sl_percent_bear)takeProfitBear = position_avg_price * (1 - (sl_percent_bear*rrPer))plot(close_order_type == 'RR' ? (position_size < 0 ? stopPriceBear : stopPriceBull) : na, "Short's SL Line", style=plot.style_linebr, color=color.red)plot(close_order_type == 'RR' ? (position_size < 0 ? takeProfitBear : takeProfitBull) : na, "Short's TP Line", style=plot.style_linebr, color=color.green)// ConditioncloseLongCondition = (ta.crossunder(close, open_p) or close < open_p) and (ce_bear_controll or ce_bear_rejection)closeShortCondition = (ta.crossover(close, open_p) or close > open_p) and (ce_bull_controll or ce_bull_rejection)// Plot Label//plotshape(conditionType == 'Original (Zigma Candle + CE + Subhag)' ? closeLongCondition : na, title='Close Buy Signal Label', text='Close Buy', location=location.belowbar, style=shape.labelup, size=size.tiny, color=color.lime, textcolor=color.new(color.white, 0))//plotshape(conditionType == 'Original (Zigma Candle + CE + Subhag)' ? closeLongCondition : na, title='Close Sell Signal Label', text='Close Sell', location=location.abovebar, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.new(color.white, 0))////plotshape(conditionType == 'Original Extra (Zigma Candle with DMI + CE + Subhag)' ? closeLongCondition : na, title='Close Buy Signal Label', text='Close Buy', location=location.belowbar, style=shape.labelup, size=size.tiny, color=color.lime, textcolor=color.new(color.white, 0))//plotshape(conditionType == 'Original Extra (Zigma Candle with DMI + CE + Subhag)' ? closeLongCondition : na, title='Close Sell Signal Label', text='Close Sell', location=location.abovebar, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.new(color.white, 0))////plotshape(conditionType == 'Standard 1 (Zigma + CE)' ? closeLongCondition : na, title='Close Buy Signal Label', text='Close Buy', location=location.belowbar, style=shape.labelup, size=size.tiny, color=color.lime, textcolor=color.new(color.white, 0))//plotshape(conditionType == 'Standard 1 (Zigma + CE)' ? closeLongCondition : na, title='Close Sell Signal Label', text='Close Sell', location=location.abovebar, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.new(color.white, 0))if conditionType == 'Original (Zigma Candle + CE + Subhag)' or conditionType == 'Original Extra (Zigma Candle with DMI + CE + Subhag)' or conditionType == 'Original 0 (Zigma + CE)' or conditionType == 'Original 0 Extra (Zigma with DMI + CE)' or conditionType == 'Original Combination (Combo since Original to Original 0)' if close_order_type == 'RR' strategy.exit('Exit Long', 'Long', stop=stopPriceBull,limit=takeProfitBull, alert_message=msg_close_long) strategy.exit('Exit Short', 'Short', stop=stopPriceBear,limit=takeProfitBear, alert_message=msg_close_short) else strategy.close('Long', when=closeLongCondition, qty_percent=100, alert_message=msg_close_long) strategy.close('Short', when=closeShortCondition, qty_percent=100, alert_message=msg_close_short) // เงื่อนไขการเข้าแบบใหม่ให้ใช้ตัว CE กับ Impulse Candle เป็นตัว trigger แล้วแต่กรณีหากอยู่เหนือ IC ให้ใช้ CE