|
QuantShare
2010-06-16 14:56:09
0
|
|
Best Answer
In order to perform this, you should use the money management tool:
In the "OnClosePosition" event, add the following code:
MMExitPosition pos = Functions.GetPositionDetails();
TimeSeries low = Data.GetPriceSeries(pos.Symbol, "low");
if(low[0] < pos.EntryPrice - (pos.EntryPrice * 0.05))
{
double limitPrice1 = low[0]; // Update this field
int orderValid = 10; // 10 days
_TradingOrder order = Orders.LimitOrder(limitPrice1, 0, orderValid);
Functions.UpdateOrder(order);
}
else
{
double limitPrice2 = low[0]; // Update this field
int orderValid = 10; // 10 days
_TradingOrder order = Orders.LimitOrder(limitPrice2, 0, orderValid);
Functions.UpdateOrder(order);
}
|
|