Soren test 222 — Strategy by sorentin

By sorentin

Performance Metrics

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

Browse all 5,900+ TradingView Pine Script strategies

View on TradingView