pls help me programatically assign # of shares to my orders.
What I do:
#region Variables // introduce variables private double value = 1000; private double Dqty; private int Iqty;
protected override void OnBarUpdate()
{
//calculate number of shares to buy based on the
Dqty = value / Ask[0]; //code line: 84
Iqty = Convert.ToInt32(Dqty);
<...>
{
EnterLong("Long 1a", Iqty); //code line: 111
EnterLong("Long 1b", Iqty); //code line: 112
}
}
If I try to remove Iqty from EnterLong and try o compile, then I get another (attached - error2)
If you can't help me debug this, can you please let me know what I am doing wrong here?
Alternatively, can you please advise if there is an easier way to set order quantity based on this logic: $ ammount / share price.
THANK YOU


Comment