Advance take profit
Advance take profit
16 Jul 2015, 18:27
Is there a function that will allow me to close a portion of my trade after it reaches a certain amount of pips, like if I am trading a 0.10 lot and it hits my target but I only want to close 0.05 of the position then add a trailing stop to the remaining position.
Replies
Makagon
16 Jul 2015, 23:35
RE:
Makagon said:
Hi, if you have position 0.10 lot (for eurusd it's 10000) and want to close half of that, you can use this:
in section OnStart you add:
Positions.Closed += PositionsOnClosed;
in section OnTick you add:
if .... something
and you want to close half of you position use this:
var position = Positions.Find("youLabelPosition");
if (position != null)
ClosePosition(position,5000);
in function
private void PositionsOnClosed(PositionClosedEventArgs args)
{
var position = Positions.Find("youLabelPosition");
if (position != null)
ModifyPosition(position, stopLoss, position.TakeProfit);
}
ModifyPosition(position, stopLoss, NewTakeProfit);
@Makagon
Makagon
16 Jul 2015, 23:53
RE: RE:
Makagon said:
Makagon said:
Hi, if you have position 0.10 lot (for eurusd it's 10000) and want to close half of that, you can use this:
in section OnStart you add:
Positions.Closed += PositionsOnClosed;
in section OnTick you add:
if .... something
and you want to close half of you position use this:
var position = Positions.Find("youLabelPosition");
if (position != null)
ClosePosition(position,5000);
in function
private void PositionsOnClosed(PositionClosedEventArgs args)
{
var position = Positions.Find("youLabelPosition");
if (position != null)
ModifyPosition(position, stopLoss, position.TakeProfit);
}
ModifyPosition(position, stopLoss, NewTakeProfit);
OMG
ModifyPosition(position, NewStopLoss, NewTakeProfit);
@Makagon
Makagon
16 Jul 2015, 23:34
Hi, if you have position 0.10 lot (for eurusd it's 10000) and want to close half of that, you can use this:
in section OnStart you add:
Positions.Closed += PositionsOnClosed;
in section OnTick you add:
if .... something
and you want to close half of you position use this:
var position = Positions.Find("youLabelPosition");
if (position != null)
ClosePosition(position,5000);
in function
private void PositionsOnClosed(PositionClosedEventArgs args)
{
var position = Positions.Find("youLabelPosition");
if (position != null)
ModifyPosition(position, stopLoss, position.TakeProfit);
}
@Makagon