I have a problem, difficult to explain, so I put the code and the flowchart.
I have finish coding AFL as 1st module to empty all stock at specific folder and coding another AFL as 2nd module to export all symbol at the same specific folder.
//-------------first module to empty all the data inside C:\AmibrokerD-------
dir = "c:\\AmiBackupD\\";
if(CheckMakeDirectory==0) // jika ada directory c:\\AmiBackupD
_N( list = fdir( dir + "*.*", 1 ) );
for ( i = 0; ( filename = StrExtract( List, i ) ) != ""; i++ )
CheckDeleteFile = fdelete(dir + filename);// path AND file
//------------second module, export data convert to CSV and put in the c:\AmibrokerD-----
fh = fopen( dir +Name()+".TXT", "w");
if( fh )
fputs( "Ticker,Date,Open,High,Low,Close,Volume \n", fh );
y = Year(); m = Month(); d = Day(); //r = Hour();e = Minute();n = Second();
for( i = 0; i < BarCount; i++ )
fputs( Name() + "," , fh );
ds = StrFormat("%02.0f-%02.0f-%02.0f,", y[ i ], m[ i ], d[ i ] );
fputs( ds, fh );
qs = StrFormat("%.4f,%.4f,%.4f,%.4f,%.0f\n", O[ i ],H[ i ],L[ i ],C[ i ],V[ i ] );
fputs( qs, fh );
fclose( fh );
Buy = 0;
after finish test the 1st module and 2nd module separately, and try to make the new AFL let say 3rd AFL which combining from these two 1st module and 2nd module.
so every 1st module and 2nd module running itself module alone and run well, but when combine two AFL into on AFL(3rd AFL), I found that the 1st module after emptying all data in the folder and continue to export all data into the same folder (2nd module), and something wrong happen, because the result inside the folder consist only few files, so I realize that its looping all the 1st and 2nd all the time, so after export one symbol, and go to the top run the empty AFL (1st AFL) and continue run the 2nd modul (export data), and go on again and again, until all the data export, so the result is on only few files that have not been delete.
so, how do I declare a something like switch to switch off, and after running empty files to set the switch on, continue export data to folder, looping into beginning and will skip 1st modul and directly go to the 2nd module continue to export the next symbol, and continue go to top and skip the 1st module and directly go to the 2nd module continue to export the next symbol, and go on again and again until finish export all the symbol ?
I don’t know how to coding like that, I don’t know how to define a kind of glabal memory as a switch, and will maintain to prevent the empty module and directly export the symbol
to make it clear, I draw the flowchart like picture below
So sorry for my poor english,
Some one will Help me to solve this kind of problem ?
thaks for help
rgds bob tanujaya