'Strategy.exit: What are "points" in this context? V5
Example from manual:
strategy.exit("exit", "long", profit = 10, loss = 5) // generate full exit bracket (profit 10 points, loss 5 points per contract) from entry with name "long"
Are these points percents? So if this position was worth $100 (when opened) then profit = 10 point is 10% = $10 so we sold the position for $110?
Solution 1:[1]
Those are pips.
A pip is the smallest price move that an exchange rate can make based on forex market convention.
If you want to do a percentage based exit, you should use the limit and stop arguments.
in_long_tp_per = input.float(2.0, "Take profit %") * 0.01
in_long_sl_per = input.float(1.0, "Stop loss %") * 0.01
long_tp_price = strategy.position_avg_price * (1 + in_long_tp_per)
long_sl_price = strategy.position_avg_price * (1 - in_long_sl_per)
if (strategy.position_size > 0)
strategy.exit("exit", "long", limit = long_tp_price, stop = long_sl_price)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | vitruvius |
