#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Green
double XXK [];
double XXL [];
extern string info_="- - - Tutaj podaj ile ma byc badanych swiec ---";
extern int linia_dolna_od = 1, linia_dolna_do = 366;
extern int linia_gorna_od = 1, linia_gorna_do = 366;
extern string nazwa_dolnej_linii = "Support", nazwa_gornej_linii = "Resistance";
extern color kolor_dolnej_linii = Green, kolor_gornej_linii = Red;
double XXM , XXS , XXT , XXV ;
datetime XXO , XXA , XXB , XXC ;
bool XXD =false;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int init()
{
SetIndexStyle (0,DRAW_LINE,0,0,kolor_gornej_linii);
SetIndexBuffer (0, XXK );
SetIndexEmptyValue(0,0.0 );
SetIndexLabel (0,"Resistance");
SetIndexStyle (1,DRAW_LINE,0,0,kolor_dolnej_linii);
SetIndexBuffer (1, XXL );
SetIndexEmptyValue(1,0.0 );
SetIndexLabel (1,"Support" );
return(0);
}
int deinit()
{
ObjectsDeleteAll();
return(0);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int start()
{
if (TimeDayOfYear(TimeCurrent())>333&&TimeYear(TimeCurrent())!=2011){return;}
XXQ ();
if ( XXD ==true)
{
RefreshRates();
WindowRedraw();
XXA = iTime(NULL,0,linia_dolna_od);
XXC = iTime(NULL,0,linia_dolna_od);
XXS = iLow (NULL,0,linia_dolna_od);
XXT = iLow (NULL,0,linia_dolna_od);
int XXF , XXR = linia_dolna_od;
for ( XXF = linia_dolna_od; XXF <= linia_dolna_do; XXF ++)
{
if (iLow(NULL,0, XXF ) < XXS )
{
XXR = XXF ;
XXS = iLow (NULL,0, XXR );
XXA = iTime(NULL,0, XXR );
}
}
for ( XXF = linia_dolna_od; XXF < XXR ; XXF ++)
{
if (iLow(NULL,0, XXF ) < XXT )
{
XXT = iLow (NULL,0, XXF );
XXC = iTime(NULL,0, XXF );
}
}
ObjectCreate(nazwa_dolnej_linii,OBJ_TREND,0, XXA , XXS , XXC , XXT );
for ( XXF = XXR ; XXF >=linia_dolna_od; XXF --)
{
if ( ObjectGetValueByShift(nazwa_dolnej_linii, XXF ) > iLow(NULL,0, XXF ) )
{
ObjectDelete(nazwa_dolnej_linii);
if (TimeDayOfYear(TimeCurrent())>333&&TimeYear(TimeCurrent())!=2011){return;}
}
XXC = iTime(NULL,0, XXF );
XXT = iLow(NULL,0, XXF );
ObjectCreate(nazwa_dolnej_linii,OBJ_TREND,0, XXA , XXS , XXC , XXT );
}
ObjectSet(nazwa_dolnej_linii,OBJPROP_COLOR,kolor_dolnej_linii);
ObjectSet(nazwa_dolnej_linii,OBJPROP_WIDTH,1);
ObjectSet(nazwa_dolnej_linii,OBJPROP_STYLE,STYLE_SOLID);
for ( XXF = XXR ; XXF >=linia_dolna_od; XXF --)
{
XXL [ XXF ] = ObjectGetValueByShift(nazwa_dolnej_linii, XXF );
}
XXO = iTime(NULL,0,linia_gorna_od);
XXB = iTime(NULL,0,linia_gorna_od);
XXM = iLow (NULL,0,linia_gorna_od);
XXV = iLow (NULL,0,linia_gorna_od);
int XXG , XXH = linia_gorna_od;
for ( XXG = linia_gorna_od; XXG <= linia_gorna_do; XXG ++)
{
if (iHigh(NULL,0, XXG ) > XXM )
{
XXH = XXG ;
XXM = iHigh(NULL,0, XXH );
XXO = iTime(NULL,0, XXH );
}
}
for ( XXG = linia_dolna_od; XXG < XXH ; XXG ++)
{
if (iHigh(NULL,0, XXG ) > XXV )
{
XXV = iHigh(NULL,0, XXG );
XXB = iTime(NULL,0, XXG );
}
}
ObjectCreate(nazwa_gornej_linii,OBJ_TREND,0, XXO , XXM , XXB , XXV );
for ( XXG = XXH ; XXG >=linia_gorna_od; XXG --)
{
if ( ObjectGetValueByShift(nazwa_gornej_linii, XXG ) < iHigh(NULL,0, XXG ) )
{
ObjectDelete(nazwa_gornej_linii);
}
XXB = iTime(NULL,0, XXG );
XXV = iHigh(NULL,0, XXG );
ObjectCreate(nazwa_gornej_linii,OBJ_TREND,0, XXO , XXM , XXB , XXV );
}
ObjectSet(nazwa_gornej_linii,OBJPROP_COLOR,kolor_gornej_linii);
ObjectSet(nazwa_gornej_linii,OBJPROP_WIDTH,1);
ObjectSet(nazwa_gornej_linii,OBJPROP_STYLE,STYLE_SOLID);
for ( XXG = XXH ; XXG >=linia_gorna_od; XXG --)
{
XXK [ XXG ] = ObjectGetValueByShift(nazwa_gornej_linii, XXG );
}
}
return(0);
}
void XXQ ()
{
static datetime XXU =0;
XXD =false;
if( XXU != Time[0])
{
XXU =Time[0];
XXD =true;
}
}