COT: User Feedback

CtrlAltDaveLargeNothing succeeds like the appearance of success.

Christopher Lasch

I am quite impatient with all forms of technology, especially computers. Blank screens giving the pretence that it is actually doing something useful but too busy to tell you is a classic scam. One option is to go for the pre-emptive reboot because it is the only way to be sure. Alternatively, we could get the system to tell the user what it is doing, although we will neatly side step the additional scam of the Windows estimation of time taken. For ease, I’m using a third party library for a progress dialog box,

Download the library, then consider the following,

using Ookii.Dialogs;

private ProgressDialog progressDialog;

protected void showDialog()


if( progressDialog == null )


progressDialog = new ProgressDialog();

progressDialog.ShowTimeRemaining = false;

progressDialog.Description = “An advanced scam…”;

progressDialog.WindowTitle = “Pretending to do complex things”;

progressDialog.DoWork += new System.ComponentModel.DoWorkEventHandler( doWork );


if( !progressDialog.IsBusy )


progressDialog.Text = “Still hard at work…”;





And this function will do the actual work, which in this case is just to waste the user’s time. Note the use of the +1 when calculating the percentage of progress. It is much safer to never allow it to actually reach 100%, otherwise Windows might kill the task off, before it is really finished. This is why tasks commonly halt at 99% and take longer to complete that final 1% than the prior 99%. Be warned: this knowledge is completely useless in a pub quiz.

private void doWork( object sender, DoWorkEventArgs e )


int percentage = 0;

int maxCount = 10;

for( int count = 0; count < maxCount; count++ )


if( progressDialog.CancellationPending )




System.Threading.Thread.Sleep( 2000 );

progressDialog.ReportProgress( percentage, “Working on ” + count,

                           string.Format( System.Globalization.CultureInfo.CurrentCulture,

                           “Processing: {0}%”, percentage ) );

double calculatedPercentage = ( count * 100 ) / ( maxCount + 1 );

percentage = Convert.ToInt32( calculatedPercentage );



On the first use, our COT indicator downloads all the historical data from the official website,

which takes nearly a minute using a standard Internet connection here in London. If too many of you can beat that, then a future version may borrow the extra delay from the above. All this happens in a different thread to NinjaTrader itself, which allows the platform to still be used and not hang.

cot download