#include <windows.h>
#include "sierrachart.h"


SCDLLInit("indx_b1");

SCSFExport scsf_indx_b1(SCStudyInterfaceRef sc)
{
	SCSubgraphRef indx_b1 		= sc.Subgraph[0];

	if (sc.SetDefaults)
	{
		sc.GraphName 			= "indx_b1";
		sc.StudyDescription 	= "indx_b1 >>beta 1<< @ganz";

		indx_b1.Name 			= "indx_b1";
		indx_b1.DrawStyle 		= DRAWSTYLE_BAR;
		indx_b1.PrimaryColor	= RGB(255,255,0);
		indx_b1.LineWidth 		= 4;
		
		sc.GraphRegion 			= 1;		
		sc.AutoLoop 			= 1;		
		sc.FreeDLL 				= 1;		
	}

	SCDateTime 	NextDate;
	int 		NextIndex;
	
	sc.DataStartIndex = 100;
	
	if ( sc.DailyDataBarPeriod == 1 ) {	
			
		for ( int count = 1 ; count <= 3; count ++ ) 
		{					
			NextDate	= sc.BaseDateTimeIn[sc.Index] - count*7*DAYS;
			
			NextIndex 	= sc.GetContainingIndexForSCDateTime(sc.ChartNumber, NextDate);
						
			indx_b1[sc.Index] = NextIndex;
			
			
		}	
    }
	else return;
}
