Please find attached the script.
For some reason the Account_OrderUpdate() method throws this error when using the quantitySelector.Value as upper limit to the loops
01/06/2022 21:38:29 Default Unhandled exception: Exception has been thrown by the target of an invocation.
I tested printing Print("qsxy : " + quantitySelector.Value);
lines 377-380
private void Account_OrderUpdate(object sender, OrderEventArgs orderUpdateArgs)
{
// Print("qsx : " + quantitySelector.Value);
if (entryBuyMar****rder != null && entryBuyMar****rder == orderUpdateArgs.Order && orderUpdateArgs.Order.OrderState == OrderState.Filled)
{
Print("qsxy : " + quantitySelector.Value);
lines 392 and 421 are the loops statement.
This causes the error.
for (int index = 0; index < quantitySelector.Value; index++)
while this works fine
for (int index = 0; index < 6; index++)
Why doesn't the quantitySelector.Value gets working? How can I make it work so as to avoid the hardcoded way? Thanks!

Leave a comment: