Pine Script v4 · Strategy
RSI of VWAP [SHORT selling]
A Pine Script v4 strategy built on RSI (vwap, 11) and EMA (close, 200). It has 5 order rules, 2 entries among them, and trades short only with the default settings. Exits wait for a signal; there is no stop loss. Each trade commits 20% of equity and pays no commission. 8 settings; defaults include RSI Length 11, RSI Oversold (SHORT sell Line) 25 and RSI Overbought (SHORT Exit/cover Line) 70.
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 RSI of VWAP [SHORT selling] repaint?
- No
- No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
- How did RSI of VWAP [SHORT selling] do on BTCUSDT 1D with default settings?
- Not measured
- It closed no trades there from 26 Jan 2024 to 21 Oct 2026 with the default settings, so there is no result to report. Its entry conditions never all held on this data. It closed no trades on the other markets either. A backtest, not investment advice.
- Can RSI of VWAP [SHORT selling] be converted to Pine Script v5?
- Not tested
- The steps are shown below, but neither version placed a trade on any market tested, so there was nothing to compare and no download is offered.
- Does RSI of VWAP [SHORT selling] use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does RSI of VWAP [SHORT selling] run in Zeal Terminal?
- Yes
- It compiles in 18 ms and runs 1,000 bars in 62 ms, in the browser.
BTCUSDT · 1D · default settings
- RSI of VWAP
- RSI of VWAP weekly
- Middle Line
- Overbought
- Oversold
- Winning trade
- Losing trade
- Equity
- Buy and hold
Needs CBOE:VIX D data, not available: not a Binance spot market Values that depend on it are empty on this chart.
- Net profit
- 0.00%
- $0.00
- Buy and hold
- +102.5%
- same period
- Closed trades
- 0
- 0 won · 0 lost
- Profitable
- 0.0%
- of closed trades
- Profit factor
- —
- gross profit ÷ gross loss
- Max drawdown
- 0.00%
- $0.00
One run with the author's default settings, $10,000 starting capital, commission as the script sets it. 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.
-
Likely bug
rsi(vixVal, 14) ignores the settings line 20
Line 20 hard-codes 14 where line 14 uses “RSI Length”. Changing those settings moves one band but not this one.
rsi(vixVal,14)rsi(vixVal, rsiLength) -
Likely bug
crossover(vixRsi, 60) ignores the settings line 39
Line 39 hard-codes 60 where line 57 uses “RSI Oversold (SHORT sell Line)”. Changing those settings moves one band but not this one.
crossover(vixRsi,60)crossover(vixRsi, osLevel) -
Check
1 setting does nothing
“Show Weekly VWAP RSI” is declared but never read.
-
Check
No stop loss
Every exit waits for a signal. Nothing limits a losing trade before the exit condition fires.
-
Check
No commission
The backtest assumes free trading. Results on any real exchange will be lower.
-
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 38, 39, 57, 59, 61. The upgraded version below moves each call inside an if block.
-
Note
Uses transp =, which v5 removed line 28
transp = on line 28, 51, 54. v5 folds the transparency into the colour with color.new(c, transp).
-
Note
Uses long =, which v5 renamed line 38
long = on line 38, 39. v5 writes it as direction = strategy.long or strategy.short.
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 rsi → ta.rsi, ema → ta.ema, security → request.security, crossunder → ta.crossunder, crossover → ta.crossover, abs → math.abs, tostring → str.tostring.
- 5 strategy calls use the when = argument (line 38, 39, 57, 59, 61). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
v4 → v5
Not verifiedNeither version placed a trade on any of the 8 markets, so there was nothing to compare.
- Line 3: //@version=4 → //@version=5
- Line 13: vwap → ta.vwap
- Line 14: rsi → ta.rsi
- Line 14: vwap → ta.vwap
- Line 15: ema → ta.ema
- Line 17: rsi → ta.rsi
25 more edits
- Line 17: security → request.security
- Line 17: vwap → ta.vwap
- Line 18: ema → ta.ema
- Line 19: security → request.security
- Line 20: rsi → ta.rsi
- Line 28: transp = 90 → color.new(#9915FF, 90)
- Line 38: long = false → direction = strategy.short
- Line 38: crossunder → ta.crossunder
- Line 38: crossunder → ta.crossunder
- Line 39: long = false → direction = strategy.short
- Line 39: crossover → ta.crossover
- Line 39: crossunder → ta.crossunder
- Line 39: crossunder → ta.crossunder
- Line 48: abs → math.abs
- Line 51: abs → math.abs
- Line 51: transp = 80 → color.new(abs(strategy.position_size)>=1?color.blue:na, 80)
- Line 52: abs → math.abs
- Line 54: crossunder → ta.crossunder
- Line 54: transp = 50 → color.new(crossunder(vwapRsi,osLevel) and myVwap < ema200 ? color.yellow:na, 50)
- Line 55: crossunder → ta.crossunder
- Line 57: tostring → str.tostring
- Line 57: crossover → ta.crossover
- Line 59: tostring → str.tostring
- Line 59: crossover → ta.crossover
- Line 61: tostring → str.tostring
⋯// © mohanee-//@version=4+//@version=5strategy(title="RSI of VWAP [SHORT selling]", overlay=false, pyramiding=1, default_qty_type=strategy.percent_of_equity, default_qty_value=20, initial_capital=10000, currency=currency.USD) //default_qty_value=10, default_qty_type=strategy.fixed,⋯checkVIXRSI=input(true,title="Check VIX RSI , ===when this setting is selected , strategy doenst look for whether price is under ema200 or not ! It only checks RSI reading of VIX=== ")-myVwap=vwap+myVwap=ta.vwap-vwapRsi=rsi(vwap,rsiLength)+vwapRsi=ta.rsi(ta.vwap,rsiLength)-ema200=ema(close,200)+ema200=ta.ema(close,200)//signalLine=ema(vwapRsi,9)-vwapWeeklyRSI=rsi(security(syminfo.tickerid, "W", vwap), rsiLength)+vwapWeeklyRSI=ta.rsi(request.security(syminfo.tickerid, "W", ta.vwap), rsiLength)-signalLine=ema(vwapRsi,50)+signalLine=ta.ema(vwapRsi,50)-vixVal = security("CBOE:VIX",timeframe.period,hlc3)+vixVal = request.security("CBOE:VIX",timeframe.period,hlc3)-vixRsi=rsi(vixVal,14)+vixRsi=ta.rsi(vixVal,14)plot(vwapRsi, title="RSI of VWAP", linewidth=2, color=color.purple)⋯osLevelPlot = hline(osLevel, title="Oversold", linestyle=hline.style_dotted)-fill(obLevelPlot, osLevelPlot, title="Background", color=#9915FF, transp=90)+fill(obLevelPlot, osLevelPlot, title="Background", color=color.new(#9915FF, 90))//plot(ema200, title="EMA 200", color=color.orange, transp=25)⋯//more than 80%-strategy.entry(id="SE", comment="Short Entry", long=false, qty=qty1, when= myVwap < ema200 and checkVIXRSI==false and ( crossunder(vwapRsi,osLevel) or crossunder(vwapWeeklyRSI,obLevel) ) ) //original when publshed+strategy.entry(id="SE", comment="Short Entry", direction = strategy.short, qty=qty1, when= myVwap < ema200 and checkVIXRSI==false and ( ta.crossunder(vwapRsi,osLevel) or ta.crossunder(vwapWeeklyRSI,obLevel) ) ) //original when publshed-strategy.entry(id="SE", comment="Short Entry", long=false, qty=qty1, when= checkVIXRSI==true and crossover(vixRsi,60) and ( crossunder(vwapRsi,osLevel) or crossunder(vwapWeeklyRSI,obLevel) )) //check VIX RSI reading+strategy.entry(id="SE", comment="Short Entry", direction = strategy.short, qty=qty1, when= checkVIXRSI==true and ta.crossover(vixRsi,60) and ( ta.crossunder(vwapRsi,osLevel) or ta.crossunder(vwapWeeklyRSI,obLevel) )) //check VIX RSI reading//19.25 Net Profit 77.08 2.59 factor drawdon 3.7 only⋯//stoploss-stopLossVal= abs(strategy.position_size)>=1 ? (strategy.position_avg_price * (1+(stopLoss*0.01) )) : (strategy.position_avg_price * 2)+stopLossVal= math.abs(strategy.position_size)>=1 ? (strategy.position_avg_price * (1+(stopLoss*0.01) )) : (strategy.position_avg_price * 2)//draw initil stop loss//plot(abs(strategy.position_size)>=1 ? stopLossVal : na, color = color.purple , style=plot.style_linebr, linewidth = 2, title = "stop loss")-bgcolor(abs(strategy.position_size)>=1?color.blue:na, transp=80)+bgcolor(color.new(math.abs(strategy.position_size)>=1?color.blue:na, 80))-barcolor(abs(strategy.position_size)>=1?color.blue: na)+barcolor(math.abs(strategy.position_size)>=1?color.blue: na)//possible re entries-bgcolor(crossunder(vwapRsi,osLevel) and myVwap < ema200 ? color.yellow:na, transp=50)+bgcolor(color.new(ta.crossunder(vwapRsi,osLevel) and myVwap < ema200 ? color.yellow:na, 50))-barcolor(crossunder(vwapRsi,osLevel) and myVwap < ema200 ? color.yellow:na )+barcolor(ta.crossunder(vwapRsi,osLevel) and myVwap < ema200 ? color.yellow:na )if(partialExit==true)- strategy.close(id="SE",comment="Exit Partial (points="+tostring(close - strategy.position_avg_price, "####.##")+")",qty=strategy.position_size/3, when=close < strategy.position_avg_price and crossover(vwapRsi,osLevel) ) //and close>ema200+ strategy.close(id="SE",comment="Exit Partial (points="+str.tostring(close - strategy.position_avg_price, "####.##")+")",qty=strategy.position_size/3, when=close < strategy.position_avg_price and ta.crossover(vwapRsi,osLevel) ) //and close>ema200 -strategy.close_all(comment="Exit All (points="+tostring( strategy.position_avg_price - close , "####.##")+")", when=crossover(vwapRsi,obLevel) ) //and close>ema200+strategy.close_all(comment="Exit All (points="+str.tostring( strategy.position_avg_price - close , "####.##")+")", when=ta.crossover(vwapRsi,obLevel) ) //and close>ema200//close all on stop loss-strategy.close_all(comment="SL Exit (points="+tostring(strategy.position_avg_price - close, "####.##")+")", when=close > stopLossVal ) //and close>ema200+strategy.close_all(comment="SL Exit (points="+str.tostring(strategy.position_avg_price - close, "####.##")+")", when=close > stopLossVal ) //and close>ema200Clean v5
Not verifiedNeither version placed a trade on any of the 8 markets, so there was nothing to compare.
- Line 5: input() → input.int()
- Line 6: input() → input.int()
- Line 7: input() → input.int()
- Line 8: input() → input.int()
- Line 9: input() → input.int()
- Line 10: input() → input.bool()
7 more edits
- Line 11: input() → input.bool()
- Line 12: input() → input.bool()
- Line 38: when = myVwap < ema200 and checkVIXRSI==false and ( ta.crossunder(vwapRsi,osLevel) or ta.crossunder(vwapWeeklyRSI,obLevel) ) → if block
- Line 39: when = checkVIXRSI==true and ta.crossover(vixRsi,60) and ( ta.crossunder(vwapRsi,osLevel) or ta.crossunder(vwapWeeklyRSI,obLevel) ) → if block
- Line 57: when = close < strategy.position_avg_price and ta.crossover(vwapRsi,osLevel) → if block
- Line 59: when = ta.crossover(vwapRsi,obLevel) → if block
- Line 61: when = close > stopLossVal → if block
⋯strategy(title="RSI of VWAP [SHORT selling]", overlay=false, pyramiding=1, default_qty_type=strategy.percent_of_equity, default_qty_value=20, initial_capital=10000, currency=currency.USD) //default_qty_value=10, default_qty_type=strategy.fixed,-rsiLength=input(11,title="RSI Length", minval=1, maxval=50)+rsiLength=input.int(11,title="RSI Length", minval=1, maxval=50)-osLevel=input(25,title="RSI Oversold (SHORT sell Line)", minval=1, maxval=100)+osLevel=input.int(25,title="RSI Oversold (SHORT sell Line)", minval=1, maxval=100)-obLevel=input(70,title="RSI Overbought (SHORT Exit/cover Line)", minval=1, maxval=100)+obLevel=input.int(70,title="RSI Overbought (SHORT Exit/cover Line)", minval=1, maxval=100)-riskCapital = input(title="Risk % of capital", defval=10, minval=1)+riskCapital = input.int(title="Risk % of capital", defval=10, minval=1)-stopLoss=input(5,title="Stop Loss",minval=1)+stopLoss=input.int(5,title="Stop Loss",minval=1)-partialExit=input(true,title="Allow Partial exit / take profits")+partialExit=input.bool(true,title="Allow Partial exit / take profits")-showWeeklyVwapRSI=input(true,title="Show Weekly VWAP RSI")+showWeeklyVwapRSI=input.bool(true,title="Show Weekly VWAP RSI")-checkVIXRSI=input(true,title="Check VIX RSI , ===when this setting is selected , strategy doenst look for whether price is under ema200 or not ! It only checks RSI reading of VIX=== ")+checkVIXRSI=input.bool(true,title="Check VIX RSI , ===when this setting is selected , strategy doenst look for whether price is under ema200 or not ! It only checks RSI reading of VIX=== ")myVwap=ta.vwap⋯//more than 80%-strategy.entry(id="SE", comment="Short Entry", direction = strategy.short, qty=qty1, when= myVwap < ema200 and checkVIXRSI==false and ( ta.crossunder(vwapRsi,osLevel) or ta.crossunder(vwapWeeklyRSI,obLevel) ) ) //original when publshed+if myVwap < ema200 and checkVIXRSI==false and ( ta.crossunder(vwapRsi,osLevel) or ta.crossunder(vwapWeeklyRSI,obLevel) )+ strategy.entry(id="SE", comment="Short Entry", direction = strategy.short, qty=qty1 ) //original when publshed-strategy.entry(id="SE", comment="Short Entry", direction = strategy.short, qty=qty1, when= checkVIXRSI==true and ta.crossover(vixRsi,60) and ( ta.crossunder(vwapRsi,osLevel) or ta.crossunder(vwapWeeklyRSI,obLevel) )) //check VIX RSI reading+if checkVIXRSI==true and ta.crossover(vixRsi,60) and ( ta.crossunder(vwapRsi,osLevel) or ta.crossunder(vwapWeeklyRSI,obLevel) )+ strategy.entry(id="SE", comment="Short Entry", direction = strategy.short, qty=qty1) //check VIX RSI reading//19.25 Net Profit 77.08 2.59 factor drawdon 3.7 only⋯if(partialExit==true)- strategy.close(id="SE",comment="Exit Partial (points="+str.tostring(close - strategy.position_avg_price, "####.##")+")",qty=strategy.position_size/3, when=close < strategy.position_avg_price and ta.crossover(vwapRsi,osLevel) ) //and close>ema200+ if close < strategy.position_avg_price and ta.crossover(vwapRsi,osLevel)+ strategy.close(id="SE",comment="Exit Partial (points="+str.tostring(close - strategy.position_avg_price, "####.##")+")",qty=strategy.position_size/3 ) //and close>ema200 -strategy.close_all(comment="Exit All (points="+str.tostring( strategy.position_avg_price - close , "####.##")+")", when=ta.crossover(vwapRsi,obLevel) ) //and close>ema200+if ta.crossover(vwapRsi,obLevel)+ strategy.close_all(comment="Exit All (points="+str.tostring( strategy.position_avg_price - close , "####.##")+")" ) //and close>ema200//close all on stop loss-strategy.close_all(comment="SL Exit (points="+str.tostring(strategy.position_avg_price - close, "####.##")+")", when=close > stopLossVal ) //and close>ema200+if close > stopLossVal+ strategy.close_all(comment="SL Exit (points="+str.tostring(strategy.position_avg_price - close, "####.##")+")" ) //and close>ema200Does it run in Pine Script v6?
Not tested
Neither version placed a trade on any of the 8 markets, so there was nothing to compare. The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.
⋯// © mohanee-//@version=5+//@version=6strategy(title="RSI of VWAP [SHORT selling]", overlay=false, pyramiding=1, default_qty_type=strategy.percent_of_equity, default_qty_value=20, initial_capital=10000, currency=currency.USD) //default_qty_value=10, default_qty_type=strategy.fixed,⋯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 |
|---|---|---|---|
| RSI Length | 11 | int · min 1 · max 50 | vwapRsi vwapWeeklyRSI |
| RSI Oversold (SHORT sell Line) | 25 | int · min 1 · max 100 | Oversold entry SE bgcolor barcolor close SE |
| RSI Overbought (SHORT Exit/cover Line) | 70 | int · min 1 · max 100 | Overbought entry SE close_all |
| Risk % of capital | 10 | int · min 1 | qty1 |
| Stop Loss | 5 | int · min 1 | qty1 stopLossVal |
| Allow Partial exit / take profits | true | bool | close SE line 56 |
| Show Weekly VWAP RSI | true | bool | unused |
| Check VIX RSI , ===when this setting is selected , strategy doenst look for whether price is under ema200 or not ! It only checks RSI reading of VIX=== | true | bool | RSI of VWAP weekly VIX RSI entry SE |
What it calculates
- RSI (
rsi,ta.rsiin v5)vwap, RSI Length (11)vwapRsi · line 14 - EMA (
ema,ta.emain v5)close, 200ema200 · line 15 - RSI (
rsi,ta.rsiin v5)security(syminfo.tickerid, "W", vwap), RSI Length (11)vwapWeeklyRSI · line 17 - EMA (
ema,ta.emain v5)vwapRsi, 50signalLine · line 18 - RSI (
rsi,ta.rsiin v5)vixVal, 14vixRsi · line 20
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.
Order rules
| Order | Fires when | By default | Line |
|---|---|---|---|
| Open SE short | myVwap < ema200 and checkVIXRSI==false and ( crossunder(vwapRsi,osLevel) or crossunder(vwapWeeklyRSI,obLevel) ) | On | 38 |
| Open SE short | checkVIXRSI==true and crossover(vixRsi,60) and ( crossunder(vwapRsi,osLevel) or crossunder(vwapWeeklyRSI,obLevel) ) | On | 39 |
| Close SE | close < strategy.position_avg_price and crossover(vwapRsi,osLevel) | On | 57 |
| Close | crossover(vwapRsi,obLevel) | On | 59 |
| Close | close > stopLossVal | On | 61 |
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.
- ClearHigher-timeframe data2 security call(s), none with lookahead on.
- 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
Not run on other markets: the script requests CBOE:VIX D, and that data is not available here (not a Binance spot market). Its results would rest on empty values.
Similar scripts
Indicators and strategies built from the same calculations, run on BTCUSDT 1D with their own defaults so they can be compared directly.
| Script | Shares | Type | Net | Trades | Max drawdown |
|---|---|---|---|---|---|
| RSI of VWAP [SHORT selling] this page | — | v4 strategy | 0.0% | 0 | 0.0% |
| RSI Cross [xaurr] by livetrend | rsi ema | v4 strategy | +24.4% | 53 | 35.3% |
| Bitpanda Coinrule Template by joshuajcoop01 | rsi ema | v5 strategy | −2.8% | 4 | 4.6% |
| RSI with Slow and Fast MA Crossing Strategy (by Coinrule) by Coinrule | rsi ema | v5 strategy | −2.8% | 4 | 4.6% |
| RSI of VWAP by mohanee | rsi ema | v4 strategy | No trades on this market | ||
| EMA SCALPEUR + RSi - SHORT by YukalMoon | rsi ema | v5 strategy | No trades on this market | ||
Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 18 ms | With a workaround 1,000 bars in 62 ms | Not measured |
| PineTS | No v5 and v6 only | — | Not measured |
Zeal Terminal's engine currently reads an order side written as long = false as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (lines 38, 39) so the engine trades the way the script says. The engine's host API cannot yet declare a chart's symbol and timeframe, so this page sets them on the engine directly for each market.
“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/// © mohanee//@version=4strategy(title="RSI of VWAP [SHORT selling]", overlay=false, pyramiding=1, default_qty_type=strategy.percent_of_equity, default_qty_value=20, initial_capital=10000, currency=currency.USD) //default_qty_value=10, default_qty_type=strategy.fixed,rsiLength=input(11,title="RSI Length", minval=1, maxval=50)osLevel=input(25,title="RSI Oversold (SHORT sell Line)", minval=1, maxval=100)obLevel=input(70,title="RSI Overbought (SHORT Exit/cover Line)", minval=1, maxval=100)riskCapital = input(title="Risk % of capital", defval=10, minval=1)stopLoss=input(5,title="Stop Loss",minval=1)partialExit=input(true,title="Allow Partial exit / take profits")showWeeklyVwapRSI=input(true,title="Show Weekly VWAP RSI")checkVIXRSI=input(true,title="Check VIX RSI , ===when this setting is selected , strategy doenst look for whether price is under ema200 or not ! It only checks RSI reading of VIX=== ")myVwap=vwapvwapRsi=rsi(vwap,rsiLength)ema200=ema(close,200)//signalLine=ema(vwapRsi,9)vwapWeeklyRSI=rsi(security(syminfo.tickerid, "W", vwap), rsiLength)signalLine=ema(vwapRsi,50)vixVal = security("CBOE:VIX",timeframe.period,hlc3)vixRsi=rsi(vixVal,14)plot(vwapRsi, title="RSI of VWAP", linewidth=2, color=color.purple)plot( checkVIXRSI == true ? vwapWeeklyRSI : na, title="RSI of VWAP weekly", linewidth=2, color=color.blue)//plot(signalLine, title="signal line", linewidth=2, color=color.red)plot(checkVIXRSI == true ? vixRsi : na, title="VIX RSI", linewidth=2, color=color.red)hline(50, title="Middle Line", linestyle=hline.style_dotted)obLevelPlot = hline(obLevel, title="Overbought", linestyle=hline.style_dotted)osLevelPlot = hline(osLevel, title="Oversold", linestyle=hline.style_dotted)fill(obLevelPlot, osLevelPlot, title="Background", color=#9915FF, transp=90)//plot(ema200, title="EMA 200", color=color.orange, transp=25)//plot(myVwap, title="VWAP", color=color.purple, transp=25)//plot(close)//Entry--//Echeck how many units can be purchased based on risk manage ment and stop lossqty1 = (strategy.equity * riskCapital / 100 ) / (close*stopLoss/100) //check if cash is sufficient to buy qty1 , if capital not available use the available capital onlyqty1:= (qty1 * close >= strategy.equity ) ? (strategy.equity / close) : qty1//more than 80%strategy.entry(id="SE", comment="Short Entry", long=false, qty=qty1, when= myVwap < ema200 and checkVIXRSI==false and ( crossunder(vwapRsi,osLevel) or crossunder(vwapWeeklyRSI,obLevel) ) ) //original when publshedstrategy.entry(id="SE", comment="Short Entry", long=false, qty=qty1, when= checkVIXRSI==true and crossover(vixRsi,60) and ( crossunder(vwapRsi,osLevel) or crossunder(vwapWeeklyRSI,obLevel) )) //check VIX RSI reading//19.25 Net Profit 77.08 2.59 factor drawdon 3.7 only//11 , 25 setting 40.75% net profit 56 trades and 87.5% winrate 6.2 profit factor drawdown 3.17 and 47 bars//strategy.entry(id="SE", comment="Short Entry", long=false, qty=qty1, when= checkVix==false and ( crossover(vixRsi,60) or crossover(vixRsi,70) ) and ( crossunder(vwapRsi,osLevel) or crossunder(vwapWeeklyRSI,obLevel) )) // 78.13 2.6 factor drawdon 5.81y// 11 , 25 setting 30.5 net profit 65 trades and 80% winrate 2.77 profit factor drawdown 4.79 46 bars//strategy.entry(id="SE", comment="Short Entry", long=false, qty=qty1, when= checkVIXRSI==true and vixRsi>60 and ( crossunder(vwapRsi,osLevel) or crossunder(vwapWeeklyRSI,obLevel) )) // 77.08 2.59 factor drawdon 3.7 only//strategy.entry(id="SE", comment="Short Entry", long=false, qty=qty1, when= vixRsi > 70 and vwapRsi < vixRsi and vwapRsi<30)//stoplossstopLossVal= abs(strategy.position_size)>=1 ? (strategy.position_avg_price * (1+(stopLoss*0.01) )) : (strategy.position_avg_price * 2)//draw initil stop loss//plot(abs(strategy.position_size)>=1 ? stopLossVal : na, color = color.purple , style=plot.style_linebr, linewidth = 2, title = "stop loss")bgcolor(abs(strategy.position_size)>=1?color.blue:na, transp=80)barcolor(abs(strategy.position_size)>=1?color.blue: na)//possible re entriesbgcolor(crossunder(vwapRsi,osLevel) and myVwap < ema200 ? color.yellow:na, transp=50)barcolor(crossunder(vwapRsi,osLevel) and myVwap < ema200 ? color.yellow:na )if(partialExit==true) strategy.close(id="SE",comment="Exit Partial (points="+tostring(close - strategy.position_avg_price, "####.##")+")",qty=strategy.position_size/3, when=close < strategy.position_avg_price and crossover(vwapRsi,osLevel) ) //and close>ema200 strategy.close_all(comment="Exit All (points="+tostring( strategy.position_avg_price - close , "####.##")+")", when=crossover(vwapRsi,obLevel) ) //and close>ema200//close all on stop lossstrategy.close_all(comment="SL Exit (points="+tostring(strategy.position_avg_price - close, "####.##")+")", when=close > stopLossVal ) //and close>ema200