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

[amibroker] Re: Q: Exporting files via AFL only



PureBytes Links

Trading Reference Links


I am not an expert in Wsh Script, only a genius "copy paster"
I  have used some examples and 
http://www.amibroker.com/guide/objects.html

but if the settings in Amibroker are limited to range from with 
RANGEMODE = 3, I suppose you 'll explore only your date range.

the date must be written 
oAA.RangeFromDate = "1040228" ; // 2004 02 28

Stephane

> If you wanted to set a range date, RANGEMODE = 3, how would you 
write this using your approach?  
> 
> Would the same approach apply?  RangeFromDate = ?? .  
> 
> Guess my system is not fast enough and I always test with a limited 
date range.
> 
> Les meilleurs souvenirs
> Joseph Landry 
> 
> 
======================================================================
==========
> I was able to test using the short pieces of  JScript that I wrote 
a few weeks back as follows, and I had
> the hardest time settling in on the how to enter the date. Like 
where is this known or documented?
> 
> oWSH = WScript.CreateObject( "WScript.Shell" );
> /**********************  Set the date range********************/
> oAA.RangeMode =3;                // Backtest over date range
> oAA.RangeFromDate = "2004,1,2";   
> oAA.RangeToDate = "2004,12,03"; 
>  
> WScript.Echo ("From Date" + oAA.RangeFromDate);
>  WScript.Echo ("To Date" + oAA.RangeToDate); 
> 
>   ----- Original Message ----- 
>   From: Stephane Carrasset 
>   To: amibroker@xxxxxxxxxxxxxxx 
>   Sent: Monday, February 28, 2005 2:32 PM
>   Subject: [amibroker] Re: Q: Exporting files via AFL only
> 
> 
> 
>   here is an example Daniel 
>   /* CompositesRanking */
> 
>   /*create AB object */
>   AB = new ActiveXObject("Broker.Application");
> 
>   /* retrieve automatic analysis object */
>   AA = AB.Analysis;
> 
>   /* load formula from external file */
>   AA.LoadFormula("D:\\Program 
>   Files\\AmiBroker\\Formulas\\Systems\\Expl_Ranking_Comp.afl");
> 
>   /* optional: load settings */
>   // AA.LoadSettings("the_path_to_the_settings_file.abs");
> 
>   /* setup filters */
>   /* backtest over symbols present in market 0 only (zero-based 
number) 
>   */
>   AA.ClearFilters(); 
>   AA.Filter( 0, "watchlist" ) = 1;/* watch list number */
> 
>   /* set apply to and range */
>   AA.ApplyTo = 2; // use filters
>   AA.RangeMode = 0; // use all available quotes
> 
>   /* run backtest and display report */
>   AA.Explore();
> 
> 
>   /* Export Csv*/
>   AA.Export("YourExportFile.csv");
> 
>   > Hello,
>   > 
>   > OK, I see. In that case I can only suggest OLE automation 
interface 
>   called from the outside JScript:
>   > 
>   > AB = new ActiveXObject("Broker.Application");
>   > AA = AB.Analysis;
>   > 
>   > AA.LoadFormula("YourFormula.afl");
>   > AA.Explore();
>   > AA.Export("YourExportFile.csv");
>   > 
>   > http://www.amibroker.com/guide/objects.html
>   > 
>   > Best regards,
>   > Tomasz Janeczko
>   > amibroker.com
>   > ----- Original Message ----- 
>   > From: "Daniel Ervi" <daniel@xxxx>
>   > To: <amibroker@xxxxxxxxxxxxxxx>
>   > Sent: Monday, February 28, 2005 6:52 PM
>   > Subject: Re: [amibroker] Q: Exporting files via AFL only
>   > 
>   > 
>   > 
>   > Tomasz,
>   > 
>   > Thanks for the answer.  The problem with using the fputs is 
that I 
>   need to build the file line by line, and not vertically like I am 
>   > now.
>   > 
>   > For example:  (excerpts, not full code!)
>   > 
>   > -------------------------
>   > ...more code
>   > 
>   > procedure CalcOscillatorStudies(Symbol, xOpen, xHigh, xLow, 
xClose, 
>   xVolume)
>   > {
>   >   AddColumn(WinZ(xOpen, 10), symbol + "_WinZ[O:10]");
>   >   AddColumn(WinZ(xHigh, 10), symbol + "_WinZ[H:10]");
>   >   AddColumn(WinZ(xLow, 10), symbol + "_WinZ[L:10]");
>   >   AddColumn(WinZ(xClose, 10), symbol + "_WinZ[C:10]");
>   >   AddColumn(DSS(xHigh, xLow, xClose, 4, 4), symbol + "_DSS
[4:10]");
>   >   AddColumn(REI(xHigh, xLow, xClose), symbol + "_REI");
>   >   AddColumn(ValueChart(xHigh, xLow, xClose), symbol 
+ "_ValueC");
>   >   AddColumn(ValueChart(xHigh, xLow, xHigh), symbol + "_ValueH");
>   >   AddColumn(ValueChart(xHigh, xLow, xLow), symbol + "_ValueL");
>   > }
>   > 
>   > procedure CalcVolatilityStudies(Symbol, xOpen, xHigh, xLow, 
xClose, 
>   xVolume)
>   > {
>   >   //etc...
>   > }
>   > ...more code
>   > 
>   > tickerString = "KLAC,AMAT,NVLS,QQQQ";
>   > tickerString = tickerString + "," + GetBaseIndex() + "," + 
SectorID
>   (1) + "," + IndustryID(1);
>   > 
>   > // Output basic stock data
>   > AddColumn(DateTime(), "Date", formatDateTime);
>   > AddColumn(O, "Open", 1.3);
>   > AddColumn(H, "High", 1.3);
>   > AddColumn(L, "Low", 1.3);
>   > AddColumn(C, "Close", 1.3);
>   > AddColumn(V, "Volume", 1.0);
>   > 
>   > // Count number of tickers
>   > for(tickerCount = 0; (sym = StrExtract(tickerString, 
tickerCount)) !
>   = ""; tickerCount++)
>   > {
>   >   if(tickerCount == 0) tickerCount = 0;
>   >   else tickerCount = tickerCount ;
>   > }
>   > 
>   > // Loop through tickers and apply transforms
>   > for(ticker = 0; ticker < tickerCount; ticker++)
>   > {
>   >   symbol = StrExtract(tickerString, ticker);
>   >   xOpen = Foreign(symbol, "O", True);
>   >   xHigh = Foreign(symbol, "H", True);
>   >   xLow = Foreign(symbol, "L", True);
>   >   xClose = Foreign(symbol, "C", True);
>   >   xVolume = Foreign(symbol, "V", True);
>   > 
>   >   CalcVolatilityStudies(xSymbol, xOpen, xHigh, xLow, xClose, 
>   xVolume);
>   >   CalcOscillatorStudies(symbol, xOpen, xHigh, xLow, xClose, 
>   xVolume);
>   > }
>   > 
>   > -------------------------
>   > 
>   > Now I have all the data calculated into the columnX fields, but 
I 
>   have no way of iterating through the columns.  I suppose I could 
>   > write the above functions to work on a bar by bar basis, but I 
>   might as well use Osaka then.
>   > 
>   > Anyway, it is no big deal, I just thought it might be something 
>   easy that I was overlooking...
>   > 
>   > Thanks.
>   > 
>   > Daniel
>   > 
>   > 
>   > 
>   > On Mon, 28 Feb 2005 18:29:08 +0100, Tomasz Janeczko wrote:
>   > >
>   > > Daniel,
>   > >
>   > > How about writing directly to file using file functions:
>   > > http://www.amibroker.com/f?fopen http://www.amibroker.com/f?
fclose
>   > > http://www.amibroker.com/f?fputs
>   > >
>   > > http://www.amibroker.com/f?StrFormat
>   > >
>   > >
>   > > Best regards,
>   > > Tomasz Janeczko
>   > > amibroker.com
>   > > ----- Original Message -----
>   > > From: "Daniel Ervi" <daniel@xxxx>
>   > > To: <amibroker@xxxxxxxxxxxxxxx>
>   > > Sent: Monday, February 28, 2005 5:46 PM
>   > > Subject: [amibroker] Q: Exporting files via AFL only
>   > >
>   > >
>   > >> Hi,
>   > >>
>   > >> A general question for the group.
>   > >>
>   > >> I'd like to export a series of data for use in an external 
neural
>   > >> network program. I have written an AFL script to build this
>   > >> file using a series of loops to call the AddColumn() command.
>   > >> The result is a Results window populated with about 150 
>   variables.
>   > >> I would like to save this file programmatically from AFL 
into a
>   > >> CSV format.
>   > >>
>   > >> My question is if there is a way to enumerate the columnX 
data
>   > >> fields so that I can loop through them and save them?
>   > >>
>   > >> I think the Osaka DLL does what I want (saves the table), 
but I'd
>   > >> like to stick to native AFL if it is possible. Any thoughts?
>   > >>
>   > >> Daniel
>   > >>
>   > >>
>   > >> Check AmiBroker web page at:
>   > >> http://www.amibroker.com/
>   > >>
>   > >> Check group FAQ at:
>   > >> http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
>   Yahoo!
>   > >> Groups Links
>   > >
>   > >
>   > > ------------------------ Yahoo! Groups Sponsor ---------------
----
>   -
>   > > ~--> In low income neighborhoods, 84% do not own computers. At
>   > > Network for Good, help bridge the Digital Divide!
>   > > http://us.click.yahoo.com/EpW3eD/3MnJAA/cosFAA/GHeqlB/TM -----
----
>   --
>   > > ---------------------------------------------------------~->
>   > >
>   > > Check AmiBroker web page at:
>   > > http://www.amibroker.com/
>   > >
>   > > Check group FAQ at:
>   > > http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo!
>   > > Groups Links
>   > >
>   > >
>   > >
>   > 
>   > 
>   > 
>   > 
>   > 
>   > Check AmiBroker web page at:
>   > http://www.amibroker.com/
>   > 
>   > Check group FAQ at: 
>   http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>   > Yahoo! Groups Links
> 
> 
> 
> 
> 
>   Check AmiBroker web page at:
>   http://www.amibroker.com/
> 
>   Check group FAQ at: 
http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> 
> 
>         Yahoo! Groups Sponsor 
>               ADVERTISEMENT
>              
>        
>        
> 
> 
> --------------------------------------------------------------------
----------
>   Yahoo! Groups Links
> 
>     a.. To visit your group on the web, go to:
>     http://groups.yahoo.com/group/amibroker/
>       
>     b.. To unsubscribe from this group, send an email to:
>     amibroker-unsubscribe@xxxxxxxxxxxxxxx
>       
>     c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
Service.





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Has someone you know been affected by illness or disease?
Network for Good is THE place to support health awareness efforts!
http://us.click.yahoo.com/Rcy2bD/UOnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

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

<*> 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/