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

[amibroker] Re: How to execute external command from AFL ?



PureBytes Links

Trading Reference Links

One option would be to use scripting to get the Windows shell object 
and invoke calls upon it. Search for WShell on this page:

http://www.amibroker.com/newsletter/02-2001.html

e.g.

WshShell = new ActiveXObject( "WScript.Shell" );
WshShell.Run( ... ); // <-- your run command here.

Note that the entire script is executed for each symbol in your 
watchlist, so you will be executing the command (and your fdelete 
command) once per symbol. Is that really what you want to do?

Mike

--- In amibroker@xxxxxxxxxxxxxxx, "przemyslawuk" <przemyslawuk@xxx> 
wrote:
>
> Hi,
> I use the code below and AA to extract the data from Amibroker to a
> text file. Then I convert it to Metastock format using a DOS 
program.
> Is it possible to execute this dos executable programm directly from 
AFL ?
> the command I use to convert ohlc.txt to metastock looks like this:
> "asc2ms.exe -f ohlc.txt"
> I want to execute the above command from the afl code below in the
> place I market with #########
> 
> Can someone help me?
> 
> 
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> Buy = ( (DateNum() >= 1081005) AND (DateNum() <= 1081013) );
> for( i = 0; i < BarCount; i++ )
> if( Buy[i] )
> {
>   fh = fopen( "C:\\Metastock\\Master\\OHLC.txt", "w"); 
>   if( fh ) 
>    { 
>      y = Year(); 
>      m = Month(); 
>      d = Day(); 
>      r = Hour();
>      e = Minute();
>    
>    for( i = 0; i < BarCount; i++ )
>    if( Buy[i] )
> 
>    { 
>       fputs( Name() + "," + "I"+ ",", fh );
>       ds = StrFormat("%02.0f%02.0f%02.0f,", 
>                      y[ i ], m[ i ], d[ i ] ); 
>       fputs( ds, fh ); 
>      
>       ts = StrFormat("%02.0f:%02.0f,", 
>                      r[ i ],e[ i ]); 
>       fputs( ts, fh ); 
> 
>       qs = StrFormat("%.2f,%.2f,%.2f,%.2f,%.0f,1\n", 
>                      O[ i ],H[ i ],L[ i ],C[ i ],V[ i ] ); 
>       fputs( qs, fh );
>    }
>       fclose( fh );
>    }
> }
> ####################################
> fdelete( "C:\\Metastock\\Master\\Emaster" ) ;
>




------------------------------------

**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

*********************
TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com
*********************

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

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

*********************************
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/