Short VXX - OptionsRockstar

602 0 64
Backtesting Script
Remove from Favorite Scripts Add to Favorite Scripts
strategy("Short VXX", overlay=true)
fastLength = input(5, title="Fast SMA Length")
slowLength = input(15, title="Slow SMA Length")
atrLength = input(14, title="ATR Length")
percentRisk = input(1, title="Percent Risk")
startYear = input(2014, title="Start Year")
price = close

mafast = sma(price, fastLength)
maslow = sma(price, slowLength)
atr = atr(atrLength)
risk = (percentRisk/100)
contracts = (strategy.equity*risk)/(atr/4)

plot(mafast, color=white)
plot(maslow, color=blue)

if(cross(mafast, maslow) and (mafast<maslow) and (year>=startYear))
    strategy.entry("VXX Short", strategy.short, qty=(contracts), comment="VXX Short")
strategy.exit("VXX Short", profit = atr*50, loss = atr*25, comment="VXX Exit")

EN English
EN English (UK)
EN English (IN)
DE Deutsch
FR Français
ES Español
IT Italiano
PL Polski
TR Türkçe
RU Русский
PT Português
ID Bahasa Indonesia
MS Bahasa Melayu
TH ภาษาไทย
VI Tiếng Việt
JA 日本語
KO 한국어
ZH 简体中文
ZH 繁體中文
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing My Support Tickets Contact Support Ideas Published Followers Following Private Messages Chat Sign Out