Advertisement
Guest User

Untitled

a guest
Dec 17th, 2018
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. strategy.entry("buy", strategy.long, comment="buy", when=can_buy)
  2. strategy.entry("sell", strategy.short, comment="sell", when=can_sell)
  3.  
  4. if (can_buy)
  5. stop_level_long = strategy.position_avg_price - strategy.position_avg_price*(stop_perc/100)
  6. strategy.exit("Stop Loss/TP", "buy",stop=stop_level_long, comment="LONG STOP HIT")
  7.  
  8. if (can_sell)
  9. stop_level_short = strategy.position_avg_price + strategy.position_avg_price*(stop_short_perc/100)
  10. strategy.exit("Stop Loss/TP", "sell",stop=stop_level_short, comment="SHORT STOP HIT")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement