if (current price- proce paid / pricepaid >= x) exitLomg.
However, as my system dos not run all night long, I want to leave a profit target order open.
so, at 155900 I use:
if(ToTime(Times[0][0])==155900)
{
if (Position.MarketPosition == MarketPosition.Long)
{
myLongProfitTargetOrder = ExitLongLimit(positionTaken,(priceLong*(1+stopGain Number)));
}
if (Position.MarketPosition == MarketPosition.Short)
{
myShortProfitTargetOrder = ExitShortLimit(positionTaken,(priceShort/(1+stopGainNumber)));
}
at 93200 I cancel myLongProfitTargetOrder and myShortProfitTargetOrder .
But as I am testing the profit target order is not working (at least on backtesting).
Is this the right way to leave profit target orders during night?
Comment