Adjust position when position is up by certain amount of pips from executed order
Created at 13 Aug 2020, 16:51
SA
Adjust position when position is up by certain amount of pips from executed order
13 Aug 2020, 16:51
Hi All
I have my stop loss automatically set and I wanted to know how to adjust an open position if the initial risk in pips (open price - stop loss) is above 3%. I am having trouble incorporating the pip value from the order into the foreach (var position in Positions) section of code.
I assume slPriceS & slPriceB change each time which is why my bot isn't working how I would like.
If there is a better way to do this, i would love to hear your thoughts :)
Many thanks
Sam
samuelbreezey
15 Aug 2020, 11:06
RE:
samuelbreezey said:
Figured out that I can adjust the order when position is in profit by certain percentage using the following:
var PositionPnL = Math.Round(100 * Positions.Sum(t => t.NetProfit) / Account.Balance, 1);
Full code:
@samuelbreezey