Random rnd = new Random();
protected override void OnBarUpdate()
{
if (BarsInProgress != 0)
return;
//if(CurrentBar < 50) return;
if (CurrentBars[0] < 10)
return;
// only process real-time OnBarUpdate events
if (State == State.Historical)
return;
if (rnd == null)
return;
R = rnd.Next(1, 10);
// Set 1
if ((R == 1) && (Position.MarketPosition == MarketPosition.Flat))
{
Print(@"COMPRA, R = " + Convert.ToString(R));
EnterLong(Convert.ToInt32(DefaultQuantity), "");
}
// Set 2
if ((R == 2) && (Position.MarketPosition == MarketPosition.Flat))
{
Print(@"VENTA, R = " + Convert.ToString(R));
EnterShort(Convert.ToInt32(DefaultQuantity), "");
}
// Set 3
if ((R != 1)
&& (R != 2))
{
Print(@"R = " + Convert.ToString(R));
}
}
Comment