While...Wend Auto-Step Script Block


#1

I have inherited some strategies that use while…wend statements inside of script blocks.

When I am in debug mode and auto-step is on, I cannot tell where the strategy is executing if it is in the While…Wend script block.

I have my Debugger Performance set to the highest setting and the check box is checked for “When stepping, make sure the active block is visible”.


#2

Hello Robertson,

Depending on when you told the debugger to start autostepping, you might’ve missed your chance to see the hash-marks on that block that you’ll see when it’s executing if you’d started the autostep before you got there. In other words, if you set a breakpoint on or before that OptoScript block, OR click Autostep BEFORE you click Run, you’ll see the green pulsing outline around the block as it’s running, possibly forever depending on the code.

But I’m guessing you want to see not just that the block is running, but what’s going on in there…

You have a few options for ha, depending on the “bigger” problem you’re trying to solve. Check out [U][B]this post for some tips on debugging[/B][/U], including how you might pull that loop OUT of the OptoScript block, or set a break point inside that block.

Also keep in mind you “inspect” the conditions the While is looking for, or even add an index into that loop which gets incremented each time through the loop so you can see where you are in there. You could even add a string to your strategy that’s just for status – where you could add messages throughout the code to indicate where you are in the process.

I hope that helps!
-OptoMary


#3

I am looking at it from a production environment…well after development and startup. Not being able to tell where the strategy is at in a large chart without adding indexes or writing in breakpoints is a hamstring. I love the flexibility of your products but think there is room for improvement in this area.


#4

Without changing anything, you should be able to tell which block you’re on (just start autostep soon enough). The rest is just for extra/optional debugging info.


#5

I would if I could…problem is that the only time I need to run autostep is troubleshooting after the chart is already running and stuck in a loop somewhere.