I'm trying to create a simple strategies in order to open and close a long position in the same day.
I wrote the following code in the OnBarUpdate method
if(Position.MarketPosition == MarketPosition.Flat)
{
Print(String.Format("- Today is {0}, We buy at {1}, the low of the day is {2}",Time[0], actualSupportL1, Low[0]));
entryOrder = EnterLongStop(actualSupportL1,orderName);
}
//after that entryOrder is NOT null and I can see the record
//in the Executions tab of the Strategy Analizer
if(entryOrder != null)
{
string fromEntrySignal = entryOrder.FromEntrySignal;
Print(String.Format("- Today is {0}, We sell at {1}, the high of the day is {2}, the close of the day is {3}",Time[0],actualOpen,High[0],Close[0]));
entryOrder = ExitLong(orderName,fromEntrySignal);
}
//after that entryOrder is null and I can NOT see any record
//in the Executions tab of the Strategy Analizer
Where I'm wrong?
If is suitable for you I can attach the source file.
Thanks in advance
Best regards

Comment