0

Could anyone help to enhance the following pine scrips? Much appreciated and thanks for your answers!

//@version=5
indicator("Daily loss limit")
var testTable = table.new(position = position.top_right, columns = 2, rows = 1, bgcolor = color.yellow, border_width = 1)
if barstate.islast
    table.cell(table_id = testTable, column = 0, row = 0, text = "Daily loss limit: **$79.94** / 100" + " | " + str.tostring(dayofmonth) + " " + str.tostring(month) + " " + str.tostring(year))

The current function shows the daily limint on the chart. However, I need to manually input the daily loss amount $xx.xx in order to show the numbers on the indicator. Could anyone assist to automate this calculation?

My concept is to put a indicator on the chart which shows the real time data of the daily profit and loss. If in profit, the indicator shows 0. If in loss, the indicator starts to count. And once it reached 100, a notification will pop up as a reminder.

Thanks again for your help!

example

I have tried to use the most related script:

strategy.netprofit

but an error pops up saying that is a strategy code which cannot be used in building an indicator ._. Expecting a Pinescript master to solve the problem.

0 Answers0