I Calculated PivotPoint, Support1 and Resistance1 for EURUSD using other currencies, check this indicator and give a feedback
double dpp = (iHigh(NULL,PERIOD_D1,1)+iLow(NULL,PERIOD_D1,1)+iClose(NULL,PERIOD_D1,1))/3; double egpp = (iHigh("EURGBP",PERIOD_D1,1)+iLow("EURGBP",PERIOD_D1,1)+iClose("EURGBP",PERIOD_D1,1))/3;
you must handle 4066/4073 errors. See Download history in MQL4 EA - MQL4 and MetaTrader 4 - MQL4 programming forumObjectCreate(name,OBJ_HLINE,0,0,price);
Once you create an object they will never move, because you don't check. If moving the line fails, then create it.
whroeder1:
you must handle 4066/4073 errors. See Download history in MQL4 EA - MQL4 and MetaTrader 4 - MQL4 programming forum
you must handle 4066/4073 errors. See Download history in MQL4 EA - MQL4 and MetaTrader 4 - MQL4 programming forum
thank you, working on it
I've downladed all the history data, so I'm not facing any error
plus, lines weren't moving without the last line in the drawline function, but not they move , tested it in strategy testernew version
//+------------------------+ #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Black #property indicator_color2 Black //+------------------------+ extern int period=PERIOD_D1; extern bool boolPP=true; //extern bool boolSR1=true; //extern bool boolSR2=true; //+------------------------+ int shift; double temp; double pivots[11]; //+------------------------+ double pcup[],pcdn[]; //+------------------------------------------------------------------+ int OnInit() { //+------------------------+ Comment("Pivot Cluster"); //+------------------------+ SetIndexBuffer(0,pcup); SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1); SetIndexLabel(0,"UpCluster_"+period); SetIndexBuffer(1,pcdn); SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1); SetIndexLabel(1,"DnCluster_"+period); //+------------------------+ //+------------------------+ return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ int OnCalculate(const int rates_total,const int prev_calculated, const datetime &time[],const double &open[], const double &high[],const double &low[], const double &close[],const long &tick_volume[], const long &volume[],const int &spread[]) { //+------------------------+ int Counted_bars,i; Counted_bars=IndicatorCounted(); i=Bars-Counted_bars-1; while(i>=0) { //+------------------+ shift=iBarShift(Symbol(),period,Time[i],0)+1; if(boolPP==true) { temp=(iHigh(NULL,period,shift)+iLow(NULL,period,shift)+iClose(NULL,period,shift))/3; if(temp!=0)pivots[0]=temp; if(Symbol()=="EURUSD") { double egpp = (iHigh("EURGBP",period,shift)+iLow("EURGBP",period,shift)+iClose("EURGBP",period,shift))/3; double gupp = (iHigh("GBPUSD",period,shift)+iLow("GBPUSD",period,shift)+iClose("GBPUSD",period,shift))/3; if(egpp!=0 && gupp!=0) { pivots[1]=egpp*gupp; } double eapp = (iHigh("EURAUD",period,shift)+iLow("EURAUD",period,shift)+iClose("EURAUD",period,shift))/3; double aupp = (iHigh("AUDUSD",period,shift)+iLow("AUDUSD",period,shift)+iClose("AUDUSD",period,shift))/3; if(eapp!=0 && aupp!=0) { pivots[2]=eapp*aupp; } double enpp = (iHigh("EURNZD",period,shift)+iLow("EURNZD",period,shift)+iClose("EURNZD",period,shift))/3; double nupp = (iHigh("NZDUSD",period,shift)+iLow("NZDUSD",period,shift)+iClose("NZDUSD",period,shift))/3; if(enpp!=0 && nupp!=0) { pivots[3]=enpp*nupp; } double ejpp = (iHigh("EURJPY",period,shift)+iLow("EURJPY",period,shift)+iClose("EURJPY",period,shift))/3; double ujpp = (iHigh("USDJPY",period,shift)+iLow("USDJPY",period,shift)+iClose("USDJPY",period,shift))/3; if(ejpp!=0 && ujpp!=0) { pivots[4]=ejpp/ujpp; } double echpp = (iHigh("EURCHF",period,shift)+iLow("EURCHF",period,shift)+iClose("EURCHF",period,shift))/3; double uchpp = (iHigh("USDCHF",period,shift)+iLow("USDCHF",period,shift)+iClose("USDCHF",period,shift))/3; if(echpp!=0 && uchpp!=0) { pivots[5]=echpp/uchpp; } double ecdpp = (iHigh("EURCAD",period,shift)+iLow("EURCAD",period,shift)+iClose("EURCAD",period,shift))/3; double ucdpp = (iHigh("USDCAD",period,shift)+iLow("USDCAD",period,shift)+iClose("USDCAD",period,shift))/3; if(ecdpp!=0 && ucdpp!=0) { pivots[6]=ecdpp/ucdpp; } // double edkkpp = (iHigh("EURDKK",period,shift)+iLow("EURDKK",period,shift)+iClose("EURDKK",period,shift))/3; double udkkpp = (iHigh("USDDKK",period,shift)+iLow("USDDKK",period,shift)+iClose("USDDKK",period,shift))/3; if(edkkpp!=0 && udkkpp!=0) { pivots[7]=edkkpp/udkkpp; } double ehufpp = (iHigh("EURHUF",period,shift)+iLow("EURHUF",period,shift)+iClose("EURHUF",period,shift))/3; double uhufpp = (iHigh("USDHUF",period,shift)+iLow("USDHUF",period,shift)+iClose("USDHUF",period,shift))/3; if(ehufpp!=0 && uhufpp!=0) { pivots[8]=ehufpp/uhufpp; } double esekpp = (iHigh("EURSEK",period,shift)+iLow("EURSEK",period,shift)+iClose("EURSEK",period,shift))/3; double usekpp = (iHigh("USDSEK",period,shift)+iLow("USDSEK",period,shift)+iClose("USDSEK",period,shift))/3; if(esekpp!=0 && usekpp!=0) { pivots[9]=esekpp/usekpp; } double enokpp = (iHigh("EURNOK",period,shift)+iLow("EURNOK",period,shift)+iClose("EURNOK",period,shift))/3; double unokpp = (iHigh("USDNOK",period,shift)+iLow("USDNOK",period,shift)+iClose("USDNOK",period,shift))/3; if(enokpp!=0 && unokpp!=0) { pivots[10]=enokpp/unokpp; } // } //+------------------+ ArraySort(pivots); pcup[i]=pivots[10]; pcdn[i]=pivots[0]; //+------------------+ } i--; }//end while //+------------------------+ return(rates_total); } //+------------------------------------------------------------------+
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello MQL
please give a feedback on this Indicator
it calc pivot point and R1 and S1 using the standard method and this method
this method is simple math : EURGBP*GBPUSD=EURUSD , EURJPY/USDJPY=EURUSD ...