TradingView
backslash-f
20 ตุลา 2021 เวลา 22 นาฬิกา 25 นาที

Profit Percentage Tracker 

Bitcoin / TetherUSBinance

คำอธิบาย

This script provides a quick and easy way to visualize profits in a chart, based on the given entry date and price.
Optionally, alerts can be sent when profits cross up the given "profit unit".

In short:
  • Tracks how much profit one could take based on the input "entry date" and the input "entry price"
  • These inputs are interactive (tradingview.com/blog/en/pine-scripts-are-now-interactive-27147)
  • Displays the result in a label on top of the last candle
  • (Optional) Sends alerts based on the given "profit unit", that is: if '0.5' is given, then an alert is triggered every time the profit is raised by that number
    (Be careful with low values, as TradingView could stop an alert if it triggers too much.)


For alerts to be displayed, a "script alert" must be created right after the script was added to the chart:
- tradingview.com/support/solutions/43000597494-script-alerts/
(Choose 'Profits' as condition and 'Any alert() function call')

Good to know: if you check "Notify on app", alerts can be delivered directly to your phone:
i.imgur.com/CH71E9C.jpg

Prerequirements:
The chart's timezone has to be set to "Exchange" (this is required in order to support the alert's logic):
- kodify.net/tradingview/platform/exchange-time-zone

เอกสารเผยแพร่

Refactoring and the introduction of two input variables:
  • alertPrefix: Add a custom prefix to the first line of the alert to indicate whatever you like. E.g.: "[FUTURES]". (A trailing white space will be added automatically.)
  • shoudDebugInfo: Check this box to see the values of the main variables on the chart, below bars. This is for debugging purposes only.


Also notice that the input variable "shouldSendAlerts" was removed; alerts are sent if there is a TradingView alert created / configured beforehand... and the opposite is also true. So the variable wasn't really necessary.

เอกสารเผยแพร่

Fixes a typo.

เอกสารเผยแพร่

Adds a "targetSymbol". That's the symbol for which the indicator is being configured.

This allows for switching to other symbols in the same tab without showing wrong profit data.

If you would like to add multiple profit indicators for different symbols, just insert another profit indicator that targets the new symbol.

Notice: the entry must match the chart's symbol exactly. That is, for example: "BTCUSDT" (instead of just "BTC").

เอกสารเผยแพร่

In this update, the following new features were added:

  • Both long and short positions are now supported
  • Helper lines can be now displayed / hidden, such as:
  • Target percentage lines
  • Entry, target, stop and liquidation lines
  • For developers:
  • The script can format the body of the alert as JSON, so one could send it to a server and automate the trading


Happy trading!

เอกสารเผยแพร่

(Just updated the chart image.)

เอกสารเผยแพร่

  • Show negative percentage on the STOP and LIQ line labels.

เอกสารเผยแพร่

  • Fix an issue where labels/lines would be added on top of each other under certain conditions.

เอกสารเผยแพร่

  • The target percentage lines now also show the value in parenthesis. E.g. "1.5% (41716.5)"
  • Add the position "size" to the webhook payload (good for some exchanges like FTX)
  • Remove some pesky leading spaces
  • Add some code documentation
  • Refactor / reorganization

เอกสารเผยแพร่

  • Fix the price format on the added lines.

เอกสารเผยแพร่

  • Initialize the metadata array before the actual script; this fixes an issue where the profit label would not show.

เอกสารเผยแพร่

  • Update the chart image

เอกสารเผยแพร่

  • Add Kucoin's Alice to the metadata list.

เอกสารเผยแพร่

  • "Currency profit" (e.g. "275.29 USDT") can now be displayed just below the profit percentage label
  • "Currency profit" is enabled by default. In order for it to be properly calculated, remember to fill in the "size" field
  • The metadata for "FTMUSDT" (Kucoin) was added

เอกสารเผยแพร่

  • Fix entry / current price label formatting
  • Add code documentation

เอกสารเผยแพร่

  • Add FTX's BTC, ETC and LUNA metadata (perp)

เอกสารเผยแพร่

  • Fix an error where the alert would be stopped by TradingView in a very specific scenario where metadata would not be available for the current exchange.

เอกสารเผยแพร่

  • Add metadata information into the debug label; in case a metadata value is empty, a ⚠️ will be displayed for that value.

เอกสารเผยแพร่

  • Add "offset" and "stop limit" information to the debugging label.

เอกสารเผยแพร่

  • Displays the current and metadata exchange information in the debugging label.
  • Displays a warning in case the exchanges don't match.

เอกสารเผยแพร่

Only payload changes:
  • The payload now includes raw numbers instead of formatted ones (#.##)
  • DYDX metadata was added (Kucoin)
  • Fix typo in the debug label

เอกสารเผยแพร่

  • Add APE metadata (Kucoin).

เอกสารเผยแพร่

  • Add two more decimals for the prices displayed on the labels (#.## becomes #.####).
  • Add WAVES metadata (Kucoin).
  • Add IOST metadata (Kucoin).

เอกสารเผยแพร่

  • Add the "next stop-limit" line (hidden by default); it shows where the next stop-limit would be, based on the "offset" field
  • Add ATOM metadata (Kucoin)
  • Add ZIL metadata (Kucoin)

เอกสารเผยแพร่

  • Refactor around the debugging label for better clarity
  • Add LUNA metadata (Kucoin)
  • Add RUNE metadata (Kucoin)
  • Add SAND metadata (Kucoin)

เอกสารเผยแพร่

  • Fix a visibility issue of the "next stop limit" line

เอกสารเผยแพร่

  • In addition to the next stop-limit line, the script can now also display the current stop-limit line

เอกสารเผยแพร่

  • Add LINK metadata (Kucoin)

เอกสารเผยแพร่

  • Add SHIBA metadata (Kucoin)
  • Updated some decimal labels to display very low numbers (like SHIBA ones) correctly (i.e. "#.####" to "#.########")

เอกสารเผยแพร่

  • Add FIDA metadata (FTX)
  • Add XRP metadata (Kucoin)

เอกสารเผยแพร่

  • Add NEAR metadata (Kucoin).

เอกสารเผยแพร่

  • Add NEAR metadata (FTX)
  • Add AAVE metadata (Kucoin)

เอกสารเผยแพร่

  • Add ZRX metadata (FTX)

เอกสารเผยแพร่

  • Add APE metadata (FTX)
  • Add WAVES metadata (FTX)

เอกสารเผยแพร่

  • Add GMT metadata (Kucoin)
  • Add TRX metadata (Kucoin)

เอกสารเผยแพร่

  • Add the profitPercentageTrigger that fine tunes server-side execution.

เอกสารเผยแพร่

  • Add the profit percentage trigger line
  • Enhancements around next stop-limit lines
  • Refactoring

เอกสารเผยแพร่

  • Fix issue of the percentage trigger line being plotted multiple times

เอกสารเผยแพร่

  • [Trading Automation] Adds support for adding Kucoin API's key, secret and passphrase into the JSON payload

เอกสารเผยแพร่

  • Fix formatting issues

เอกสารเผยแพร่

  • Add current stop limit string into the debug view

เอกสารเผยแพร่

  • Add the profit percentage trigger into the alert logic

เอกสารเผยแพร่

  • Add trigger alert String in the debug view

เอกสารเผยแพร่

  • Enhancements & clean up

เอกสารเผยแพร่

  • Fix alert logic

เอกสารเผยแพร่

  • Add flag to indicate Kucoin spot orders

เอกสารเผยแพร่

  • Add LUNC metadata (Kucoin)
  • Fix number formatting

เอกสารเผยแพร่

  • Add a custom percentage line to quickly check the entry price value based on the inserted percentage.
  • Reformatted the JSON with most relevant information at the top (good for the Apple Watch heehee)
  • Fix lines percentage formatting

เอกสารเผยแพร่

  • JSON formatting

เอกสารเผยแพร่

  • Add LUNC metadata (FTX)
  • Add current price into JSON payload

เอกสารเผยแพร่

  • Lines refactoring, documentation
  • Remove FTX related info
  • Add Kucoin's futures LTC

เอกสารเผยแพร่

  • Add Binance's LUNCUSDT pair

เอกสารเผยแพร่

  • Add Kucoin WAVES futures contract
  • Fix profit percentage in server's payload

เอกสารเผยแพร่

  • New Kucoin future contracts: AVAX, GALA

เอกสารเผยแพร่

  • Add FTM (Kucoin Future)
  • Add GMT (Kucoin Future)
  • Refactor around the custom percentage line

เอกสารเผยแพร่

  • Add new Kucoin future contracts: APT, LDO, MANA, OCEAN, ONE and XMR

เอกสารเผยแพร่

  • Add Kucoin SOL Futures contract
  • Remove Kucoin auth fields

เอกสารเผยแพร่


  • Add new Kucoin Futures contracts: ADA, GAS, NEAR, STORJ

เอกสารเผยแพร่


  • Minor input reordering.
ความคิดเห็น
rush9
How to use it?? The added chart is not displayed
Moda-877
does this alert when you are in entry line?
sting22
Mr "backslash-f"!

Keep up your great work!

We all Thank You for it.
InvestCHK
Was excited to find this? Having an issue getting it to function. I changed my timezone to Exchange and I'm definitely entering the correct ticker, but I get no label or lines and the indicator value (next to the indicator name) just shows a zero. Any ideas?
sting22
I just have to say to you "backslash-f" that YOU have done a good jobb and this is what must of use out here need to be able to se. One realy whant to be able to follow once up and down i % and in real money. PERFECT. 5 STARS TO YOU! * * * * *
RK5551
YOU ARE MY ONLY HOPE .
RK5551
Hi Backslash. Can you convert this into AFL or write a short code to just plot few % levels of target & stoploss from 1min price in afl. I have gone crazy in past 3 days looking for something similar :( Feeling sick....
RK5551
Hi

Thank you for this wonderful script.

Can you make it work for any symbol without manually changing it in pine script or the dialog box?

I see that you have chosen one symbol by default and if using any other symbol chart, script does not plot TP% lines or anything

Thanks a lot..!!!

Best Rishi
backslash-f
@RK5551 Hi, you have to type the target symbol. By default, it's BTCUSDT. But you can change it to whatever (in the "Symbol" field). That field is important to keep the data we add unique against a symbol. So we can change symbols on the same chart without messing up the indicator.
backslash-f
Notice: you could make the script work with any type by simply removing "(targetSymbol == currentSymbol) and " after that "if" in line 242. But it may mess thing up (I haven't tried it myself for a while now).
เพิ่มเติม