Advertisement
Maurizio-Ciullo

Indicatore Ottenere Lista Profitti E Perdite Dei Trades Chiusi

Oct 6th, 2023 (edited)
1,176
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
  2. // © Maurizio-Ciullo
  3.  
  4. // https://www.youtube.com/watch?v=EeGEdVehWT0&t=193s
  5.  
  6. //@version=5
  7. strategy("Indicatore Ottenere Lista Profitti E Perdite Dei Trades Chiusi", overlay=true, margin_long=100, margin_short=100)
  8.  
  9.  
  10.  
  11. longCondition = ta.crossover(ta.sma(close, 14), ta.sma(close, 28))
  12. if (longCondition)
  13.     strategy.entry("My Long Entry Id", strategy.long)
  14.  
  15. shortCondition = ta.crossunder(ta.sma(close, 14), ta.sma(close, 28))
  16. if (shortCondition)
  17.     strategy.entry("My Short Entry Id", strategy.short)
  18.  
  19.  
  20. float lastTradeProfit = na
  21. if strategy.position_size != strategy.position_size[1]
  22.     lastTradeProfit := strategy.netprofit - strategy.netprofit[1]
  23. plot(lastTradeProfit, style = plot.style_columns, color = lastTradeProfit > 0 ? color.green : lastTradeProfit == 0 ? color.gray : color.red, title = "Trade profit/loss")
  24.  
  25.  
  26. if strategy.closedtrades != 0 and strategy.closedtrades != strategy.closedtrades[1]
  27.     log.info(str.tostring(lastTradeProfit), "lastTradeProfit")
Advertisement
Comments
  • hemal9022
    260 days
    # text 0.12 KB | 0 0
    1. i founded all types of premium tradingview indicators codes available on telegram - https://t.me/tradingview_premium_indicator
Add Comment
Please, Sign In to add comment
Advertisement