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

Re: Adjusting the bollinger band while exporting them.



PureBytes Links

Trading Reference Links

At 10:09 AM 7/28/2007, John Bowles wrote:

>The Primary reason is to get an export of Bollinger band data out to a csv (comma Separated Value) or tab separated value file so I can pick the data up in MS-Access where I will organize it for my trading. Here is the problem. I always have the bollinger bands up for all chart sizes (1, 5, 10, 15, 30, 60, daily and even weekly). 

Why don't you try to do everything in TradeStation, rather than exporting it to MS-Access?

You could create a function that contains all the values you need and have an indicator on each chart that uses the function to plot the Bollinger Bands. The function could automatically determine what kind of chart it is on and report back the desired values for that kind of chart.

You would then edit the values in the function and the values would all change on all charts.

You could also have the indicator print or print-to-file values on each new bar in real time.

Example code below.

Bob Fulks

----------------------

// "DataFunction" function 

Input: Length(NumericRef), NumDevs(NumericRef); 

   if DataCompression = 3 then begin Length = 20; NumDevs = 2.0; end else
   if DataCompression = 2 then begin Length = 10; NumDevs = 1.5; end else
   if DataCompression = 1 then begin 
      if BarInterval =  1 then begin Length = 23; NumDevs = 2.0; end else
      if BarInterval =  5 then begin Length = 20; NumDevs = 2.3; end else
      if BarInterval = 10 then begin Length = 26; NumDevs = 1.6; end else
      if BarInterval = 15 then begin Length = 23; NumDevs = 2.1; end else
      if BarInterval = 30 then begin Length = 16; NumDevs = 1.9; end else
      if BarInterval = 60 then begin Length = 19; NumDevs = 2.2; end;
   end;

DataFunction = 0;

-----------------------
// Indicator

Vars: Avg( 0 ), SDev( 0 ), Length( 0 ), NumDevs( 0 ), 
      UpperBand( 0 ), LowerBand( 0 ) ;

if CurrentBar = 1 then Value1 = DataFunction(Length, NumDevs);

Avg = AverageFC( Close, Length ) ;
SDev = StandardDev( Close, Length, 1 ) ;
UpperBand = Avg + NumDevs * SDev ;
LowerBand = Avg - NumDevs * SDev ;

Plot1( UpperBand, "UpperBand" ) ;
Plot2( LowerBand, "LowerBand" ) ;
Plot3( Avg, "MidLine" ) ;