Rank: Advanced Member
Groups: Registered, Registered Users Joined: 10/15/2005(UTC) Posts: 31 Location: The Netherlands
|
Dear all,
I hope somebody can help me out with this challenge.
When i open a position with a trailing stop, i have to fill in 2 fields in my trade-interface. The distance (difference between stoploss and current price) and the step (the amount the price has to change before the trailing stop is adjusted). I would like to plot the trailingstop, including these 2 variables, on my chart so i can evaluate the settings of these parameters.
For simplicity sake i use a simple RSI-system to show how far i'm right now.
LE:=Cross(RSI(14),30); LX:=Cross(70,RSI(14)); Distance:=(ATR(14)*2); Step:=Distance/10; Target:=(ATR(14)*5); Signal:=If(LE=1,1,If(LX=1,-1,0)); {long = 1 and short = -1}
If(Signal=1,C-distance,If(Signal=-1,C+distance,c))
I would like to plot a trailing stop below the prices, if the last signal was long. On the other hand a trailing stop above the prices if the last signal was short. In the formula above the trailing stop is only visible on the day of the signal. On the other days the close is shown. The step is not included yet, because i don't know how to do that.
I hope i explained it clearly and that somebody can help me out.
Greetings,
Arne from the Netherlands
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 10/15/2005(UTC) Posts: 31 Location: The Netherlands
|
Hello,
After testing and surfing on the internet i found the following solution. I don't think it is the most advanced solution, it's quite basic i think, but i will do for me. Please note that it uses the PREV-function, which really slows down the system .
Period:=10; {look back period to determine volatility} Distance:=3; {distance of the stop, normally between 1.5 and 3.0} Stoplong:=C*Distance*ATR(Period); {for long positions} Stopshort:=C+Distance*ATR(period); {for short positions} Bandlong:=If(L<=Prev,stoplong,if(stoplong>prev,stoplong,prev)); Bandshort:=If(H>=Prev,Stopshort,If(stopshort<prev,stopshort,prev)); Bandlong; Bandshort;
I mentioned the "step" in my last post, but i don't think it is that important. I use a fixed step of 0.05 right know, and that is also the default.
Good luck trading.
Arne
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers, Unverified Users Joined: 10/28/2004(UTC) Posts: 3,111 Location: Perth, Western Australia
Was thanked: 16 time(s) in 16 post(s)
|
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.