The number of ticks is "IWantHalf"
The problem is... when I do that it deletes my trailing stop entirely instead of just modifying the quantity.
Do I need to re-establish a trail stop after selling half of my position?
Thank you.
if (IWantHalf > 10
&& Positions[1].MarketPosition != MarketPosition.Flat
&& Positions[1].Quantity > DefaultOrderQuantity
&& Positions[1].Quantity >= 2
)
{
if ( //down candle X above price
Closes[0][0] > Positions[1].AveragePrice - Convert.ToDouble(IWantHalf / TickSize)
&& Closes[0][0] < Opens[0][0]
)
{
Print("Price reached "
+ IWantHalf.ToString()
+ " above entry price of "
+ Positions[1].AveragePrice.ToString());
Print("Take off this many: " + Convert.ToInt32(Positions[1].Quantity/2).ToString());
ExitLong(1,Convert.ToInt32(Positions[1].Quantity/2), "","");
}
}

Comment