Change TakeProfit for opened Position
Change TakeProfit for opened Position
26 Mar 2018, 18:30
Hi all,
I have not found the way to edit opened position, my cBot have to recalculate TakeProfit for opened Position according to an algorithm.
var position = Positions.Find("RSI", Symbol, tradeType);
How set new TakeProfit for this position?
Thank you.
Replies
PanagiotisCharalampous
27 Mar 2018, 09:21
Hi Anton,
Did you manage to use the example?
Best Regards,
Panagiotis
@PanagiotisCharalampous
firemyst
14 Aug 2019, 10:04
RE:
anton.kovalchuk said:
The example exists in cAlgo confluence.
var position = Positions.Find("myLabel", Symbol, TradeType.Buy);
if (position != null )
{
double? stopLoss = Symbol.Ask- 10*Symbol.PipSize;
double? takeProfit = Symbol.Ask + 10 * Symbol.PipSize;
ModifyPosition(position, stopLoss, takeProfit);
}
Shouldn't the above example be:
var position = Positions.Find("myLabel", Symbol, TradeType.Buy); if (position != null ) { double? stopLoss = Symbol.Ask- 10*Symbol.PipValue; // use PipValue instead of PipSize because we are subtracting from price double? takeProfit = Symbol.Ask + 10 * Symbol.PipValue; //use PipValue instead of PipSize becacuse we are adding to a price ModifyPosition(position, stopLoss, takeProfit); }
because it's working in prices, not sizes?
@firemyst
PanagiotisCharalampous
14 Aug 2019, 10:13
Hi FireMyst,
No. PipValue shows the value of a pip in your balance currency. PipSize is related to the quoted asset.
Best Regards,
Panagiotis
@PanagiotisCharalampous
anton.kovalchuk
26 Mar 2018, 23:48
The example exists in cAlgo confluence.
var position = Positions.Find("myLabel", Symbol, TradeType.Buy);
if (position != null )
{
double? stopLoss = Symbol.Ask- 10*Symbol.PipSize;
double? takeProfit = Symbol.Ask + 10 * Symbol.PipSize;
ModifyPosition(position, stopLoss, takeProfit);
}
@anton.kovalchuk