Here is a sample code:
protected override void OnBarUpdate()
{
if (BarsInProgress == 1) {
if (Position.MarketPosition == MarketPosition.Flat) {
if (SMA(BarsArray[1])[0] < 50)
{
EnterLong();
}
}
}
if (BarsInProgress == 0) {
if (Position.MarketPosition == MarketPosition.Long) {
BarsArray[1][0] = BarsArray[2][0]; // Assign the last 1 mins bar value to the 5 mins bar (Unable to change the BarsArray value because it's readonly

if (SMA(BarsArray[1])[0] > 50)
{
ExitLong();
}
}
}
}
Andy

Comment