MT4 daily curvi-rank for lower timeframes
/*
----------------------------------------------------------------------
Indicator : cr_d1.mq4
Version : v1.01a
Author : R. Boles
Copyright :
Date : 1-Feb-2007
Contact :
boles.ron@gmail.com
Notes : Plot DAILY curvirank on other timeframes
----------------------------------------------------------------------
*/
#property indicator_chart_window
#property indicator_buffers 7
#property indicator_color1 DodgerBlue
#property indicator_color2 DimGray
#property indicator_color3 DimGray
#property indicator_color4 DimGray
#property indicator_color5 DimGray
#property indicator_color6 DimGray
#property indicator_color7 DimGray
double buf1[];
double buf2[];
double buf3[];
double buf4[];
double buf5[];
double buf6[];
double buf7[];
//+------------------------------------------------------------------+
int init()
{
SetIndexStyle(0,DRAW_LINE,STYLE_DOT,1);
SetIndexBuffer(0,buf1);
SetIndexStyle(1,DRAW_LINE,STYLE_DOT,1);
SetIndexBuffer(1,buf2);
SetIndexStyle(2,DRAW_LINE,STYLE_DOT,1);
SetIndexBuffer(2,buf3);
SetIndexStyle(3,DRAW_LINE,STYLE_DOT,1);
SetIndexBuffer(3,buf4);
SetIndexStyle(4,DRAW_LINE,STYLE_DOT,1);
SetIndexBuffer(4,buf5);
SetIndexStyle(5,DRAW_LINE,STYLE_DOT,1);
SetIndexBuffer(5,buf6);
SetIndexStyle(6,DRAW_LINE,STYLE_DOT,1);
SetIndexBuffer(6,buf7);
return(0);
}
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
int start()
{
double crd1[300], tmpval=0;
int i, c, tmpday=0;
// tmp array for 300 days cr_r0
ArraySetAsSeries(crd1,true);
for ( i=0; i<300; i++ )
crd1
= iCustom(Symbol(),PERIOD_D1,"CR_r0",0,299,2,0,i);
// process latest 1000 chart bars
for ( c=-1, i=0; i<1000; i++ )
{
if ( TimeDayOfYear(iTime(Symbol(),0,i)) != tmpday )
{
c++;
tmpval = crd1[c];
tmpday = TimeDayOfYear(iTime(Symbol(),PERIOD_D1,c));
}
buf1 = tmpval;
// fib lines
double x = tmpval;
double _POINT = Point;
buf2=x+(55*_POINT);
buf3=x+(89*_POINT);
buf4=x+(144*_POINT);
buf5=x-(55*_POINT);
buf6=x-(89*_POINT);
buf7=x-(144*_POINT);
}
return(0);
}
//+------------------------------------------------------------------+