PureBytes Links
Trading Reference Links
|
Hello imresident2001,
Sunday, January 21, 2007, 5:55:54 PM, you wrote:
> Thankyou for sharing that code Terry. Thats so much better than what i
> had in mind. The only negative is all the trades are lost when you
> close amibroker. Can some one pleas figure out a way to save the
> trades please.
You can create/use PersistentVariables as shown below, they will save
data indefinitely until deleted. To save numbers you convert them to a
string first and pass the string to the function,
for example: String = numtostr(Number,1.2);
PersistentPath = "C:\\Program Files\\AmiBroker\\PersistentVariables\\";
function PersistentVarSetText( VarName, String )
{
global PersistentPath;
fh = fopen( PersistentPath+VarName+".pva","w" );
if( fh )
{
fputs( String, fh );
fclose( fh );
}
return fh;
}
function PersistentVarGetText( VarName )
{
global PersistentPath;
fh = fopen( PersistentPath+VarName+".pva","r" );
if( fh )
{
String = fgets( fh );
fclose( fh );
}
else string = "";
return String;
}
Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.17.3/642 - Release Date: 1/20/2007 10:31 PM
|