Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

VixFixLinReg-Strategy

A Pine Script v4 strategy built on Highest (close, 22), Stdev (wvf, 20) and SMA (wvf, 20). It has 3 order rules, 1 entry among them, and trades long only with the default settings. Exits use a stop loss. Each trade commits 100% of equity and pays 0.01% commission. 17 settings; defaults include LookBack Period Standard Deviation High 22, Bolinger Band Length 20 and Bollinger Band Standard Devaition Up 2.0.

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 VixFixLinReg-Strategy repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 2 of 2 trades.
How did VixFixLinReg-Strategy do on BTCUSDT 1D with default settings?
−49.25%
From 26 Jan 2024 to 21 Oct 2026, over 12 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Can VixFixLinReg-Strategy be converted to Pine Script v5?
Yes
The upgrade takes 1 step, from v4; each was run before and after on the same candles with identical results, and the v5 script can be downloaded below.
Does VixFixLinReg-Strategy use a stop loss?
Yes
strategy.exit sets a stop on line 56.
Does VixFixLinReg-Strategy run in Zeal Terminal?
Yes
It compiles in 20 ms and runs 1,000 bars in 59 ms, in the browser.

BTCUSDT · 1D · default settings

  • Williams Vix Fix
  • Linear Regression
  • Winning trade
  • Losing trade
  • Equity
  • Buy and hold
Prerendered with the defaults. Change anything and run it here. The script runs in your browser.
Settings (17)
Stop : 75330.740306428740,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOctWilliams Vix Fix$66,829$202,527Equity from $100,000
Binance BTCUSDT 1D candles, 26 Jan 2024 to 21 Oct 2026, 1,000 bars, default settings. Triangles mark entries; circles mark exits. Lines are what the script plots. Lines, boxes and labels are the script's own drawings, the most recent ones its limits keep.
Net profit
−49.25%
−$49,250.00
Buy and hold
+102.5%
same period
Closed trades
12
2 won · 10 lost
Profitable
16.7%
of closed trades
Profit factor
0.19
gross profit ÷ gross loss
Max drawdown
51.12%
−$51,120.50

One run with the author's default settings, $100,000 starting capital, commission as the script sets it. A long position was still open at the last bar. A single backtest says little about future results and is not a recommendation. Backtests are simulations on historical data and are not investment advice.

Review

What a careful reader of this script would point out, found by checking the source and the backtest.

  • Check

    2 settings do nothing

    “KC Length”, “KC MultFactor” are declared but never read.

  • Check

    Every trade uses all the equity

    default_qty_value is 100% of equity.

  • Note

    5 settings have no label

    In the settings dialog considerVIXFixClose (line 19), atrLen (line 22), atrMult (line 23), initialStopBar (line 24), waitForCloseBeforeStop (line 25) 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 54, 55, 56. The upgraded version below moves each call inside an if block.

Upgrade and export

Written in Pine Script v4. The upgrade to v5 takes 1 step, one per version, each applied to the result of the one before. A last clean-v5 pass then types the settings and moves when = into if blocks, which v6 requires. Every step runs before and after on the same candles in Zeal Terminal's engine; a step whose results differ is shown but not offered as a download. Upgrades preserve behaviour: bugs are fixed in the Review, never silently here.

  • Upgrading to v5 renames atr → ta.atr, lowest → ta.lowest, max → math.max, highest → ta.highest, stdev → ta.stdev, sma → ta.sma, linreg → ta.linreg, abs → math.abs, tostring → str.tostring.
  • 3 strategy calls use the when = argument (line 54, 55, 56). It is deprecated in v5 and removed in v6, where each call moves inside an if block.

v4 → v5

Verified

Same 12 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • Line 3: //@version=4 → //@version=5
  • Line 16: input(type = input.time) → input.time()
  • Line 17: input(type = input.time) → input.time()
  • Line 27: atr → ta.atr
  • Line 27: lowest → ta.lowest
  • Line 28: max → math.max
11 more edits
  • Line 28: lowest → ta.lowest
  • Line 30: highest → ta.highest
  • Line 30: highest → ta.highest
  • Line 31: stdev → ta.stdev
  • Line 32: sma → ta.sma
  • Line 35: highest → ta.highest
  • Line 36: lowest → ta.lowest
  • Line 38: linreg → ta.linreg
  • Line 39: abs → math.abs
  • Line 47: max → math.max
  • Line 52: tostring → str.tostring
⋯// © HeWhoMustNotBeNamed-//@version=4+//@version=5strategy("VixFixLinReg-Strategy", shorttitle="VixFixLinReg - Strategy",⋯sd = input(false, title="Show Standard Deviation Line?")-i_startTime = input(defval = timestamp("01 Jan 2010 00:00 +0000"), title = "Start Time", type = input.time)+i_startTime = input.time(defval = timestamp("01 Jan 2010 00:00 +0000"), title = "Start Time")-i_endTime = input(defval = timestamp("01 Jan 2099 00:00 +0000"), title = "End Time", type = input.time)+i_endTime = input.time(defval = timestamp("01 Jan 2099 00:00 +0000"), title = "End Time")inDateRange = time >= i_startTime and time <= i_endTime⋯f_getStop(atrLen, atrMult)=>-    stop = strategy.position_size > 0 ? close - (atrMult * atr(atrLen)) : lowest(initialStopBar)+    stop = strategy.position_size > 0 ? close - (atrMult * ta.atr(atrLen)) : ta.lowest(initialStopBar)-    stop := strategy.position_size > 0 ? max(stop,nz(stop[1], stop)) : lowest(initialStopBar)+    stop := strategy.position_size > 0 ? math.max(stop,nz(stop[1], stop)) : ta.lowest(initialStopBar)    stop-wvf = ((highest(close, pd)-low)/(highest(close, pd)))*100+wvf = ((ta.highest(close, pd)-low)/(ta.highest(close, pd)))*100-sDev = mult * stdev(wvf, bbl)+sDev = mult * ta.stdev(wvf, bbl)-midLine = sma(wvf, bbl)+midLine = ta.sma(wvf, bbl)lowerBand = midLine - sDevupperBand = midLine + sDev-rangeHigh = (highest(wvf, lb)) * ph+rangeHigh = (ta.highest(wvf, lb)) * ph-rangeLow = (lowest(wvf, lb)) * pl+rangeLow = (ta.lowest(wvf, lb)) * plcol = wvf >= upperBand or wvf >= rangeHigh ? color.lime : color.gray-val = linreg(wvf, pd, 0)+val = ta.linreg(wvf, pd, 0)-absVal = abs(val)+absVal = math.abs(val)linRegColor = val>val[1]? (val > 0 ? color.green : color.orange): (val > 0 ? color.lime : color.red)⋯vixFixState = (col == color.lime) ? 1: 0-vixFixState := strategy.position_size == 0? max(vixFixState, nz(vixFixState[1],0)) : vixFixState+vixFixState := strategy.position_size == 0? math.max(vixFixState, nz(vixFixState[1],0)) : vixFixStatelongCondition = (vixFixState == 1 and linRegColor == color.lime) and inDateRange⋯label_x = time+(60*60*24*1000*20) -myLabel = label.new(x=label_x, y=0, text="Stop : "+tostring(stop), xloc=xloc.bar_time, style=label.style_none, textcolor=color.black, size=size.normal)+myLabel = label.new(x=label_x, y=0, text="Stop : "+str.tostring(stop), xloc=xloc.bar_time, style=label.style_none, textcolor=color.black, size=size.normal)label.delete(myLabel[1])⋯

Clean v5

VerifiedDownload the v5 script

Same 12 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • Line 8: input() → input.int()
  • Line 9: input() → input.int()
  • Line 10: input() → input.float()
  • Line 11: input() → input.int()
  • Line 12: input() → input.float()
  • Line 13: input() → input.float()
12 more edits
  • Line 14: input() → input.bool()
  • Line 15: input() → input.bool()
  • Line 19: input() → input.bool()
  • Line 20: input() → input.int()
  • Line 21: input() → input.float()
  • Line 22: input() → input.int()
  • Line 23: input() → input.int()
  • Line 24: input() → input.int()
  • Line 25: input() → input.bool()
  • Line 54: when = longCondition → if block
  • Line 55: when = exitLongCondition or (close < stop and waitForCloseBeforeStop and linRegColor == color.green) → if block
  • Line 56: when = not waitForCloseBeforeStop and linRegColor == color.green → if block
⋯                     commission_value = 0.01)-pd = input(22, title="LookBack Period Standard Deviation High")+pd = input.int(22, title="LookBack Period Standard Deviation High")-bbl = input(20, title="Bolinger Band Length")+bbl = input.int(20, title="Bolinger Band Length")-mult = input(2.0    , minval=1, maxval=5, title="Bollinger Band Standard Devaition Up")+mult = input.float(2.0    , minval=1, maxval=5, title="Bollinger Band Standard Devaition Up")-lb = input(50  , title="Look Back Period Percentile High")+lb = input.int(50  , title="Look Back Period Percentile High")-ph = input(.85, title="Highest Percentile - 0.90=90%, 0.95=95%, 0.99=99%")+ph = input.float(.85, title="Highest Percentile - 0.90=90%, 0.95=95%, 0.99=99%")-pl = input(1.01, title="Lowest Percentile - 1.10=90%, 1.05=95%, 1.01=99%")+pl = input.float(1.01, title="Lowest Percentile - 1.10=90%, 1.05=95%, 1.01=99%")-hp = input(false, title="Show High Range - Based on Percentile and LookBack Period?")+hp = input.bool(false, title="Show High Range - Based on Percentile and LookBack Period?")-sd = input(false, title="Show Standard Deviation Line?")+sd = input.bool(false, title="Show Standard Deviation Line?")i_startTime = input.time(defval = timestamp("01 Jan 2010 00:00 +0000"), title = "Start Time")⋯inDateRange = time >= i_startTime and time <= i_endTime-considerVIXFixClose = input(false)+considerVIXFixClose = input.bool(false)-lengthKC=input(20, title="KC Length")+lengthKC=input.int(20, title="KC Length")-multKC = input(1.5, title="KC MultFactor")+multKC = input.float(1.5, title="KC MultFactor")-atrLen = input(22)+atrLen = input.int(22)-atrMult = input(5)+atrMult = input.int(5)-initialStopBar = input(5)+initialStopBar = input.int(5)-waitForCloseBeforeStop = input(true)+waitForCloseBeforeStop = input.bool(true)f_getStop(atrLen, atrMult)=>⋯label.delete(myLabel[1])-strategy.entry("Long", strategy.long, when=longCondition, oca_name="oca_buy", oca_type=strategy.oca.cancel)+if longCondition+    strategy.entry("Long", strategy.long, oca_name="oca_buy", oca_type=strategy.oca.cancel)-strategy.close("Long", when=exitLongCondition or (close < stop and waitForCloseBeforeStop and linRegColor == color.green))+if exitLongCondition or (close < stop and waitForCloseBeforeStop and linRegColor == color.green)+    strategy.close("Long")-strategy.exit("ExitLong", "Long", stop = stop, when=not waitForCloseBeforeStop and linRegColor == color.green)+if not waitForCloseBeforeStop and linRegColor == color.green+    strategy.exit("ExitLong", "Long", stop = stop)

Does it run in Pine Script v6?

No

The v6 version runs in Zeal Terminal's engine, but its results differ from the v5 version: Trades differ: 12 before, 15 after on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine. It is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.

⋯// © HeWhoMustNotBeNamed-//@version=5+//@version=6strategy("VixFixLinReg-Strategy", shorttitle="VixFixLinReg - Strategy",⋯

Settings

Every input the script declares, with its default and what it feeds. Bounds are the ones the script enforces.

SettingDefaultType and rangeFeeds
LookBack Period Standard Deviation High22intwvf val
Bolinger Band Length20intsDev midLine
Bollinger Band Standard Devaition Up2.0float · min 1 · max 5sDev
Look Back Period Percentile High50intrangeHigh rangeLow
Highest Percentile - 0.90=90%, 0.95=95%, 0.99=99%.85floatrangeHigh
Lowest Percentile - 1.10=90%, 1.05=95%, 1.01=99%1.01floatrangeLow
Show High Range - Based on Percentile and LookBack Period?falseboolRange High Percentile
Show Standard Deviation Line?falseboolUpper Band
Start Timetimestamp("01 Jan 2010 00:00 +0000")timeinDateRange
End Timetimestamp("01 Jan 2099 00:00 +0000")timeinDateRange
Consider VIXFix Close (no label in the script)falseboolexitLongCondition
KC Length20intunused
KC MultFactor1.5floatunused
ATR Len (no label in the script)22intstop
ATR Mult (no label in the script)5intstop
Initial Stop Bar (no label in the script)5intstop
Wait For Close Before Stop (no label in the script)trueboolclose Long exit ExitLong

What it calculates

  • Highest (highest, ta.highest in v5)close, LookBack Period Standard Deviation High (22)wvf · line 30
  • Stdev (stdev, ta.stdev in v5)wvf, Bolinger Band Length (20)sDev · line 31
  • SMA (sma, ta.sma in v5)wvf, Bolinger Band Length (20)midLine · line 32
  • Highest (highest, ta.highest in v5)wvf, Look Back Period Percentile High (50)rangeHigh · line 35
  • Lowest (lowest, ta.lowest in v5)wvf, Look Back Period Percentile High (50)rangeLow · line 36
  • Linreg (linreg, ta.linreg in v5)wvf, LookBack Period Standard Deviation High (22), 0val · line 38

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.

lowlowprice dataclosecloseprice datapdLookBack Period Standar…setting · 22multBollinger Band Standard…setting · 2.0bblBolinger Band Lengthsetting · 20lbLook Back Period Percen…setting · 50phHighest Percentile - 0.…setting · .85plLowest Percentile - 1.1…setting · 1.01atrLenATR Lensetting · 22atrMultATR Multsetting · 5timetimeprice datai_startTimeStart Timesetting · timestamp("01 Jan 2…i_endTimeEnd Timesetting · timestamp("01 Jan 2…wvfHighest→ wvfsDevStdev→ sDevmidLineSMA→ midLinerangeHighHighest→ rangeHighrangeLowLowest→ rangeLowvalLinreg→ valstopstopvaluelowerBand, upperBandlowerBand · upperBand2 valuesabsValabsValvaluelabel_xlabel_xvalueinDateRangeinDateRangeconditioncol, linRegColor, vixFixState, longCondition, exitLongCondition, myLabelColourcol · linRegColor +4entry:LongOpen Longstrategy.entryclose:LongClose Longstrategy.closeexit:ExitLongexit ExitLongstrategy.exitplot:41Range High Percentileplotplot:42Range High Percentileplotplot:43Williams Vix Fixplotplot:44Upper Bandplotplot:45Linear Regressionplot

Order rules

OrderFires whenBy defaultLine
Open Long longlongConditionOn54
Close LongexitLongCondition or (close < stop and waitForCloseBeforeStop and linRegColor == color.green)On55
Exit ExitLong stopnot waitForCloseBeforeStop and linRegColor == color.greenOn56

Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.

Does it repaint?

No

No repainting patterns in the source, and the live replay matched history.

2/2trades identical when replayed liveThe last 300 bars, from 26 Dec 2025, were fed to the engine as live ticks, four per bar, and compared with the historical run. Orders are decided once per closed bar, so nothing can change mid-bar.
  • ClearHigher-timeframe dataThe script requests no other symbol or timeframe.
  • ClearFuture-bar referencesNo negative history offsets such as close[-1].
  • ClearIntrabar recalculationNo varip, calc_on_every_tick or realtime-only state. Orders are decided once per closed bar.
  • 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.

Other markets

The same script with default settings on 8 Binance markets. Each row is a separate backtest over the most recent 1,000 bars.

MarketNetBuy and holdTradesWonProfit factorMax drawdownPeriod
BTCUSDT 1D−49.3%+102.5%1217%0.1951.1%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h−0.1%+5.5%1233%0.9917.3%8 May 2026 – 21 Oct 2026
ETHUSDT 1D−11.4%+9.8%119%0.8745.0%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+54.7%+8.4%743%5.258.8%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−81.7%+16.7%1421%0.0782.4%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+40.2%+21.5%944%2.7913.7%8 May 2026 – 21 Oct 2026
BNBUSDT 1D−3.6%+148.3%1225%0.9534.9%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+17.6%+17.1%944%2.1312.5%8 May 2026 – 21 Oct 2026

Backtests are simulations on historical data and are not investment advice.

The trades

By market direction

At entry, last 90 barsTradesWonP&L
Rising market250%−$10,415.00
Sideways market617%−$18,146.20
Falling market40%−$20,683.70

Rising and falling mean the market moved more than 15% over the 90 bars before entry.

How bad could the drawdown be?

56.1%

The 95th percentile of the worst drawdown when the same 12 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 49.2% to 56.1%; the tick is what actually happened, 49.2%. Order luck alone moves it this much.

0%65%
All 12 trades
SideEntryExitBarsP&L
long26 Mar 2024 69,880.005 Jul 2024 57,050.00101−$18,376.30
long10 Jul 2024 58,050.006 Aug 2024 54,018.8027−$5,683.40
long14 Aug 2024 60,587.2016 Aug 2024 57,541.102−$3,832.43
long8 Nov 2024 75,857.9027 Feb 2025 84,250.10111$7,961.31
long7 Mar 2025 89,931.9010 Mar 2025 80,734.503−$8,203.10
long15 Mar 2025 83,983.209 Apr 2025 76,322.4025−$6,568.53
long10 May 2025 102,972.0030 Aug 2025 108,377.00112$3,413.98
long4 Sep 2025 111,706.0012 Oct 2025 110,644.0038−$666.44
long25 Oct 2025 111,005.005 Nov 2025 101,497.0011−$5,840.56
long25 Nov 2025 88,300.001 Feb 2026 78,741.1068−$6,745.03
long11 Feb 2026 68,841.303 Jun 2026 66,760.80112−$1,686.79
long13 Jun 2026 63,580.002 Jul 2026 60,024.0019−$3,017.63

Similar scripts

Indicators and strategies built from the same calculations, run on BTCUSDT 1D with their own defaults so they can be compared directly.

ScriptSharesTypeNetTradesMax drawdown
VixFixLinReg-Strategy this page—v4 strategy−49.3%1251.1%
Lawyers Trend Pro Strategy by ErdemDemirsma stdev lowest highestv4 strategy+12.1%10241.7%
BTC Volatility Band Strategy by gary_tradessma stdev lowest highestv4 strategy−33.5%8045.0%
MACandles-LinearRegression-Strategy by Trendoscopestdev sma highest lowestv5 strategy+26.7%346.7%
Chandelier + BB + EMAS by juanchezhighest lowest sma stdevv4 strategy−20.6%1038.6%
Crunchster's Turtle and Trend System by Crunchster1lowest highest stdev smav5 strategy+18.0%3116.7%

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 20 msYes 1,000 bars in 59 msNot measured
PineTSNo v5 and v6 only—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. PineTS runs Pine Script v5 and v6 only.

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/// © HeWhoMustNotBeNamed//@version=4strategy("VixFixLinReg-Strategy", shorttitle="VixFixLinReg - Strategy",                     overlay=false, initial_capital = 100000,                      default_qty_type = strategy.percent_of_equity, default_qty_value = 100, commission_type = strategy.commission.percent, pyramiding = 1,                      commission_value = 0.01)pd = input(22, title="LookBack Period Standard Deviation High")bbl = input(20, title="Bolinger Band Length")mult = input(2.0    , minval=1, maxval=5, title="Bollinger Band Standard Devaition Up")lb = input(50  , title="Look Back Period Percentile High")ph = input(.85, title="Highest Percentile - 0.90=90%, 0.95=95%, 0.99=99%")pl = input(1.01, title="Lowest Percentile - 1.10=90%, 1.05=95%, 1.01=99%")hp = input(false, title="Show High Range - Based on Percentile and LookBack Period?")sd = input(false, title="Show Standard Deviation Line?")i_startTime = input(defval = timestamp("01 Jan 2010 00:00 +0000"), title = "Start Time", type = input.time)i_endTime = input(defval = timestamp("01 Jan 2099 00:00 +0000"), title = "End Time", type = input.time)inDateRange = time >= i_startTime and time <= i_endTimeconsiderVIXFixClose = input(false)lengthKC=input(20, title="KC Length")multKC = input(1.5, title="KC MultFactor")atrLen = input(22)atrMult = input(5)initialStopBar = input(5)waitForCloseBeforeStop = input(true)f_getStop(atrLen, atrMult)=>    stop = strategy.position_size > 0 ? close - (atrMult * atr(atrLen)) : lowest(initialStopBar)    stop := strategy.position_size > 0 ? max(stop,nz(stop[1], stop)) : lowest(initialStopBar)    stopwvf = ((highest(close, pd)-low)/(highest(close, pd)))*100sDev = mult * stdev(wvf, bbl)midLine = sma(wvf, bbl)lowerBand = midLine - sDevupperBand = midLine + sDevrangeHigh = (highest(wvf, lb)) * phrangeLow = (lowest(wvf, lb)) * plcol = wvf >= upperBand or wvf >= rangeHigh ? color.lime : color.grayval = linreg(wvf, pd, 0)absVal = abs(val)linRegColor = val>val[1]? (val > 0 ? color.green : color.orange): (val > 0 ? color.lime : color.red)plot(hp and rangeHigh ? rangeHigh : na, title="Range High Percentile", style=plot.style_line, linewidth=4, color=color.orange)plot(hp and rangeLow ? rangeLow : na, title="Range High Percentile", style=plot.style_line, linewidth=4, color=color.orange)plot(wvf, title="Williams Vix Fix", style=plot.style_histogram, linewidth = 4, color=col)plot(sd and upperBand ? upperBand : na, title="Upper Band", style=plot.style_line, linewidth = 3, color=color.aqua)plot(-absVal, title="Linear Regression", style=plot.style_histogram, linewidth=4, color=linRegColor)vixFixState = (col == color.lime) ? 1: 0vixFixState := strategy.position_size == 0? max(vixFixState, nz(vixFixState[1],0)) : vixFixStatelongCondition = (vixFixState == 1 and linRegColor == color.lime) and inDateRangeexitLongCondition = (linRegColor == color.orange or linRegColor == color.red) and considerVIXFixClosestop = f_getStop(atrLen, atrMult)label_x = time+(60*60*24*1000*20) myLabel = label.new(x=label_x, y=0, text="Stop : "+tostring(stop), xloc=xloc.bar_time, style=label.style_none, textcolor=color.black, size=size.normal)label.delete(myLabel[1])strategy.entry("Long", strategy.long, when=longCondition, oca_name="oca_buy", oca_type=strategy.oca.cancel)strategy.close("Long", when=exitLongCondition or (close < stop and waitForCloseBeforeStop and linRegColor == color.green))strategy.exit("ExitLong", "Long", stop = stop, when=not waitForCloseBeforeStop and linRegColor == color.green)