GG River Flow
//+------------------------------------------------------------------+
//| GG-RiverFlow.mq4 |
//| Copyright ?2009, GGekko |
//| http://www.fx-ggekko.com |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2009, GGekko"
#property link "http://www.fx-ggekko.com"
#property indicator_chart_window
extern string ___IndicatorSetup___ = ">>> Indicator Setup:<<<";
extern string Help_for_TFNumbers = "Maximum: 7";
extern int TFNumbers = 7; // max 7
extern int MA_Shift = 1;
extern string ___DisplaySetup___ = ">>> Display Setup:<<<";
extern color UpColor = YellowGreen;
extern color DownColor = Tomato;
extern color FlatColor = Gold;
extern color TextColor = CadetBlue;
extern string Help_for_Corner = "LeftTop:0, RightTop:1, Not used:2,3!";
extern int Corner = 0;
extern int PosX = 0;
extern int PosY = 0;
extern int Unique_Id = 52725;
int tframe[]={1,5,15,30,60,240,1440};
string tf[]={"1","5","15","30","H1","H4","D1"};
int ma_period[]={2,3,5,8,13,21,34,55,89,144};
string ind;
double ma0_1[],ma0_2[];
double ma1_1[],ma1_2[];
double ma2_1[],ma2_2[];
double ma3_1[],ma3_2[];
double ma4_1[],ma4_2[];
double ma5_1[],ma5_2[];
double ma6_1[],ma6_2[];
double ma7_1[],ma7_2[];
double ma8_1[],ma8_2[];
double ma9_1[],ma9_2[];
double IndVal;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
if(Corner==0)
{
for(int w=0;w<TFNumbers;w++)
{
ObjectCreate(Unique_Id+tf,OBJ_LABEL,0,0,0,0,0);
ObjectSet(Unique_Id+tf,OBJPROP_CORNER,Corner);
ObjectSet(Unique_Id+tf,OBJPROP_XDISTANCE,w*17+PosX+19);
ObjectSet(Unique_Id+tf,OBJPROP_YDISTANCE,PosY+20);
ObjectSetText(Unique_Id+tf,tf,8,"Tahoma",TextColor);
}
for(int x=0;x<7;x++) //
for(w=0;w<10;w++)
{
ObjectCreate(Unique_Id+"Ind"+x+w,OBJ_LABEL,0,0,0,0,0);
ObjectSet(Unique_Id+"Ind"+x+w,OBJPROP_CORNER,Corner);
ObjectSet(Unique_Id+"Ind"+x+w,OBJPROP_XDISTANCE,x*17+PosX+15);
ObjectSet(Unique_Id+"Ind"+x+w,OBJPROP_YDISTANCE,w*6+PosY);
ObjectSetText(Unique_Id+"Ind"+x+w,"-",42,"Arial",TextColor);
}
}
if(Corner==1)
{
for(w=0;w<TFNumbers;w++)
{
ObjectCreate(Unique_Id+tf,OBJ_LABEL,0,0,0,0,0);
ObjectSet(Unique_Id+tf,OBJPROP_CORNER,Corner);
ObjectSet(Unique_Id+tf,OBJPROP_XDISTANCE,w*17+PosX+19);
ObjectSet(Unique_Id+tf,OBJPROP_YDISTANCE,PosY+20);
ObjectSetText(Unique_Id+tf,tf,8,"Tahoma",TextColor);
}
for(x=0;x<7;x++) //
for(w=0;w<10;w++)
{
ObjectCreate(Unique_Id+"Ind"+(TFNumbers-1-x)+w,OBJ_LABEL,0,0,0,0,0);
ObjectSet(Unique_Id+"Ind"+(TFNumbers-1-x)+w,OBJPROP_CORNER,Corner);
ObjectSet(Unique_Id+"Ind"+(TFNumbers-1-x)+w,OBJPROP_XDISTANCE,x*17+PosX+15);
ObjectSet(Unique_Id+"Ind"+(TFNumbers-1-x)+w,OBJPROP_YDISTANCE,w*6+PosY);
ObjectSetText(Unique_Id+"Ind"+(TFNumbers-1-x)+w,"-",42,"Arial",TextColor);
}
}
if(Corner==0 || Corner==1)
{
ObjectCreate(Unique_Id+"LineTop0",OBJ_LABEL,0,0,0,0,0);
ObjectSet(Unique_Id+"LineTop0",OBJPROP_CORNER,Corner);
ObjectSet(Unique_Id+"LineTop0",OBJPROP_XDISTANCE,PosX+13);
ObjectSet(Unique_Id+"LineTop0",OBJPROP_YDISTANCE,PosY+12);
ObjectSetText(Unique_Id+"LineTop0"," ---------------- ",8,"Tahoma",TextColor);
ObjectCreate(Unique_Id+"LineTop",OBJ_LABEL,0,0,0,0,0);
ObjectSet(Unique_Id+"LineTop",OBJPROP_CORNER,Corner);
ObjectSet(Unique_Id+"LineTop",OBJPROP_XDISTANCE,PosX+13);
ObjectSet(Unique_Id+"LineTop",OBJPROP_YDISTANCE,PosY+14);
ObjectSetText(Unique_Id+"LineTop","-------------------------------",8,"Tahoma",TextColor);
ObjectCreate(Unique_Id+"LineHigh",OBJ_LABEL,0,0,0,0,0);
ObjectSet(Unique_Id+"LineHigh",OBJPROP_CORNER,Corner);
ObjectSet(Unique_Id+"LineHigh",OBJPROP_XDISTANCE,PosX+13);
ObjectSet(Unique_Id+"LineHigh",OBJPROP_YDISTANCE,PosY+26);
ObjectSetText(Unique_Id+"LineHigh","-------------------------------",8,"Tahoma",TextColor);
ObjectCreate(Unique_Id+"LineLow",OBJ_LABEL,0,0,0,0,0);
ObjectSet(Unique_Id+"LineLow",OBJPROP_CORNER,Corner);
ObjectSet(Unique_Id+"LineLow",OBJPROP_XDISTANCE,PosX+13);
ObjectSet(Unique_Id+"LineLow",OBJPROP_YDISTANCE,PosY+90);
ObjectSetText(Unique_Id+"LineLow","-------------------------------",8,"Tahoma",TextColor);
ObjectCreate(Unique_Id+"IndName",OBJ_LABEL,0,0,0,0,0);
ObjectSet(Unique_Id+"IndName",OBJPROP_CORNER,Corner);
ObjectSet(Unique_Id+"IndName",OBJPROP_XDISTANCE,PosX+43);
ObjectSet(Unique_Id+"IndName",OBJPROP_YDISTANCE,PosY+6);
ObjectSetText(Unique_Id+"IndName","GG-RiverFlow",8,"Tahoma",TextColor);
ObjectCreate(Unique_Id+"Copyright",OBJ_LABEL,0,0,0,0,0);
ObjectSet(Unique_Id+"Copyright",OBJPROP_CORNER,Corner);
ObjectSet(Unique_Id+"Copyright",OBJPROP_XDISTANCE,PosX+28);
ObjectSet(Unique_Id+"Copyright",OBJPROP_YDISTANCE,PosY+96);
ObjectSetText(Unique_Id+"Copyright","GG-RiverFlow",8,"Tahoma",TextColor);
}
ArrayResize(ma0_1,TFNumbers);ArrayResize(ma0_2,TFNumbers);
ArrayResize(ma1_1,TFNumbers);ArrayResize(ma1_2,TFNumbers);
ArrayResize(ma2_1,TFNumbers);ArrayResize(ma2_2,TFNumbers);
ArrayResize(ma3_1,TFNumbers);ArrayResize(ma3_2,TFNumbers);
ArrayResize(ma4_1,TFNumbers);ArrayResize(ma4_2,TFNumbers);
ArrayResize(ma5_1,TFNumbers);ArrayResize(ma5_2,TFNumbers);
ArrayResize(ma6_1,TFNumbers);ArrayResize(ma6_2,TFNumbers);
ArrayResize(ma7_1,TFNumbers);ArrayResize(ma7_2,TFNumbers);
ArrayResize(ma8_1,TFNumbers);ArrayResize(ma8_2,TFNumbers);
ArrayResize(ma9_1,TFNumbers);ArrayResize(ma9_2,TFNumbers);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
for(int w=0;w<TFNumbers;w++)
{
ObjectDelete(Unique_Id+tf);
}
for(int x=0;x<TFNumbers;x++)
for(w=0;w<10;w++)
{
ObjectDelete(Unique_Id+"Ind"+x+w);
}
ObjectDelete(Unique_Id+"LineTop0");
ObjectDelete(Unique_Id+"LineTop");
ObjectDelete(Unique_Id+"LineHigh");
ObjectDelete(Unique_Id+"LineLow");
ObjectDelete(Unique_Id+"IndName");
ObjectDelete(Unique_Id+"Copyright");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
for(int x=0;x<TFNumbers;x++)
{
ma0_1=iMA(NULL,tframe,ma_period,0,MODE_EMA,PRICE_CLOSE,0);
ma0_2=iMA(NULL,tframe,ma_period,MA_Shift,MODE_EMA,PRICE_CLOSE,0);
ma1_1=iMA(NULL,tframe,ma_period,0,MODE_EMA,PRICE_CLOSE,0);
ma1_2=iMA(NULL,tframe,ma_period,MA_Shift,MODE_EMA,PRICE_CLOSE,0);
ma2_1=iMA(NULL,tframe,ma_period,0,MODE_EMA,PRICE_CLOSE,0);
ma2_2=iMA(NULL,tframe,ma_period,MA_Shift,MODE_EMA,PRICE_CLOSE,0);
ma3_1=iMA(NULL,tframe,ma_period,0,MODE_EMA,PRICE_CLOSE,0);
ma3_2=iMA(NULL,tframe,ma_period,MA_Shift,MODE_EMA,PRICE_CLOSE,0);
ma4_1=iMA(NULL,tframe,ma_period,0,MODE_EMA,PRICE_CLOSE,0);
ma4_2=iMA(NULL,tframe,ma_period,MA_Shift,MODE_EMA,PRICE_CLOSE,0);
ma5_1=iMA(NULL,tframe,ma_period,0,MODE_EMA,PRICE_CLOSE,0);
ma5_2=iMA(NULL,tframe,ma_period,MA_Shift,MODE_EMA,PRICE_CLOSE,0);
ma6_1=iMA(NULL,tframe,ma_period,0,MODE_EMA,PRICE_CLOSE,0);
ma6_2=iMA(NULL,tframe,ma_period,MA_Shift,MODE_EMA,PRICE_CLOSE,0);
ma7_1=iMA(NULL,tframe,ma_period,0,MODE_EMA,PRICE_CLOSE,0);
ma7_2=iMA(NULL,tframe,ma_period,MA_Shift,MODE_EMA,PRICE_CLOSE,0);
ma8_1=iMA(NULL,tframe,ma_period,0,MODE_EMA,PRICE_CLOSE,0);
ma8_2=iMA(NULL,tframe,ma_period,MA_Shift,MODE_EMA,PRICE_CLOSE,0);
ma9_1=iMA(NULL,tframe,ma_period,0,MODE_EMA,PRICE_CLOSE,0);
ma9_2=iMA(NULL,tframe,ma_period,MA_Shift,MODE_EMA,PRICE_CLOSE,0);
}
for(x=0;x<TFNumbers;x++)
{
if(ma0_1>ma0_2) IndVal=1;
else if(ma0_1<ma0_2) IndVal=-1;
else IndVal=0;
if(ma1_1>ma1_2) IndVal=1;
else if(ma1_1<ma1_2) IndVal=-1;
else IndVal=0;
if(ma2_1>ma2_2) IndVal=1;
else if(ma2_1<ma2_2) IndVal=-1;
else IndVal=0;
if(ma3_1>ma3_2) IndVal=1;
else if(ma3_1<ma3_2) IndVal=-1;
else IndVal=0;
if(ma4_1>ma4_2) IndVal=1;
else if(ma4_1<ma4_2) IndVal=-1;
else IndVal=0;
if(ma5_1>ma5_2) IndVal=1;
else if(ma5_1<ma5_2) IndVal=-1;
else IndVal=0;
if(ma6_1>ma6_2) IndVal=1;
else if(ma6_1<ma6_2) IndVal=-1;
else IndVal=0;
if(ma7_1>ma7_2) IndVal=1;
else if(ma7_1<ma7_2) IndVal=-1;
else IndVal=0;
if(ma8_1>ma8_2) IndVal=1;
else if(ma8_1<ma8_2) IndVal=-1;
else IndVal=0;
if(ma9_1>ma9_2) IndVal=1;
else if(ma9_1<ma9_2) IndVal=-1;
else IndVal=0;
}
for(int y=0;y<10;y++)
for(int z=0;z<TFNumbers;z++)
{
if(IndVal==-1) ObjectSetText(Unique_Id+"Ind"+z+y,"-",42,"Arial",DownColor);
if(IndVal==0) ObjectSetText(Unique_Id+"Ind"+z+y,"-",42,"Arial",FlatColor);
if(IndVal==1) ObjectSetText(Unique_Id+"Ind"+z+y,"-",42,"Arial",UpColor);
}
//----
return(0);
}
//+------------------------------------------------------------------+
前排支持下分享 我是个凑数的。。。 帮你顶下哈!! 谢谢楼主分享 帮你顶下哈!! 谢谢楼主分享 谢谢
页:
[1]