I want to use take profit for order and stop loss at the same time. But I have read at manual that it is impossible.
I try to use such code to close profitable position when thay more profitable then set up in variable myInput0.
if (Position.MarketPosition == MarketPosition.Long&&Position.GetProfitLoss(Close[0], PerformanceUnit.Currency)>myInput0)
{
ExitLong("exit for profit");
}
//////////////
if (Position.MarketPosition == MarketPosition.Short&&Position.GetProfitLoss(Close[0], PerformanceUnit.Currency)>myInput0)
{
ExitShort("exit for Short");
}
But it does not give result. I try to optimize it, and changing variable myInput0, does not give result.
I also download sample of trailing stop, but they does not move stop loss and only close order's when profit reduced. And those mechanism do not work well on bactesting.
Comment