fork download
  1. //@version=5
  2. strategy("profit loss sample")
  3.  
  4. now_position_price=strategy.position_avg_price
  5.  
  6.  
  7. switch
  8. barstate.isfirst => strategy.entry("long", strategy.long)
  9. strategy.position_size==0 => strategy.entry("long", strategy.long)
  10.  
  11. strategy.exit("exit long", "long", profit=200, loss=200)
  12.  
  13. plot(math.abs(now_position_price-close))
  14. //plot(now_position_price)
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty