Follow the Crypto Shorts
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © xtradernet

//@version=4

// This script allows to backtest the impact of variations in the number of BTCUSD Shorts Positions on its price.  

strategy("Follow the Crypto Shorts", shorttitle="FollowBTCShorts", overlay=true)

length = input(50, type=input.integer, title="BTC Shorts SMA Length")

expr = sma(close, length)
BTCShorts = security("BTCUSDSHORTS", "D", close)
BTCShortsMA = security("BTCUSDSHORTS", "D", expr)

if crossunder(BTCShorts, BTCShortsMA)
    strategy.entry("Long", strategy.long, comment="Shorts Out")

strategy.close("Long", when=crossover(BTCShorts, BTCShortsMA), comment="Shorts In")
