I thought of having a table showing running profit or loss on chart from a specific price. I tried to put the same in code and ended up with this code. This is a table showing the running profit or loss from a manually specified price and quantity.
when you add the code, This table asks us to input the entry price and quantity. It will calculate the running profit or loss with respect to running price and puts that in the table.
We will have to input two things.
1.) entry price: the price at which a position(long/short) is taken. 2.) Quantity: A +value need to be entered for Long position and -value for short position.
code detects whether its a long position or short position based on the quantity info.
for example if a LONG position is taken at a price 60 of 100 quantity, then in price we need to enter 60 and in quantity 100 (+ve value)
for SHORT position at a price of 60 of 100 quantity, in price we need to enter 60 and in quantity -100 (-ve value)
once the table is added to the chart. Just double click on the table, it will open the settings tab and we can provide new inputs price/quantity/position. positioning of table is optional and all possible positioning options are provided.
Advise further improvements required if any in this code.
This piece of code can be used along with any indicator. For which we may need to use valuewhen() additionally. Try it yourself and ping me if required.
진정한 TradingView 정신에 따라, 이 스크립트의 저자는 트레이더들이 이해하고 검증할 수 있도록 오픈 소스로 공개했습니다. 저자에게 박수를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰에 의해 관리됩니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.