Soren test 222 — Strategy by sorentin
By sorentin
Performance Metrics
- Author: sorentin
- Symbol: BINANCE:BTCPERP
- Timeframe: 5 minutes
- Net P&L: −9.21 USD (−9.21%)
- Win Rate: 31.8%
- Profit Factor: 0.838
- Max Drawdown: 12.46 USD (12.14%)
- Total Trades: 519
- Sharpe Ratio: −0.144
Description
Say we use strategy.risk.allow_entry_in() to only trade longs. When our script uses the strategy.entry() function to open a short trade, TradingView of course won’t allow our strategy to go short. But that doesn’t mean the trade is ignored. Instead the ‘enter short’ trade – which is actually a sell command – becomes an ‘exit long’ order.Another way to think about this is the following. The strategy.entry() function can reverse positions: longs into shorts, and shorts into longs. That reverse behaviour gets stopped by strategy.risk.allow_entry_in(). What strategy.entry() instead ends doing is close positions: from long to flat, or from short to flat.(The example strategies that we discuss later in this article show how strategy.risk.allow_entry_in() makes strategy.entry() close instead of open trades.)# Can still trade both long or shortstrategy.risk.allow_entry_in() can also allow our strategy to trade both long or short. That’s a bit silly, since this is already the default behaviour. But to cod