I figured it out, you just have to use the return function. I have done the majority of my coding in VBA so you can see the variable as you step through the code
Have updated my code (for long positions only) to have an indicator that will show you you exit levels
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//trailing stop function
//variables
mytradedprice=open
myclose=close
trailingstart=10//trailing will start
trailingstep=5//trailing step to move the "trailing stop"
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok