Hi,
I would like to add a trail profit to my strategy,
I did the below code,
I think something is missing, someone can help?
List<IOrder> orders = new ArrayList<IOrder>();
for(IOrder o : engine.getOrders(instrument)){
if(o.getProfitLossInPips() >= Trail*instrument.getPipValue()){
if(o.isLong())
{
if(o.getStopLossPrice()!= (tick.getAsk() - Trail_Step*instrument.getPipValue()))
{
o.setStopLossPrice(tick.getAsk() - Trail_Step*instrument.getPipValue()); }
}
else if(!o.isLong())
{
if(o.getStopLossPrice()!= (tick.getBid() + Trail_Step*instrument.getPipValue()))
{
o.setStopLossPrice(tick.getBid() + Trail_Step*instrument.getPipValue()); }
}
}
}
thanks