Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
- // © Maurizio-Ciullo
- // https://www.youtube.com/watch?v=EeGEdVehWT0&t=193s
- //@version=5
- strategy("Indicatore Ottenere Lista Profitti E Perdite Dei Trades Chiusi", overlay=true, margin_long=100, margin_short=100)
- longCondition = ta.crossover(ta.sma(close, 14), ta.sma(close, 28))
- if (longCondition)
- strategy.entry("My Long Entry Id", strategy.long)
- shortCondition = ta.crossunder(ta.sma(close, 14), ta.sma(close, 28))
- if (shortCondition)
- strategy.entry("My Short Entry Id", strategy.short)
- float lastTradeProfit = na
- if strategy.position_size != strategy.position_size[1]
- lastTradeProfit := strategy.netprofit - strategy.netprofit[1]
- plot(lastTradeProfit, style = plot.style_columns, color = lastTradeProfit > 0 ? color.green : lastTradeProfit == 0 ? color.gray : color.red, title = "Trade profit/loss")
- if strategy.closedtrades != 0 and strategy.closedtrades != strategy.closedtrades[1]
- log.info(str.tostring(lastTradeProfit), "lastTradeProfit")
Advertisement
Comments
-
- 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