So i currently cannot figure out how to add variable savepoints via the input fields. For example i want to enter a trade on a signal i declare (this is working). After this point i have lets say 5 variable save points in percentage values: 1%, 2%, 2,5%... If the value goes above the entry price + the % profit activate savepoint 1 and lets say autosell if the value falls below the savepoint -0,1%
Just an dummy example with a running trade | ETH/USDT:
Investement: 100$
Initial Crypto Price: 1000
Selling Crypto Price: 1020
Investment Fee: 0%
Exit Fee: 0,1%
Savepoint1: 0,7%
Savepoint2: 1,3%
Savepoint3: 2,2$
Savepoint4: 3,1%
Savepoint5: 4%
Profit would be currently 1,9% so the last Savepoint where it would automatically sell would be Savepoint 2 at 1,2% profit (SP1 - 0,1%)
This is the code snipped i have so far..
// Savepoints
SP1 = input.float(title="Savepoint 1", defval=0.6, minval=0, maxval=100)
SP2 = input.float(title="Savepoint 2", defval=1.2, minval=0, maxval=100)
var entryPrice = close
if tradeSignal
strategy.entry("Enter Long", strategy.long)
entryPrice := close
if close >= entryPrice + (entryPrice * SP1)
if close <= entryPrice + (entryPrice * (SP2 - 0.1))
strategy.exit(id="SP2", from_entry = "Enter Long", limit = entryPrice*(1+(SP2-0.1)/100))
if close <= entryPrice + (entryPrice * (SP1 - 0.1))
strategy.exit(id="SP1", from_entry = "Enter Long", limit = entryPrice*(1+(SP1-0.1)/100))