//+------------------------------------------------------------------+ //| Gravity Levels 2.mq4 | //| Copyright © 2008, Nicholas Barker | Apex Group Investments LLC | //| nick@barker.net | //+------------------------------------------------------------------+ #property copyright "Copyright © 2008, Nicholas Barker | Apex Group Investments LLC" #property link "nick@barker.net" #define HIGH 345 #define LOW 3455 #define GU 0 #define EU 1 #define EG 2 #property indicator_chart_window #property indicator_buffers 6 #property indicator_color1 White #property indicator_color2 White #property indicator_color3 Pink #property indicator_color4 Pink #property indicator_color5 Magenta #property indicator_color6 Magenta //#property indicator_color7 Gold //---- buffers string Sym[]={"GBPUSD","EURUSD","EURGBP"}; string pairs[14][3]={ "EURJPY","EURAUD","AUDJPY",//1 d "EURJPY","EURCHF","CHFJPY",//6 h, inv "EURJPY","EURGBP","GBPJPY",//12 inv "EURJPY","EURUSD","USDJPY",//14 "AUDJPY","AUDUSD","USDJPY",//2 d "EURUSD","EURAUD","AUDUSD",//3 d "EURUSD","EURGBP","GBPUSD",//13 "USDJPY","USDCHF","CHFJPY",//8 "GBPJPY","GBPCHF","CHFJPY",//7 inv "GBPJPY","GBPUSD","USDJPY",//14 "EURCAD","EURUSD","USDCAD",//9 inv "EURCHF","EURGBP","GBPCHF",//10 inv "EURCHF","EURUSD","USDCHF",//11 inv "GBPCHF","GBPUSD","USDCHF",//15 //"USDJPY","USDCAD","CADJPY",// inv //"EURJPY","EURCAD","CADJPY",//4 d }; double ExtMapBuffer1[]; double ExtMapBuffer2[]; double ExtMapBuffer3[]; double ExtMapBuffer4[]; double ExtMapBuffer5[]; double ExtMapBuffer6[]; //double ExtMapBuffer7[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,3); //SetIndexArrow(0,159); SetIndexBuffer(0,ExtMapBuffer1); SetIndexEmptyValue(0,0.0); SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,3); //SetIndexArrow(1,159); SetIndexBuffer(1,ExtMapBuffer2); SetIndexEmptyValue(1,0.0); SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,3); //SetIndexArrow(0,159); SetIndexBuffer(2,ExtMapBuffer3); SetIndexEmptyValue(2,0.0); SetIndexStyle(3,DRAW_LINE,STYLE_SOLID,3); //SetIndexArrow(1,159); SetIndexBuffer(3,ExtMapBuffer4); SetIndexEmptyValue(3,0.0); SetIndexStyle(4,DRAW_LINE,STYLE_SOLID,3); //SetIndexArrow(0,159); SetIndexBuffer(4,ExtMapBuffer5); SetIndexEmptyValue(4,0.0); SetIndexStyle(5,DRAW_LINE,STYLE_SOLID,3); //SetIndexArrow(1,159); SetIndexBuffer(5,ExtMapBuffer6); SetIndexEmptyValue(5,0.0); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int getrings(int& set[]){ int c; for(int i=0;i<14;i++){ for(int y=0;y<3;y++){ if(pairs[i][y]==Symbol()){ c++; ArrayResize(set,c); set[c-1]=i+1; //Print("rings in play = ",i); break; } } } return(c); } int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int getPos(int use){ use-=1; for(int i=0;i<3;i++){ if(Symbol()==pairs[use][i])return(i); } return(-1); } int start() { int counted_bars=IndicatorCounted(); //---- double get[]={0,100}; double fibs[3][2]; int use[]; getrings(use); // int z; // if(Symbol()=="EURUSD")z=EU; // if(Symbol()=="GBPUSD")z=GU; // if(Symbol()=="EURGBP")z=EG; //=ROUND(1/((1/B4)*B2),4) for(int p=0;p<3;p++){ if(use[p]<=0 || use[p]==EMPTY_VALUE)continue; int pos=getPos(use[p]); for(int i=0;i>","<>","<>"}; for(p=0;p<3;p++){ k=k+"\n"+col[p]; for(i =0;i<3;i++){ k=k+" "+pairs[use[p]-1][i]; } } //Comment(k); //---- return(0); } //+------------------------------------------------------------------+ int getFibs(double use[],double& set[][],datetime time,int ring){ ring-=1; int mode;int c; for(int e=0;e<3;e++){ if(TimeDayOfWeek(time)==1)int s=iBarShift(pairs[ring][e],1440,time-(60*60*24*3)); else s=iBarShift(pairs[ring][e],1440,time-(60*60*24)); double range=iHigh(pairs[ring][e],1440,s)-iLow(pairs[ring][e],1440,s); //Print(Sym[e]," ",range); if(iClose(pairs[ring][e],1440,s) < iOpen(pairs[ring][e],1440,s) ){ double startprice=iLow(pairs[ring][e],1440,s); mode=LOW; }else{ startprice=iHigh(pairs[ring][e],1440,s); mode=HIGH; } for(int i=0;i