pine-scriptpine-script-v5

Exiting position based on open profit percentage in Pine Script


I'm trying to code a take profit based on the currently open profit as percentage. The documentation for strategy.openprofit does not yield much information. It only says that the number is a float. Is this open profit the profit in the so called "base" currency? Is there a function I'm missing that would give the open profit in percent directly?


Solution

  • This library contains exitPercent function. I suppose this is what you are looking for.