NF Swing Trading using Fractal AFL

PUCHU_2500

Well-Known Member
OT, do you want date and time data in separate cell ?
like this image ?


if so I will try to share the afl.
 

PUCHU_2500

Well-Known Member
It will be very helpful if you could share the AFL.
OT brother, I am honestly saying I have Zero(0) knowledge in afl coding. if the afl works for you then nothing to say, if it is showing any error, pls, bhai mujhe maaf karna I can not give you proper ans.......jo bhi ho, try it and tell me.....
before it, you create a folder in 'C' drive as AMIDATA2

// By Barry Scarborough 7/14/2008, updated to handle large files 8/30/08
// Export intraday and EOD data to .csv files
// One file for each stock but the symbol name must be a valid Microsoft file
//Name OR you will have to modify it, see code below to change Name
// if the data exceeds 65500 lines it will be broken into separate files up to
//327,500 lines OR about 227 days of 24 Hour, one Minute data
// This will create a directory C:\AmiBackup
// Select your symbols to export with the "Apply to" filter in AA window, to
//save data base use all symbols AND all quotes
// Make sure the chart is on the period you want to save
// Select the same timeframe period you want to save as using the AA
//"Settings"
// Press Scan button
//

// created a directory on your C drive named Savedata data backup

dayhours = ParamToggle("Day hours only", "No|Yes");
fmkdir("c:\\AMIDATA2");
SetBarsRequired(100000,100000);
lname = Name(); // gets the name of the symbol
// note: if you have names with invalid characters like / you must rename the
//file before you try to create a Name
// add an IF line for each symbol you need to rename
if (lname == "ER2U8-GLOBEX-FUT") lname = "ER2U8";

fh = fopen( "c:\\AMIDATA2" + lname + ".csv", "w");
if( fh )
{
if(Interval() == inDaily OR Interval() == inMonthly OR Interval() ==
inWeekly)
{
fputs( "Ticker,Date,Open,High,Low,Close,Volume \n", fh );
for( i = 0; i < BarCount; i++ )
{
y = Year();
m = Month();
d = Day();
fputs( Name() + "," , fh );
ds = StrFormat("%02.0f %02.0f %02.0f,", d[ i ], m[ i ], y[ 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 );
if(i == 65500 OR i == 130000 OR i == 196500 OR i == 262000)
{
fclose( fh );
if(i == 65500 ) fh = fopen( "c:\\AMIDATA2" + lname + " A.csv", "w");
if(i == 130000 ) fh = fopen( "c:\\AMIDATA2" + lname + " B.csv", "w");
if(i == 196500 ) fh = fopen( "c:\\AMIDATA2" + lname + " C.csv", "w");
if(i == 262000 ) fh = fopen( "c:\\AMIDATA2" + lname + " D.csv", "w");
}
}
}
else // intraday so add time field
{
fputs( "Ticker,Date,Time,Open,High,Low,Close,Volume \n", fh );
y = Year();
m = Month();
d = Day();
r = Hour();
e = Minute();
n = Second();

for( i = 1; i < BarCount; i++ )
{
if (dayhours AND LastValue(TimeNum()) >= 92900 AND LastValue(TimeNum()) <=
161500)
{
fputs( Name() + "," , fh );
ds = StrFormat("%02.0f %02.0f %02.0f,", d[ i ], m[ i ], y[ i ] );
fputs( ds, fh );

ts = StrFormat("%02.0f:%02.0f:%02.0f,", r[ i ],e[ i ],n[ i ] );
fputs( ts, fh );

qs = StrFormat("%.4f,%.4f,%.4f,%.4f,%.0f\n", O[ i ],H[ i ],L[ i ],C[ i
],V[ i ] );
fputs( qs, fh );
}
else
{
fputs( Name() + "," , fh );
ds = StrFormat("%02.0f %02.0f %02.0f,", d[ i ], m[ i ], y[ i ] );
fputs( ds, fh );

ts = StrFormat("%02.0f:%02.0f:%02.0f,", r[ i ],e[ i ],n[ i ] );
fputs( ts, fh );

qs = StrFormat("%.4f,%.4f,%.4f,%.4f,%.0f\n", O[ i ],H[ i ],L[ i ],C[ i
],V[ i ] );
fputs( qs, fh );
}
if(i == 65500 OR i == 130000 OR i == 196500 OR i == 262000)
{
fclose( fh );
if(i == 65500 ) fh = fopen( "c:\\AMIDATA2" + lname + " A.csv", "w");
if(i == 130000 ) fh = fopen( "c:\\AMIDATA2" + lname + " B.csv", "w");
if(i == 196500 ) fh = fopen( "c:\\AMIDATA2" + lname + " C.csv", "w");
if(i == 262000 ) fh = fopen( "c:\\AMIDATA2" + lname + " D.csv", "w");
}
}
}
fclose( fh );
}

Buy = 1;

//To import through ASCII the format should be
//$FORMAT Ticker, Date_YMD, Time, Open, High, Low, Close, Volume
//$SKIPLINES 1
//$SEPARATOR ,
//$CONT 1
//$GROUP 255
//$AUTOADD 1
//$DEBUG 1
//$NOQUOTES 1
 
OT brother, I am honestly saying I have Zero(0) knowledge in afl coding. if the afl works for you then nothing to say, if it is showing any error, pls, bhai mujhe maaf karna I can not give you proper ans.......jo bhi ho, try it and tell me.....
before it, you create a folder in 'C' drive as AMIDATA2

// By Barry Scarborough 7/14/2008, updated to handle large files 8/30/08
// Export intraday and EOD data to .csv files
// One file for each stock but the symbol name must be a valid Microsoft file
//Name OR you will have to modify it, see code below to change Name
// if the data exceeds 65500 lines it will be broken into separate files up to
//327,500 lines OR about 227 days of 24 Hour, one Minute data
// This will create a directory C:\AmiBackup
// Select your symbols to export with the "Apply to" filter in AA window, to
//save data base use all symbols AND all quotes
// Make sure the chart is on the period you want to save
// Select the same timeframe period you want to save as using the AA
//"Settings"
// Press Scan button
//

// created a directory on your C drive named Savedata data backup

dayhours = ParamToggle("Day hours only", "No|Yes");
fmkdir("c:\\AMIDATA2");
SetBarsRequired(100000,100000);
lname = Name(); // gets the name of the symbol
// note: if you have names with invalid characters like / you must rename the
//file before you try to create a Name
// add an IF line for each symbol you need to rename
if (lname == "ER2U8-GLOBEX-FUT") lname = "ER2U8";

fh = fopen( "c:\\AMIDATA2" + lname + ".csv", "w");
if( fh )
{
if(Interval() == inDaily OR Interval() == inMonthly OR Interval() ==
inWeekly)
{
fputs( "Ticker,Date,Open,High,Low,Close,Volume \n", fh );
for( i = 0; i < BarCount; i++ )
{
y = Year();
m = Month();
d = Day();
fputs( Name() + "," , fh );
ds = StrFormat("%02.0f %02.0f %02.0f,", d[ i ], m[ i ], y[ 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 );
if(i == 65500 OR i == 130000 OR i == 196500 OR i == 262000)
{
fclose( fh );
if(i == 65500 ) fh = fopen( "c:\\AMIDATA2" + lname + " A.csv", "w");
if(i == 130000 ) fh = fopen( "c:\\AMIDATA2" + lname + " B.csv", "w");
if(i == 196500 ) fh = fopen( "c:\\AMIDATA2" + lname + " C.csv", "w");
if(i == 262000 ) fh = fopen( "c:\\AMIDATA2" + lname + " D.csv", "w");
}
}
}
else // intraday so add time field
{
fputs( "Ticker,Date,Time,Open,High,Low,Close,Volume \n", fh );
y = Year();
m = Month();
d = Day();
r = Hour();
e = Minute();
n = Second();

for( i = 1; i < BarCount; i++ )
{
if (dayhours AND LastValue(TimeNum()) >= 92900 AND LastValue(TimeNum()) <=
161500)
{
fputs( Name() + "," , fh );
ds = StrFormat("%02.0f %02.0f %02.0f,", d[ i ], m[ i ], y[ i ] );
fputs( ds, fh );

ts = StrFormat("%02.0f:%02.0f:%02.0f,", r[ i ],e[ i ],n[ i ] );
fputs( ts, fh );

qs = StrFormat("%.4f,%.4f,%.4f,%.4f,%.0f\n", O[ i ],H[ i ],L[ i ],C[ i
],V[ i ] );
fputs( qs, fh );
}
else
{
fputs( Name() + "," , fh );
ds = StrFormat("%02.0f %02.0f %02.0f,", d[ i ], m[ i ], y[ i ] );
fputs( ds, fh );

ts = StrFormat("%02.0f:%02.0f:%02.0f,", r[ i ],e[ i ],n[ i ] );
fputs( ts, fh );

qs = StrFormat("%.4f,%.4f,%.4f,%.4f,%.0f\n", O[ i ],H[ i ],L[ i ],C[ i
],V[ i ] );
fputs( qs, fh );
}
if(i == 65500 OR i == 130000 OR i == 196500 OR i == 262000)
{
fclose( fh );
if(i == 65500 ) fh = fopen( "c:\\AMIDATA2" + lname + " A.csv", "w");
if(i == 130000 ) fh = fopen( "c:\\AMIDATA2" + lname + " B.csv", "w");
if(i == 196500 ) fh = fopen( "c:\\AMIDATA2" + lname + " C.csv", "w");
if(i == 262000 ) fh = fopen( "c:\\AMIDATA2" + lname + " D.csv", "w");
}
}
}
fclose( fh );
}

Buy = 1;

//To import through ASCII the format should be
//$FORMAT Ticker, Date_YMD, Time, Open, High, Low, Close, Volume
//$SKIPLINES 1
//$SEPARATOR ,
//$CONT 1
//$GROUP 255
//$AUTOADD 1
//$DEBUG 1
//$NOQUOTES 1
Hey PUCHU,
I thought, it will open csv file in AMIDATA2 folder, i can see amidata2 folder ,but no csv file in it.
fopen( "c:\\AMIDATA2" + lname + ".csv", "w");
regards
 

Similar threads