[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Re: Sort by columns



PureBytes Links

Trading Reference Links

Fred,

I'm not very familiar with vbscript or js but I think I have an idea.  Do you think you can combine the following code which I gather on the other posts? This code is in js so it needs to be converted to vbs.

thanks

tony

// Variables

var iCount      ;                //Current interation count

var iNotifyCount;                //Current interation count for user notification

var sMsg        ;                //Dialog box message

var iResponse   ;                //Response from dialog box

var wshShell    ;                //Windows Scripting Host Shell

 

var iMaxIterations         ;     //Maximum number of iterations (to prevent out of control loop)

var iMaxNotifyIterations   ;     //Maximum number of iterations before notifying user

var iSleepSeconds           ;     //Number of seconds to sleep

 

// User Preferences

iMaxIterations         =   10 ;     //Maximum number of iterations (to prevent out of control loop)

iMaxNotifyIterations   =   5  ;     //Maximum number of iterations before notifying user

iSleepSeconds          =   120  ;     //Number of seconds to sleep

 

//Set the variable for sleeping

var iSleepNum          =   iSleepSeconds * 1000;

 

//Shell

WshShell = WScript.CreateObject("WScript.Shell");

 

/* create AB object */

AB = new ActiveXObject("Broker.Application");

 

/* retrieve automatic analysis object */

AA = AB.Analysis;

 

/* load formula from external file */

AA.LoadFormula("C:\\Program Files\\AmiBroker\\Formulas\\Custom\\3x3_Scanner.afl")

 

/* setup filters */

AA.ClearFilters();

 

// Use Symbols in Watchlist 16

AA.Filter( 0, "watchlist" ) = 0;

 

/* set apply to and range */

AA.ApplyTo     = 0; // use filters

AA.RangeMode   = 3; // use last day's quotes

AA.RangeN      = 2;

 

//Init the counts

iCount         = 0;

iNotifyCount   = 0;

while( iCount  <= iMaxIterations  )

   {

   //Iterate the user notification

   iNotifyCount    += 1;

 

   // run explore

   AA.Explore();

 

   // Sleep for 3 seconds

   WScript.Sleep(iSleepNum)

 

   if(iNotifyCount == iMaxNotifyIterations)

      {

      //Propt users the user

      sMsg =  "Click 'OK' to continue."

          + "\nClick 'Cancel' to exit."

      iResponse = WshShell.popup(sMsg  , 0, "Exit", 1 + 32 )

 

      if(iResponse == 2)      //Cancel

         {

         break;

         }

      //Reset the notification counter

      iNotifyCount = 0;

      }

 

   // Iterate Count

   iCount    += 1;

   }

 


Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html





YAHOO! GROUPS LINKS