Export N-volume bar data to text

Hi,

I have used the following code to export intraday minute data to a txt file. I use Scan to do so. How do I do the same for N-volume bar data as the periodicity settings don't allow for n-volume bars?


oc=ln(C/o);
dco=ln(O/Ref(C,-1));
ol=ln(L/O);
oh=ln(H/O);

tim=Hour()*100+Minute();

dat=datenum();

C_new=ln(C);
o_new=ln(o);
l_new=ln(l);
h_new=ln(h);

const=934;
for( i=1; i<BarCount; i++ )
{ if ( dat[i] != dat[i-1] )
	{	o_new[i]=C_new[i-1];
	}
  else 
	{	O_new[i]=C_new[i-1]+dco[i];	
	}
	
	C_new[i]=O_new[i]+oc[i];
	h_new[i]=O_new[i]+oh[i];
	L_new[i]=o_new[i]+ol[i];
}
C=round(exp(c_new)*100)/100;
O=round(exp(O_new)*100)/100;
L=round(exp(L_new)*100)/100;
H=round(exp(H_new)*100)/100;


//Plot(tim,"c", colorGreen, styleLine); 
/*
Plot(exp(o_new),"o", colorgreen, styleLine); 
Plot(exp(l_new),"l", colorred, styleLine); 
Plot(exp(h_new),"h", colorblue, styleLine);  
*/

fh = fopen( "C:\\Users\\name\\OneDrive\\Documents\\TS\\data\\"+Name()+"_5vol.txt", "w"); 
if( fh ) 
{ 
   y = Year(); 
   m = Month(); 
   d = Day(); 
   r = Hour();
   e = Minute();

   
   for( i = 0; i < BarCount; i++ ) 
   { 
      //fputs(  "," , 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("%.4f,%.4f,%.4f,%.4f,%.0f\n", 
                     O[ i ],H[ i ],L[ i ],C[ i ],V[ i ] ); 
      fputs( qs, fh ); 
   } 

   fclose( fh ); 
} 

Buy = 0;

Thanks

N volume bars are available if only you define them in the Tools->Preferences, Intraday page

Okay, assuming that it done, how could I create the output given that Scan seems to only use periodic data bars in the Analysis Settings?

Is this even possible to do if base bars are 1 minute?

As I wrote: you can use nvolume bars if and only if you define them in the Preferences

I have them defined here as I mentioned before. Obviously I'm missing something else because I don't see them in the Analysis settings as an option.

It was my understanding that I need to use Exploration or Scan and these both require a "periodicity" selection which doesn't have N-volume bars as a selection.

Is your database Using Tick as base time interval?

No, I use 1 minute as my base.

Tick is required for n volume bars

1 Like

If I can see volume bars on the chart, is there no way to export that data without having tick data?

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.