Partial Closes
4 replies
lself
13 years ago #111568
I need to know how to take a partial position off. There is a Close position partially, however, how do I apply this my parameters. I need to close part when a portion of my profits reach a certain ATR multiplier.
Layne
0
Mark Fric
13 years ago #122681
Hello,
the key is to create a rule that will check when profit reached the given ATR multiplied value.
You can do for example it by condition: ConvertPLToRealPips( Open P/L(..) ) > (1.5 * ATR(14))
This wil be true if open P/L of given order is bigger than 1.5 * ATR(14).
As the action you can then add Close Position Partially(…)
when you’ll specify the amount of the order to be closed.
Mark
Mark
StrategyQuant architect
0
lself
13 years ago #122720
Thanks Mark
I was attempting to do just that but in a different manner. I will implement your suggested method and report back to the forum.
Layne
0
lself
13 years ago #122843
Hello,
the key is to create a rule that will check when profit reached the given ATR multiplied value.
You can do for example it by condition: ConvertPLToRealPips( Open P/L(..) ) > (1.5 * ATR(14))
This wil be true if open P/L of given order is bigger than 1.5 * ATR(14).
As the action you can then add Close Position Partially(…)
when you’ll specify the amount of the order to be closed.
Mark
Mark,
I’ve been working on this for some time thinking I could get it. I get it to the point where it actually takes off the required position size. However, then on the next candle open it takes of the same percentage again of the remaining lots. It does this continually until the broker doesn’t allow any more reduction in lot size or the bar is not in profit anymore.
I would like to scale out in one or two steps and let the remaining position size run to the TP or my trailing stop.
Layne
0
ssdex
11 years ago #130350
Layne:
I figured out why it just closes out the whole order. The script continues to look at the Rule and if there isn’t something there to tell it not to continue to do the Partial Close it will continue until the whole order is closed.
I put a line—current position size = (the first lot size)
This fixed it for me at the moment.
Hope it helps you figure out what is wrong on your end.
Good luck,
James
0
Viewing 4 replies - 1 through 4 (of 4 total)