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

[amibroker] Osaka 1.0.3 FREE, open source plugin



PureBytes Links

Trading Reference Links

Hi,

As a way of saying thank you to Tomasz I decided to release 
completely free my plugin that provides table functions.
This software is free and remain free forever.

http://www.amibroker.net/3rdparty/OSAKA_103s.zip

Joe R. Osaka


OSAKA plugin read me.
======================

 OSAKA is a FREE application kit for AmiBroker.
 

 This FREE, OPEN SOURCE plugin provides additional functionality to 
AmiBroker community.

 THE SOURCE FILES ARE AVAILABLE FROM AMIBROKER-DLL GROUP.

 This is FREE software and will remain FREE forever .
 Authors of FREE, open source products may use this source freely.
 Using any part of this code in any commercial product *except 
AmiBroker itself*
 IS STRICTLY PROHIBITED.

 AGAIN: Commercial use is PROHIBITED.
 The only exception is eventual inclusion of functions written by me 
in AmiBroker itself
 (as a way of saying THANK YOU TOMASZ)


 Copyright (C)2003 Joe R. Osaka, Osaka developers group

================
Version 1.0.0 - INITIAL RELEASE
Version 1.0.1 - BUG FIX  
* bug fix in osInitialize  
* made it faster by removing extra safety checks (you can get back 
by undefining MAX_SPEED in globals.cpp)
Version 1.0.2 - Added
NUMBER osTabImport(STRING filename, STRING separator, NUMBER 
tableid, SkipHeader = True, MaxRows = -1 );
- Imports table from CSV file format.
Version 1.0.3 - Added
//  NUMBER osTabSort( NUMBER tableid, NUMBER Col1, Number Asc1 = 
TRUE, NUMBER Col2 = Null, NUMBER Asc2 = TRUE, NUMBER Col3 = Null, 
NUMBER Asc3 = TRUE, NUMBER Col4 = Null, NUMBER Asc4 = TRUE, NUMBER 
Col5 = Null, NUMBER Asc5 = TRUE )
//  Sorts table by multiple columns (from 1 to 5)
//  numeric columns are sorted numerically, strings are storted 
alphabetically (case insensitive)


FUNCTIONS AVAILABLE


NUMBER osInitialize()
- initializes OSAKA plugin. You need to call it at the beginning
of your AFL formula using OSAKA plugin

NUMBER osTabCreate()
- creates a table. Returns tableid that is used with all
other osTab*** operations

NUMBER osTabDelete( tableid )
- deletes a table and frees memory allocated by it. 
Gets tableid as returned by osTableCreate.
 
NUMBER osTabAddColumn(STRING colname, NUMBER coltype, NUMBER 
tableid, NUMBER strSize=10);
- adds a column of 'colname' name and 'coltype' type
  supported types right now are: 1 - FLOAT (NUMBER) and 2 - STRING
  strSize optional parameter is used for strings only (specifies 
max. length of text field)


NUMBER osTabSetString(STRING val, NUMBER row, NUMBER col, NUMBER 
tableid);
- sets the value of the cell at given 'row' and 'col' to 'val' 
string value

NUMBER osTabSetNumber(NUMBER val, NUMBER row, NUMBER col, NUMBER 
tableid);
- sets the value of the cell at given 'row' and 'col' to 'val' 
number value

VARIANT osTabGet(NUMBER row, NUMBER col, NUMBER tableid);
- retrieves value of the cell at position row,col 
returns NUMBER or STRING depending on type of the column


VARIANT osTabLoad(STRING filename, NUMBER tableid);
- Loads binary image of the table 
File name if given without path will be stored in AmiBroker working 
directory.
Relative paths also refer to AmiBroker working directory

VARIANT osTabSave(STRING filename, NUMBER tableid);
- Saves binary image of the table 
File name if given without path will be stored in AmiBroker working 
directory.
Relative paths also refer to AmiBroker working directory

NUMBER osTabExport(STRING filename, STRING separator, NUMBER 
tableid, IncludeHeader = True, MaxRows = -1, Append = False);
- Exports table into CSV file format.

NUMBER osTabImport(STRING filename, STRING separator, NUMBER 
tableid, SkipHeader = True, MaxRows = -1 );
- Imports table from CSV file format.

Note that you have to create table first and define columns via 
osTabAddColumn
PRIOR to calling osTabImport.
Each row of CSV file represents one row in the table.
Data imported by osTabImport are appended to existing data
Function returns the number of rows successfully imported

NUMBER osTabSort( NUMBER tableid, NUMBER Col1, Number Asc1 = TRUE, 
NUMBER Col2 = Null, NUMBER Asc2 = TRUE, NUMBER Col3 = Null, NUMBER 
Asc3 = TRUE, NUMBER Col4 = Null, NUMBER Asc4 = TRUE, NUMBER Col5 = 
Null, NUMBER Asc5 = TRUE )
//  Sorts table by multiple columns (from 1 to 5)
//  numeric columns are sorted numerically, strings are storted 
alphabetically (case insensitive)


====

SAMPLE CODE (for Commentary window);

osInitialize();

table = osTabCreate();
osTabAddColumn( "my first column", 1, table );
osTabAddColumn( "my second column2", 2, table, 30 );

for( i = 0; i < 100; i++ )
{
  osTabSetNumber( 200*LastValue( Random() ), i, 0, table );
  osTabSetString( "Test string (" + WriteVal(i) +") ", i, 1, table );
}

Output = "";
for( i = 0; i < 100; i++ )
{
  Output = Output  + osTabGet( i, 0, table ) + ", " + osTabGet( i, 
1 , table ) + "\n";
}

Output;

osTabDelete( table );

"SAVE/LOAD -----";
table2 = osTabCreate();

Output = "";
for( i = 0; i < 100; i++ )
{
  Output = Output  + osTabGet( i, 0, table2 ) + ", " +  osTabGet( i, 
1 , table2 ) + "\n";
}

Output;

"EXPORT/IMPORT/SORT -----";
osTabExport( "test.txt", ",", table2 );
osTabDelete( table2 );

// MUST create and define columns in
// the table prior to importing !
table3 = osTabCreate();
osTabAddColumn( "my first column", 1, table3 );
osTabAddColumn( "my second column2", 2, table3, 30 );
osTabImport("test.txt", ",", table3 );

osTabSort(table3,0 ); // SORT BY FIRST COLUMN 
Output = "";
for( i = 0; i < 100; i++ )
{
  Output = Output  + osTabGet( i, 0, table3 ) + ", " +  osTabGet( i, 
1 , table3 ) + "\n";
}

Output;



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Coral Calcium at VitaminBoost.com - 1 month supply - $23.95
(1 bottle, 90 tablets, 400mg each with Magnesium & Vitamin D)
http://www.challengerone.com/t/l.asp?cid=2805&lp=calcium2.asp
http://us.click.yahoo.com/ipZhzC/AoaGAA/ySSFAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

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