I am using the following logic
CalculateOnBarClose = false;
protected override void OnBarUpdate()
{
if (BarsInProgress == 0)
{
if(Bars.FirstBarOfSession)
{
Do something;
}
if (FirstTickOfBar)
{
if(SMA(sma)[1]>SMA(sma)[2])
{
smaRising = true;
}
}
if(smaRising==true)
{
EnterLong();
}
My question is can you execute an order in OnBarUpdate outside of and after FirstTickofBar, or should you always execute the order inside of FirstTickofBar?
My guess is if a variable is set inside of FirsttickofBar you would want the execution to happen inside that logic as well. I am just a bit confused about the order of calculation here.
Comment