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

Re: [amibroker] Re: Little help Flagging date a stock is purchased on the chart


  • To: imresident2001 <amibroker@xxxxxxxxxxxxxxx>
  • Subject: Re: [amibroker] Re: Little help Flagging date a stock is purchased on the chart
  • From: Herman <psytek@xxxxxxxx>
  • Date: Sun, 21 Jan 2007 18:05:46 -0500

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