I have tried setting up the basic logic but it fails. My code only generates short trades, or only long trades hence the random function does not work the way I want it to. Please see below.
protectedoverridevoid OnBarUpdate()
{
// Condition set 1
Random randNum = new Random();
tempVar=randNum.Next(0,1);
if (tempVar > 0.5) //tempVar is float
{
EnterLong(DefaultQuantity, "");
tempVar=randNum.Next(0,1);
}
else
{
EnterShort(DefaultQuantity, "");
tempVar=randNum.Next(0,1);
}
If anyone could help me get this working cortrectly I would appreciate it greatly, thanks.
Comment