protected override void OnBarUpdate() { if (CurrentBars[0] < 1) return; Random randNum = new Random(); Print(randNum.Next(0,2)); // Set 1 if (Position.MarketPosition == MarketPosition.Flat) { //Long conditions if( randNum.Next(0,2) == 0) { EnterLong(Convert.ToInt32(DefaultQuantity), @"long"); } else //Short conditions if(randNum.Next(0,2) == 1) { EnterShort(Convert.ToInt32(DefaultQuantity), @"short"); } } }
117 long positions and zero short positions (not random)
100 long positions and 20 short positions (not random)
and rarely, i'll get something like: 56 long positions and 45 short positions (this is kinda what i'd expect)
200 long positions and zero short positions (not random)
By "not random" I mean, how can It be that a coin flip (0,1) generate 200 long positions and zero short positions??
Comment