Simple Coding Help - No Promise.

i am doing trades based on camarilla pivot levels.
can anybody help what will be good filter to avoid false entries.
if there is any such filter, will be great and most profitable strategy for intraday trading.

thanks in advance
 

john302928

Well-Known Member
Does anyone have amibroker afl for Pivot support resistance similar to the one used in tradingview with multiday viewing pf Pvot and support and resistance.If so please share .thanks
1532599891437.png
 

SwagatN

Well-Known Member
Hello All,

Code:
// create folder for exporting purposes
fmkdir( "C:\\DataExport\\" );

// open file for writing
// file name depends on currently processed ticker
fh = fopen( "c:\\DataExport\\" + Name() + ".txt", "w" );

// proceed if file handle is correct
if ( fh )
{
    dt = DateTime();

    // write header line
    fputs( "Ticker,Date/Time,Open,High,Low,Close,Volume\n", fh );

    // iterate through all the bars

    for ( i = 0; i < BarCount; i++ )
    {
        // write ticker name
        fputs( Name() + "," , fh );

        // write date/time information
        fputs( DateTimeToStr( dt[ i ] ) + ",", fh );

        //write quotations and go to the next line
        qs = StrFormat( "%g,%g,%g,%g,%g\n", O[ i ], H[ i ], L[ i ], C[ i ], V[ i ] );
        fputs( qs, fh );

    }
    // close file handle
    fclose( fh );
}
 
// line required by SCAN option
Buy = 0;
I got the above code from web which helps in exporting intraday data from Amibroker and save them to csv/text file. When I used this code, it is actually exporting all the available data in amibroker database.

What I need to do if I want only current date data is to be exported ?? Not the entire data ??

This AFL is not responding to when I select the custom data range as From-To Date in Analysis window, So If anyone know the solutions please let me know.. Thanks
 
Hello All,

Code:
// create folder for exporting purposes
fmkdir( "C:\\DataExport\\" );

// open file for writing
// file name depends on currently processed ticker
fh = fopen( "c:\\DataExport\\" + Name() + ".txt", "w" );

// proceed if file handle is correct
if ( fh )
{
    dt = DateTime();

    // write header line
    fputs( "Ticker,Date/Time,Open,High,Low,Close,Volume\n", fh );

    // iterate through all the bars

    for ( i = 0; i < BarCount; i++ )
    {
        // write ticker name
        fputs( Name() + "," , fh );

        // write date/time information
        fputs( DateTimeToStr( dt[ i ] ) + ",", fh );

        //write quotations and go to the next line
        qs = StrFormat( "%g,%g,%g,%g,%g\n", O[ i ], H[ i ], L[ i ], C[ i ], V[ i ] );
        fputs( qs, fh );

    }
    // close file handle
    fclose( fh );
}

// line required by SCAN option
Buy = 0;
I got the above code from web which helps in exporting intraday data from Amibroker and save them to csv/text file. When I used this code, it is actually exporting all the available data in amibroker database.

What I need to do if I want only current date data is to be exported ?? Not the entire data ??

This AFL is not responding to when I select the custom data range as From-To Date in Analysis window, So If anyone know the solutions please let me know.. Thanks

Use this code..It works fine.. Change the date format as mentioned ..
Eg for today : 1180726

fmkdir( "C:\\OHLC" );
Buy = ( (DateNum() >= 1150106) AND (DateNum() <= 1170428) AND (TimeNum() >= 091500) AND (TimeNum() <= 153000));
// date is 1YYMMDD format
for( i = 0; i < BarCount; i++ )
if( Buy )
{
fh = fopen( "C:\\OHLC\\"+Name()+".txt", "a");
if( fh )
{
y = Year();
m = Month();
d = Day();
r = Hour();
e = Minute();

for( i = 0; i < BarCount; i++ )
if( Buy )


{
fputs( Name() + "," , fh );
ds = StrFormat("%02.0f%02.0f%02.0f,",
y[ i ], m[ i ], d[ i ] );
fputs( ds, fh );

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


qs = StrFormat("%.2f,%.2f,%.2f,%.2f,%.0f\n",
O[ i ],H[ i ],L[ i ],C[ i ],V[ i ] );
fputs( qs, fh );
}
fclose( fh );
}
}
 

trash

Well-Known Member
Use this code..It works

fmkdir( "C:\\OHLC" );
Buy = ( (DateNum() >= 1150106) AND (DateNum() <= 1170428) AND (TimeNum() >= 091500) AND (TimeNum() <= 153000));
// date is 1YYMMDD format
for( i = 0; i < BarCount; i++ )
if( Buy )
{
fh = fopen( "C:\\OHLC\\"+Name()+".txt", "a");
if( fh )
{
y = Year();
m = Month();
d = Day();
r = Hour();
e = Minute();

for( i = 0; i < BarCount; i++ )
if( Buy )


{
fputs( Name() + "," , fh );
ds = StrFormat("%02.0f%02.0f%02.0f,",
y[ i ], m[ i ], d[ i ] );
fputs( ds, fh );

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


qs = StrFormat("%.2f,%.2f,%.2f,%.2f,%.0f\n",
O[ i ],H[ i ],L[ i ],C[ i ],V[ i ] );
fputs( qs, fh );
}
fclose( fh );
}
}

That code is bullshit. Two loop statements.... code been made by an amateur having no clue at all.
 

SwagatN

Well-Known Member
Use this code..It works fine.. Change the date format as mentioned ..
Eg for today : 1180726

fmkdir( "C:\\OHLC" );
Buy = ( (DateNum() >= 1150106) AND (DateNum() <= 1170428) AND (TimeNum() >= 091500) AND (TimeNum() <= 153000));
// date is 1YYMMDD format
for( i = 0; i < BarCount; i++ )
if( Buy )
{
fh = fopen( "C:\\OHLC\\"+Name()+".txt", "a");
if( fh )
{
y = Year();
m = Month();
d = Day();
r = Hour();
e = Minute();

for( i = 0; i < BarCount; i++ )
if( Buy )


{
fputs( Name() + "," , fh );
ds = StrFormat("%02.0f%02.0f%02.0f,",
y[ i ], m[ i ], d[ i ] );
fputs( ds, fh );

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


qs = StrFormat("%.2f,%.2f,%.2f,%.2f,%.0f\n",
O[ i ],H[ i ],L[ i ],C[ i ],V[ i ] );
fputs( qs, fh );
}
fclose( fh );
}
}
Thank you.. I did not use the exact code, but atleast your code of checking datenum in BUY condition gave me clue and now its working as per my expectation.. Thanks again
 

trash

Well-Known Member
Thank you.. I did not use the exact code, but atleast your code of checking datenum in BUY condition gave me clue and now its working as per my expectation.. Thanks again
Do not use that code and do not spread same nonsense code all over the place again. It is wrong looping made by an amateur!

I got that code from Amibroker knowledge base itself.
Then post the link for christ sake.
http://www.amibroker.com/kb/2014/11/14/how-to-export-quotes-to-separate-text-files-per-symbol/

And I could not figure out how to make use of Status function for the above requirement. Sorry
Do like so

Code:
bir = Status( "barinrange" );

for ( i = 0; i < BarCount; i++ )
{
    if( bir[i] ) {
        // .... your code here
    }
}
 

Similar threads