Place re-entry orders with bigger lot size
Place re-entry orders with bigger lot size
04 Sep 2019, 10:19
Hi, I have 2 questions here:
1- I'm trying to place re-entry orders(a buy and a sell) once a trade is stopped out but with a 10% increase in lot size.
For example: If I have a EUR/USD 10k sell at 1.10 with SL at 20 pips. If the price reaches 1.1020 I would like to place a sell order of EUR/USD 11k at 1.10 with SL 20 pips and a buy order of EUR/USD 11k at 1.10 with SL 20 pips. How can I do that?
[Parameter(DefaultValue = 0.0)]
public double Parameter { get; set; }
[Parameter("SLRP", DefaultValue = 50)]
public int stopLimitRangePips { get; set; }
[Parameter("Stop Loss", DefaultValue = 33)]
public int StopLoss { get; set; }
[Parameter("Take Profit", DefaultValue = null)]
public int TakeProfit { get; set; }
[Parameter("Volume", DefaultValue = 10000, MinValue = 10000, Step = 1000)]
public int Volume { get; set; }
protected override void OnStart()
{
Positions.Closed += Positions_Closed;
}
private void Positions_Closed(PositionClosedEventArgs obj)
{
if (obj.Reason == PositionCloseReason.StopLoss)
{
if (obj.Position.TradeType == TradeType.Buy)
{
PlaceStopOrder(TradeType.Sell, Symbol, obj.Position.VolumeInUnits, obj.Position.EntryPrice, "reEntry", StopLoss, TakeProfit);
PlaceStopOrder(TradeType.Buy, Symbol, obj.Position.VolumeInUnits, obj.Position.EntryPrice, "reEntry", StopLoss, TakeProfit);
}
else
{
PlaceStopOrder(TradeType.Buy, Symbol, obj.Position.VolumeInUnits, obj.Position.EntryPrice, "reEntry", StopLoss, TakeProfit);
PlaceStopOrder(TradeType.Sell, Symbol, obj.Position.VolumeInUnits, obj.Position.EntryPrice, "reEntry", StopLoss, TakeProfit);
}
}
}
}
2- Is it possible to close all open trades and orders once the price reaches a certain point?
Thanks
firemyst
18 Sep 2019, 17:09
RE:
tomopeov said:
This one is relatively simple to write pseudo-code (which may work) in a quick few minutes. In your OnTick method, do something similar to:
Here's the supporting function:
@firemyst