I would like to know if it's possible exit a position 1 second after enter it.
I tried something like below but seems to work only in minute frame:
private double enterPrice
private int startTime
protected override void OnMarketData(MarketDataEventArgs marketDataUpdate)
{
EnterLongLimit(1, enterPrice, "Buy");
startTime = ToTime(Time[0]);
if (ToTime(Time[0]) >= startTime + 000001 && Position.MarketPosition == MarketPosition.Long)
{
ExitLong(@"exit_TPM_Buy", @"Buy");
}
}
Could anyone help me with correct code for second frame?
Comment