Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- strategy.entry("buy", strategy.long, comment="buy", when=can_buy)
- strategy.entry("sell", strategy.short, comment="sell", when=can_sell)
- if (can_buy)
- stop_level_long = strategy.position_avg_price - strategy.position_avg_price*(stop_perc/100)
- strategy.exit("Stop Loss/TP", "buy",stop=stop_level_long, comment="LONG STOP HIT")
- if (can_sell)
- stop_level_short = strategy.position_avg_price + strategy.position_avg_price*(stop_short_perc/100)
- strategy.exit("Stop Loss/TP", "sell",stop=stop_level_short, comment="SHORT STOP HIT")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement