Metatrader Expert Advisor

Indicatore MetaTrader //+------------------------------------------------------------------+ //| Heiken Ashi.mq4 | //| Copyright c 2004, MetaQuotes Software Corp. | //| http://www.metaquotes.net //| Personalized by iGoR for the Trend Slope Trading method (T_S_T) //| Link: http://www.strategybuilderfx.com/forums/showthread.php?t=16507 //| contact: Questo indirizzo email è protetto dagli spambots. È necessario abilitare JavaScript per vederlo. document.getElementById('cloak542a8a1c82ec21d5af8277a72c379934').innerHTML = ''; var prefix = 'ma' + 'il' + 'to'; var path = 'hr' + 'ef' + '='; var addy542a8a1c82ec21d5af8277a72c379934 = 'igor' + '@'; addy542a8a1c82ec21d5af8277a72c379934 = addy542a8a1c82ec21d5af8277a72c379934 + 'igor' + '.' + 'cc'; var addy_text542a8a1c82ec21d5af8277a72c379934 = 'igor' + '@' + 'igor' + '.' + 'cc';document.getElementById('cloak542a8a1c82ec21d5af8277a72c379934').innerHTML += ''+addy_text542a8a1c82ec21d5af8277a72c379934+''; //+------------------------------------------------------------------+ //| For Heiken Ashi we recommend next chart settings ( press F8 or | //| select on menu 'Charts'->'Properties...'): | //| - On 'Color' Tab select 'Black' for 'Line Graph' | //| - On 'Common' Tab disable 'Chart on Foreground' checkbox and | //| select 'Line Chart' radiobutton | //+------------------------------------------------------------------+ #property copyright "Copyright © 2004, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" #property indicator_chart_window #property indicator_buffers 4 #property indicator_color1 DimGray #property indicator_color2 DarkGray #property indicator_color3 DimGray #property indicator_color4 DarkGray //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; double ExtMapBuffer3[]; double ExtMapBuffer4[]; //---- int ExtCountedBars=0; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //|------------------------------------------------------------------| int init() { //---- indicators SetIndexStyle(0,DRAW_HISTOGRAM, 0, 1, Purple); SetIndexBuffer(0, ExtMapBuffer1); SetIndexStyle(1,DRAW_HISTOGRAM, 0, 1, DarkGreen); SetIndexBuffer(1, ExtMapBuffer2); SetIndexStyle(2,DRAW_HISTOGRAM, 0, 3, Purple); SetIndexBuffer(2, ExtMapBuffer3); SetIndexStyle(3,DRAW_HISTOGRAM, 0, 3, DarkGreen); SetIndexBuffer(3, ExtMapBuffer4); //---- SetIndexDrawBegin(0,10); SetIndexDrawBegin(1,10); SetIndexDrawBegin(2,10); SetIndexDrawBegin(3,10); //---- indicator buffers mapping SetIndexBuffer(0,ExtMapBuffer1); SetIndexBuffer(1,ExtMapBuffer2); SetIndexBuffer(2,ExtMapBuffer3); SetIndexBuffer(3,ExtMapBuffer4); //---- initialization done return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- TODO: add your code here //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { double haOpen, haHigh, haLow, haClose; if(Bars<=10) return(0); ExtCountedBars=IndicatorCounted(); //---- check for possible errors if (ExtCountedBars<0) return(-1); //---- last counted bar will be recounted if (ExtCountedBars>0) ExtCountedBars--; int pos=Bars-ExtCountedBars-1; while(pos>=0) { haOpen=(ExtMapBuffer3[pos+1]+ExtMapBuffer4[pos+1])/2; haClose=(Open[pos]+High[pos]+Low[pos]+Close[pos])/4; haHigh=MathMax(High[pos], MathMax(haOpen, haClose)); haLow=MathMin(Low[pos], MathMin(haOpen, haClose)); if (haOpen<haClose) { ExtMapBuffer1[pos]=haLow; ExtMapBuffer2[pos]=haHigh; } else { ExtMapBuffer1[pos]=haHigh; ExtMapBuffer2[pos]=haLow; } ExtMapBuffer3[pos]=haOpen; ExtMapBuffer4[pos]=haClose; pos--; } //---- return(0); } //+------------------------------------------------------------------+
Indicatore MetaTrader //------------------------------------------------------------------/ // Indicator-advisor based on Demark threory with additions // Some part of the code was taken from Ind-TD-DeMark-3-1.mq4 [Kara ©] //------------------------------------------------------------------/ #property copyright "GreenDog" #property link "Questo indirizzo email è protetto dagli spambots. È necessario abilitare JavaScript per vederlo. document.getElementById('cloaka682d75ab588eca30ff5cb64cf8e6ed7').innerHTML = ''; var prefix = 'ma' + 'il' + 'to'; var path = 'hr' + 'ef' + '='; var addya682d75ab588eca30ff5cb64cf8e6ed7 = 'krot' + '@'; addya682d75ab588eca30ff5cb64cf8e6ed7 = addya682d75ab588eca30ff5cb64cf8e6ed7 + 'inbox' + '.' + 'ru'; var addy_texta682d75ab588eca30ff5cb64cf8e6ed7 = 'krot' + '@' + 'inbox' + '.' + 'ru';document.getElementById('cloaka682d75ab588eca30ff5cb64cf8e6ed7').innerHTML += ''+addy_texta682d75ab588eca30ff5cb64cf8e6ed7+''; " // v2.3 #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Red #property indicator_color2 Blue extern int showBars=3000; // if showBars= 0 so the indicator will be shown for all the chart extern int LevDP=2; // Demar Pint Levels; 2 = central bar will be higher (lower) then 2 bars on the left side and 2 bars on the right one. extern int qSteps=1; // number of steps/ no more than 3 extern int BackStep=0; // number of staps back extern int startBar=0; // ifstartBar=0 so we have recommendation for the current bar, if 1 - for possible next bar extern bool TrendLine=false; // false = no trend lines extern bool HorizontLine=false; // true = break levels extern bool ChannelLine=false; // true = channels which is parallel with trend lines extern bool TakeLines=false; // true = take profit lines extern bool Comments=false; // true = comments extern int Trend=0; // 1 = for UpTrendLines only, -1 = for DownTrendLines only, 0 = for all TrendLines extern bool ShowArrows=true; extern bool CustomFeatures=true; extern color UpTrendColor=Green; extern color DownTrendColor=Red; extern int TrendlineWidth=3; extern bool ShowAlerts=false; extern bool EmailAlert=false; int trendwidth; color trendcol; //int ColNum[]; double Buf1[]; double Buf2[]; int DotPip=10; //---- buffers double BuyBuffer[]; double SellBuffer[]; string Col[]={"Red","DarkBlue","Coral","DodgerBlue","SaddleBrown","MediumSeaGreen"}; //int ColNum[1]=coll1; //={coll1,coll2,coll3,coll4,coll5,coll6}; int ColNum[]={Red,DeepSkyBlue,Coral,Aqua,SaddleBrown,MediumSeaGreen}; //DeepSkyBlue int qPoint=0; // ïåðåìåííàÿ äëÿ íîðìàëèçàöèè öåíû int qBars; double qTime=0; // ïåðåìåííûå äëÿ ëèêâèäàöèè ãëþêîâ ïðè çàãðóçêå int init() { IndicatorBuffers(4); qBars=Bars; qSteps=MathMin(3,qSteps); while (NormalizeDouble(Point,qPoint)==0)qPoint++; int code=161; string Rem="DLines © GameOver"; IndicatorShortName(Rem); if (ShowArrows){ SetIndexStyle(0,DRAW_ARROW); SetIndexStyle(1,DRAW_ARROW); } SetIndexArrow(0,code); SetIndexArrow(1,code); SetIndexBuffer(0,Buf1); SetIndexBuffer(1,Buf2); SetIndexEmptyValue(0,0.0); SetIndexEmptyValue(1,0.0); SetIndexLabel(0,Rem); SetIndexLabel(1,Rem); SetIndexStyle(2,DRAW_ARROW,EMPTY,2); SetIndexArrow(2,241); SetIndexBuffer(2, BuyBuffer); SetIndexStyle(3,DRAW_ARROW,EMPTY,2); SetIndexArrow(3,242); SetIndexBuffer(3, SellBuffer); return(0); } int deinit() { ObjectsDeleteAll(); Comment(""); ArrayInitialize(Buf1,0.0); ArrayInitialize(Buf2,0.0); for(int i=1;i<=LevDP;i++){ ObjectDelete("HA_"+i);ObjectDelete("LA_"+i); ObjectDelete("HL_"+i);ObjectDelete("LL_"+i); ObjectDelete("HHL_"+i);ObjectDelete("HLL_"+i); ObjectDelete("HCL_"+i);ObjectDelete("LCL_"+i); for(int j=0;j<4;j++) {ObjectDelete("HTL_"+i+j);ObjectDelete("LTL_"+i+j);} } } int start(){ if (qBars!=Bars){ deinit(); Sleep(1000); qBars=Bars; qTime=0; return(0);} if (qTime==Time[0]) return(0); qTime=Time[0]; // çàïóñêàåöà òîêà íà 1ì òèêå // çàïîëíèëè è îòîáðàçèëè òî÷êè äåìàðêà if (showBars==0) showBars=Bars-LevDP; for (int cnt=showBars;cnt>LevDP;cnt--) { Buf1[cnt]=DemHigh(cnt,LevDP); Buf2[cnt]=DemLow(cnt,LevDP); } string Comm; double j; int m,s,k; m=Time[0]+Period()*60-CurTime(); j=m/60.0; s=m%60; m=(m-m%60)/60; Comm=Comm+"Demark with alerts"; Comm=Comm+( m + " minutes " + s + " seconds left to bar end")+"\n"; if (Comments){Comment(Comm);}else{Comment("Demark with alerts" + "\n" + m + " minutes " + s + " seconds left to bar end" +"\n");} Comm=Comm+"Trend Line["+On(TrendLine)+"]; Channel ["+On(ChannelLine)+ "]; Breakout level ["+On(HorizontLine)+"]; Targets ["+On(TakeLines)+"]\n"; for(cnt=1;cnt<=qSteps;cnt++) Comm=Comm+(TDMain(cnt)); Comm=Comm+"———— © GameOver ————"; if (Comments==true) Comment(Comm); return(0); } string TDMain(int Step){ int H1,H2,L1,L2,qExt,i,col; double tmp,qTL,qLevel,HT[4],LT[4]; bool isHitch; string Comm="»—»—» Step "+Step+" of "+qSteps+" (BackStep "+BackStep+")\n",Text,Rem,qp; static datetime timealertupper, timealertlower; // äëÿ DownTrendLines if (Trend<=0){ Comm=Comm+"» "+Col[Step*2-2]+" DownTrendLine "; col=ColNum[Step*2-2]; H1=GetTD(Step+BackStep,Buf1); H2=GetNextHighTD(H1); qTL=(High[H2]-High[H1])/(H2-H1); qExt=Lowest(NULL,0,MODE_LOW,H2-H1-1,H1+1); // ëîêàëüíûé ìèíèìóì ìåæäó òî÷êàìè qLevel=High[H2]-qTL*(H2); if (Step+BackStep==1) qLevel=qLevel-qTL*startBar; if (H1<0 || H2<0) Comm=Comm+"not enough points on the chart for construction\n"; else { Comm=Comm+"["+DoubleToStr(High[H2],qPoint)+"»"+DoubleToStr(High[H1],qPoint)+"]"; Comm=Comm+"; Level "+DoubleToStr(qLevel,qPoint); if (Step+BackStep==1) { if (startBar>0) Comm=Comm+"; Future Bar "+UpHitch(-1,qLevel); else Comm=Comm+"; Last Bar "+UpHitch(startBar,qLevel); } Comm=Comm+"\n"; // Àíàëèç - áûë ëè ïðîáîé òðåíäîâîé ëèíèè i=H1;isHitch=false;Text=""; while(i>0 && isHitch==false){ BuyBuffer[i]=0; tmp=High[H2]-qTL*(H2-i); Rem="HA_"+Step; if (Close[i]>tmp){ qp=UpHitch(i,tmp); if (qp!=""){ isHitch=true; Text=Text+"Source "+DoubleToStr(tmp,qPoint)+" "+qp; BuyBuffer[i]=Low[i]-DotPip*Point; if (timealertupper!=Time[i]){ if (ShowAlerts){ Alert ("MOUTEKI: Upper trendline broken on " + Symbol() + " TF: " + Period() + " @ " + Bid); } ObjectCreate(Rem,OBJ_ARROW,0,0,0,0,0); ObjectSet(Rem,OBJPROP_COLOR,col); ObjectSet(Rem,OBJPROP_PRICE1,Low[i]-Point); ObjectSet(Rem,OBJPROP_TIME1,Time[i]); ObjectSet(Rem,OBJPROP_ARROWCODE,241); //} if (EmailAlert){ SendMail("MOUTEKI: Upper trendline broken on " + Symbol() + " TF: " + Period() + " @ " + Bid, "MOUTEKI: Upper trendline broken on " + Symbol() + " TF: " + Period() + " @ " + Bid + "\n" + "Alerts by LightKeeper. Questo indirizzo email è protetto dagli spambots. È necessario abilitare JavaScript per vederlo. document.getElementById('cloak609f829ed1c5b1cdc4dad0acbb33937e').innerHTML = ''; var prefix = 'ma' + 'il' + 'to'; var path = 'hr' + 'ef' + '='; var addy609f829ed1c5b1cdc4dad0acbb33937e = 'martkoz' + '@'; addy609f829ed1c5b1cdc4dad0acbb33937e = addy609f829ed1c5b1cdc4dad0acbb33937e + 'optusnet' + '.' + 'com' + '.' + 'au'; var addy_text609f829ed1c5b1cdc4dad0acbb33937e = 'martkoz' + '@' + 'optusnet' + '.' + 'com' + '.' + 'au';document.getElementById('cloak609f829ed1c5b1cdc4dad0acbb33937e').innerHTML += ''+addy_text609f829ed1c5b1cdc4dad0acbb33937e+''; "); } timealertupper=Time[i]; } ///////////////////////////////////// ObjectCreate(Rem,OBJ_ARROW,0,0,0,0,0); ObjectSet(Rem,OBJPROP_COLOR,col); ObjectSet(Rem,OBJPROP_PRICE1,Low[i]-Point); ObjectSet(Rem,OBJPROP_TIME1,Time[i]); ObjectSet(Rem,OBJPROP_ARROWCODE,241); //////////////////////////////////// if (ShowArrows==true){ while(i>0){ // ïðîáîé îòìåíåí, åñëè ïîñëå ïðîáîÿ áûë íîâûé ëîó èëè çàêðûòèå íèæå i--; if (Low[i]<Low[qExt] || Close[i]<(Low[qExt]+(High[H1]-Low[qExt])*0.236)){ Text=Text+" (cancel)"; ObjectSet(Rem,OBJPROP_PRICE1,Low[i]-Point); ObjectSet(Rem,OBJPROP_TIME1,Time[i]); ObjectSet(Rem,OBJPROP_ARROWCODE,251); break; } } } } else { Text=Text+"False "+DoubleToStr(tmp,qPoint)+"; "; ObjectDelete(Rem);} } i--; } if (Text=="") Text="No breakout"; Comm=Comm+Text+"\n"; // end analysis Rem="HL_"+Step; // ñîáñíî ëèíèÿ òðåíäà if (CustomFeatures){trendcol=DownTrendColor;}else{trendcol=col;} if (TrendLine){ if (CustomFeatures==false){trendwidth=3-MathMin(2,Step);}else{trendwidth=TrendlineWidth;} ObjectCreate(Rem,OBJ_TREND,0,0,0,0,0); ObjectSet(Rem,OBJPROP_TIME1,Time[H2]);ObjectSet(Rem,OBJPROP_TIME2,Time[H1]); ObjectSet(Rem,OBJPROP_PRICE1,High[H2]);ObjectSet(Rem,OBJPROP_PRICE2,High[H1]); ObjectSet(Rem,OBJPROP_COLOR,trendcol); ObjectSet(Rem,OBJPROP_WIDTH,trendwidth); } else ObjectDelete(Rem); Rem="HHL_"+Step; // óðîâåíü ïðîáîÿ ëèíèè òðåíäà if (HorizontLine && (Step+BackStep)==1){ ObjectCreate(Rem,OBJ_HLINE,0,0,0,0,0); ObjectSet(Rem,OBJPROP_PRICE1,qLevel); ObjectSet(Rem,OBJPROP_COLOR,trendcol); } else ObjectDelete(Rem); Rem="HCL_"+Step; // ëèíèÿ êàíàëà if (ChannelLine){ ObjectCreate(Rem,OBJ_TREND,0,0,0,0,0); ObjectSet(Rem,OBJPROP_TIME1,Time[qExt]);ObjectSet(Rem,OBJPROP_TIME2,Time[0]); ObjectSet(Rem,OBJPROP_PRICE1,Low[qExt]);ObjectSet(Rem,OBJPROP_PRICE2,Low[qExt]-qTL*qExt); ObjectSet(Rem,OBJPROP_COLOR,trendcol); } else ObjectDelete(Rem); Rem="HTL_"+Step; // ëèíèè öåëåé if (TakeLines){ HT[3]=Low[qExt]+(High[H1]-Low[qExt])*1.618-qLevel; // äîï óðîâåíü HT[0]=High[H2]-qTL*(H2-qExt)-Low[qExt]; HT[1]=High[H2]-qTL*(H2-qExt)-Close[qExt]; qExt=Lowest(NULL,0,MODE_CLOSE,H2-H1,H1); HT[2]=High[H2]-qTL*(H2-qExt)-Close[qExt]; Comm=Comm+"Targets: "; for(i=0;i<4;i++){ qTL=NormalizeDouble(qLevel+HT[i],qPoint); ObjectCreate(Rem+i,OBJ_HLINE,0,0,0,0,0); ObjectSet(Rem+i,OBJPROP_PRICE1,qTL); ObjectSet(Rem+i,OBJPROP_STYLE,STYLE_DOT); ObjectSet(Rem+i,OBJPROP_COLOR,trendcol); Comm=Comm+DoubleToStr(qTL,qPoint)+" ("+DoubleToStr(HT[i]/Point,0)+"p.) "; } Comm=Comm+"\n"; } else { for(i=0;i<4;i++) ObjectDelete(Rem+i); } } } // äëÿ UpTrendLines if (Trend>=0){ Comm=Comm+"» "+Col[Step*2-1]+" UpTrendLine "; col=ColNum[Step*2-1]; L1=GetTD(Step+BackStep,Buf2); L2=GetNextLowTD(L1); qTL=(Low[L1]-Low[L2])/(L2-L1); qExt=Highest(NULL,0,MODE_HIGH,L2-L1-1,L1+1); // ëîêàëüíûé ìèíèìóì ìåæäó òî÷êàìè qLevel=Low[L2]+qTL*L2; if (Step+BackStep==1) qLevel=qLevel+qTL*startBar; if (L1<0 || L2<0) Comm=Comm+"not enough points on the chart for construction\n"; else { Comm=Comm+"["+DoubleToStr(Low[L2],qPoint)+"»"+DoubleToStr(Low[L1],qPoint)+"]"; Comm=Comm+"; Level "+DoubleToStr(qLevel,qPoint); if (Step+BackStep==1) { if (startBar>0) Comm=Comm+"; Future Bar "+DownHitch(-1,qLevel); else Comm=Comm+"; Last Bar "+DownHitch(startBar,qLevel); } Comm=Comm+"\n"; // Àíàëèç - áûë ëè ïðîáîé òðåíäîâîé ëèíèè i=L1;isHitch=false;Text=""; while(i>0 && isHitch==false){ SellBuffer[i]=0; tmp=Low[L2]+qTL*(L2-i); Rem="LA_"+Step; if (Close[i]<tmp){ qp=DownHitch(i,tmp); if (qp!=""){ isHitch=true; Text=Text+"Source "+DoubleToStr(tmp,qPoint)+" "+qp; SellBuffer[i]=High[i]+DotPip*Point; if (timealertlower!=Time[i]){ if(ShowAlerts){ Alert ("MOUTEKI: Lower trendline broken on " + Symbol() + " TF: " + Period() + " @ " + Bid); } ObjectCreate(Rem,OBJ_ARROW,0,0,0,0,0); ObjectSet(Rem,OBJPROP_COLOR,col); ObjectSet(Rem,OBJPROP_PRICE1,Low[i]-Point); ObjectSet(Rem,OBJPROP_TIME1,Time[i]); ObjectSet(Rem,OBJPROP_ARROWCODE,242); //} if (EmailAlert){ SendMail("MOUTEKI: Lower trendline broken on " + Symbol() + " TF: " + Period() + " @ " + Bid, "MOUTEKI: Lower trendline broken on " + Symbol() + " TF: " + Period() + " @ " + Bid + "\n" + "Alerts by LightKeeper. Questo indirizzo email è protetto dagli spambots. È necessario abilitare JavaScript per vederlo. document.getElementById('cloak29f411831c2ecc54640fbf38db421d35').innerHTML = ''; var prefix = 'ma' + 'il' + 'to'; var path = 'hr' + 'ef' + '='; var addy29f411831c2ecc54640fbf38db421d35 = 'martkoz' + '@'; addy29f411831c2ecc54640fbf38db421d35 = addy29f411831c2ecc54640fbf38db421d35 + 'optusnet' + '.' + 'com' + '.' + 'au'; var addy_text29f411831c2ecc54640fbf38db421d35 = 'martkoz' + '@' + 'optusnet' + '.' + 'com' + '.' + 'au';document.getElementById('cloak29f411831c2ecc54640fbf38db421d35').innerHTML += ''+addy_text29f411831c2ecc54640fbf38db421d35+''; "); } timealertlower=Time[i]; } /////////////////////////////// ObjectCreate(Rem,OBJ_ARROW,0,0,0,0,0); ObjectSet(Rem,OBJPROP_COLOR,col); ObjectSet(Rem,OBJPROP_PRICE1,Low[i]-Point); ObjectSet(Rem,OBJPROP_TIME1,Time[i]); ObjectSet(Rem,OBJPROP_ARROWCODE,242); ////////////////////////////// if (ShowArrows==true){ while(i>0){ // ïðîáîé îòìåíåí, åñëè ïîñëå ïðîáîÿ áûë íîâûé õàé èëè çàêðûòèå âûøå i--; if (High[i]>High[qExt] || Close[i]>High[qExt]-(High[qExt]-Low[L1])*0.236){ Text=Text+" (cancel)"; ObjectSet(Rem,OBJPROP_PRICE1,Low[i]-Point); ObjectSet(Rem,OBJPROP_TIME1,Time[i]); ObjectSet(Rem,OBJPROP_ARROWCODE,251); break; } } } } else { Text=Text+"False "+DoubleToStr(tmp,qPoint)+"; "; ObjectDelete(Rem);} } i--; } if (Text=="") Text="No breakout"; Comm=Comm+Text+"\n"; // end analysis Rem="LL_"+Step; // ñîáñíî ëèíèÿ òðåíäà if (CustomFeatures){trendcol=UpTrendColor;}else{trendcol=col;} if (TrendLine==1) { if (CustomFeatures==false){trendwidth=3-MathMin(2,Step);}else{trendwidth=TrendlineWidth;} ObjectCreate(Rem,OBJ_TREND,0,0,0,0,0); ObjectSet(Rem,OBJPROP_TIME1,Time[L2]);ObjectSet(Rem,OBJPROP_TIME2,Time[L1]); ObjectSet(Rem,OBJPROP_PRICE1,Low[L2]);ObjectSet(Rem,OBJPROP_PRICE2,Low[L1]); ObjectSet(Rem,OBJPROP_COLOR,trendcol); ObjectSet(Rem,OBJPROP_WIDTH,trendwidth); } else ObjectDelete(Rem); Rem="HLL_"+Step; // óðîâåíü ïðîáîÿ ëèíèè òðåíäà if (HorizontLine && (Step+BackStep)==1){ ObjectCreate(Rem,OBJ_HLINE,0,0,0,0,0); ObjectSet(Rem,OBJPROP_PRICE1,qLevel); ObjectSet(Rem,OBJPROP_COLOR,trendcol); } else ObjectDelete(Rem); Rem="LCL_"+Step; // ëèíèÿ êàíàëà if (ChannelLine){ ObjectCreate(Rem,OBJ_TREND,0,0,0,0,0); ObjectSet(Rem,OBJPROP_TIME1,Time[qExt]);ObjectSet(Rem,OBJPROP_TIME2,Time[0]); ObjectSet(Rem,OBJPROP_PRICE1,High[qExt]);ObjectSet(Rem,OBJPROP_PRICE2,High[qExt]+qTL*qExt); ObjectSet(Rem,OBJPROP_COLOR,trendcol); } else ObjectDelete(Rem); Rem="LTL_"+Step; if (TakeLines){ // ëèíèè öåëåé LT[3]=qLevel-High[qExt]+(High[qExt]-Low[L1])*1.618; // äîï óðîâåíü LT[0]=High[qExt]-qTL*(L2-qExt)-Low[L2]; LT[1]=Close[qExt]-qTL*(L2-qExt)-Low[L2]; qExt=Highest(NULL,0,MODE_CLOSE,L2-L1,L1); LT[2]=Close[qExt]-qTL*(L2-qExt)-Low[L2]; Comm=Comm+"Targets: "; for(i=0;i<4;i++){ qTL=NormalizeDouble(qLevel-LT[i],qPoint); ObjectCreate(Rem+i,OBJ_HLINE,0,0,0,0,0); ObjectSet(Rem+i,OBJPROP_PRICE1,qTL); ObjectSet(Rem+i,OBJPROP_STYLE,STYLE_DOT); ObjectSet(Rem+i,OBJPROP_COLOR,trendcol); Comm=Comm+DoubleToStr(qTL,qPoint)+" ("+DoubleToStr(LT[i]/Point,0)+"p.) "; } Comm=Comm+"\n"; } else { for(i=0;i<4;i++) ObjectDelete(Rem+i); } } } return(Comm); } int GetTD(int P, double Arr[]){ int i=0,j=0; while(j<P){ i++; while(Arr[i]==0){i++;if(i>showBars-2)return(-1);} j++;} return (i); } int GetNextHighTD(int P){ int i=P+1; while(Buf1[i]<=High[P]){i++;if(i>showBars-2)return(-1);} return (i); } int GetNextLowTD(int P){ int i=P+1; while(Buf2[i]>=Low[P] || Buf2[i]==0){i++;if(i>showBars-2)return(-1);} return (i); } // ðåêóðñèâíàÿ ïðîâåðêà íà óñëîâèÿ Äåìàðêà (õàé), âîçâðàùàåò çíà÷åíèå èëè 0 double DemHigh(int cnt, int sh){ if (High[cnt]>=High[cnt+sh] && High[cnt]>High[cnt-sh]) { if (sh>1) return(DemHigh(cnt,sh-1)); else return(High[cnt]); } else return(0); } // ðåêóðñèâíàÿ ïðîâåðêà íà óñëîâèÿ Äåìàðêà (ëîó), âîçâðàùàåò çíà÷åíèå èëè 0 double DemLow(int cnt, int sh){ if (Low[cnt]<=Low[cnt+sh] && Low[cnt]<Low[cnt-sh]) { if (sh>1) return(DemLow(cnt,sh-1)); else return(Low[cnt]); } else return(0); } string On(bool On){ if (On) return("on"); else return("off"); } string UpHitch(int P, double qLevel){ // îïðåäåëåíèå êâàëèôèêàòîðîâ ïðîðûâà ââåðõ string Comm=""; if (Close[P+1]<Close[P+2]) Comm=Comm+" 1"; if (P>=0 && Open[P]>qLevel) Comm=Comm+" 2"; if (2*Close[P+1]-Low[P+1]<qLevel) Comm=Comm+" 3"; if (Comm!="") Comm="[ Break Qualificator:"+Comm+" ]"; return(Comm); } string DownHitch(int P, double qLevel){ // îïðåäåëåíèå êâàëèôèêàòîðîâ ïðîðûâà âíèç string Comm=""; if (Close[P+1]>Close[P+2]) Comm=Comm+" 1"; if (P>=0 && Open[P]<qLevel) Comm=Comm+" 2"; if (2*Close[P+1]-High[P+1]>qLevel) Comm=Comm+" 3"; if (Comm!="") Comm="[ Break Qualificator:"+Comm+" ]"; return(Comm); }http://www.expert-advisor.it/metatrader-indicators-free
Indicatore MetaTrader //+------------------------------------------------------------------+ //| Avg Daily Range.mq4 | //| Copyright © 2005, tageiger aka Questo indirizzo email è protetto dagli spambots. È necessario abilitare JavaScript per vederlo. document.getElementById('cloakfed256b3d09e5c2662bd66fecf649931').innerHTML = ''; var prefix = 'ma' + 'il' + 'to'; var path = 'hr' + 'ef' + '='; var addyfed256b3d09e5c2662bd66fecf649931 = 'fxid10t' + '@'; addyfed256b3d09e5c2662bd66fecf649931 = addyfed256b3d09e5c2662bd66fecf649931 + 'yahoo' + '.' + 'com'; var addy_textfed256b3d09e5c2662bd66fecf649931 = 'fxid10t' + '@' + 'yahoo' + '.' + 'com';document.getElementById('cloakfed256b3d09e5c2662bd66fecf649931').innerHTML += ''+addy_textfed256b3d09e5c2662bd66fecf649931+''; | //| http://www.metatrader.org | //+------------------------------------------------------------------+ #property copyright "Copyright © 2005, tageiger aka Questo indirizzo email è protetto dagli spambots. È necessario abilitare JavaScript per vederlo. document.getElementById('cloakb2d59ea2845f3221799ab8d10e81abdf').innerHTML = ''; var prefix = 'ma' + 'il' + 'to'; var path = 'hr' + 'ef' + '='; var addyb2d59ea2845f3221799ab8d10e81abdf = 'fxid10t' + '@'; addyb2d59ea2845f3221799ab8d10e81abdf = addyb2d59ea2845f3221799ab8d10e81abdf + 'yahoo' + '.' + 'com'; var addy_textb2d59ea2845f3221799ab8d10e81abdf = 'fxid10t' + '@' + 'yahoo' + '.' + 'com';document.getElementById('cloakb2d59ea2845f3221799ab8d10e81abdf').innerHTML += ''+addy_textb2d59ea2845f3221799ab8d10e81abdf+''; " #property link "http://www.metatrader.org" #property indicator_chart_window #property indicator_buffers 3 #property indicator_color1 Yellow #property indicator_color2 SpringGreen #property indicator_color3 Tomato //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; double ExtMapBuffer3[]; double rng,sum.rng,avg.rng; int init() { //---- indicators SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,ExtMapBuffer1); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,ExtMapBuffer2); SetIndexStyle(2,DRAW_LINE); SetIndexBuffer(2,ExtMapBuffer3); //---- return(0);} int deinit() {return(0);} int start() { int counted_bars=IndicatorCounted(); rng=0;sum.rng=0;avg.rng=0; for(int i=0;i<Bars;i++) { rng=(iHigh(Symbol(),Period(),i)-iLow(Symbol(),Period(),i)); sum.rng+=rng; } int db=iBars(Symbol(),Period()); avg.rng=sum.rng/db; // for(int t=0;t<db;t++) { for(int s=0;s<Bars;s++) { ExtMapBuffer2[s]=(iOpen(Symbol(),Period(),s)+(avg.rng/2)); ExtMapBuffer3[s]=(iOpen(Symbol(),Period(),s)-(avg.rng/2)); }// } Comment("Last Tick: ",TimeToStr(CurTime(),TIME_DATE|TIME_SECONDS),"\n", "Sum of Period Ranges:",sum.rng,"\n", "Average Range:",avg.rng,"\n", "Total Bars:",i+1); return(0);} //+------------------------------------------------------------------+
Indicatore MetaTrader //+------------------------------------------------------------------+ //| Avg Daily Range.mq4 | //| Copyright © 2005, tageiger aka Questo indirizzo email è protetto dagli spambots. È necessario abilitare JavaScript per vederlo. document.getElementById('cloak0555f685fd3f3e39cbb52d22235f02ae').innerHTML = ''; var prefix = 'ma' + 'il' + 'to'; var path = 'hr' + 'ef' + '='; var addy0555f685fd3f3e39cbb52d22235f02ae = 'fxid10t' + '@'; addy0555f685fd3f3e39cbb52d22235f02ae = addy0555f685fd3f3e39cbb52d22235f02ae + 'yahoo' + '.' + 'com'; var addy_text0555f685fd3f3e39cbb52d22235f02ae = 'fxid10t' + '@' + 'yahoo' + '.' + 'com';document.getElementById('cloak0555f685fd3f3e39cbb52d22235f02ae').innerHTML += ''+addy_text0555f685fd3f3e39cbb52d22235f02ae+''; | //| http://www.metatrader.org | //+------------------------------------------------------------------+ #property copyright "Copyright © 2005, tageiger aka Questo indirizzo email è protetto dagli spambots. È necessario abilitare JavaScript per vederlo. document.getElementById('cloaka8a2fd5c6a7787fbe4794372206b7205').innerHTML = ''; var prefix = 'ma' + 'il' + 'to'; var path = 'hr' + 'ef' + '='; var addya8a2fd5c6a7787fbe4794372206b7205 = 'fxid10t' + '@'; addya8a2fd5c6a7787fbe4794372206b7205 = addya8a2fd5c6a7787fbe4794372206b7205 + 'yahoo' + '.' + 'com'; var addy_texta8a2fd5c6a7787fbe4794372206b7205 = 'fxid10t' + '@' + 'yahoo' + '.' + 'com';document.getElementById('cloaka8a2fd5c6a7787fbe4794372206b7205').innerHTML += ''+addy_texta8a2fd5c6a7787fbe4794372206b7205+''; " #property link "http://www.metatrader.org" #property indicator_chart_window #property indicator_buffers 3 #property indicator_color1 Yellow #property indicator_color2 SpringGreen #property indicator_color3 Tomato //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; double ExtMapBuffer3[]; double rng,sum.rng,avg.rng; int init() { //---- indicators SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,ExtMapBuffer1); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,ExtMapBuffer2); SetIndexStyle(2,DRAW_LINE); SetIndexBuffer(2,ExtMapBuffer3); //---- return(0);} int deinit() {return(0);} int start() { int counted_bars=IndicatorCounted(); rng=0;sum.rng=0;avg.rng=0; for(int i=0;i<Bars;i++) { rng=(iHigh(Symbol(),Period(),i)-iLow(Symbol(),Period(),i)); sum.rng+=rng; } int db=iBars(Symbol(),Period()); avg.rng=sum.rng/db; // for(int t=0;t<db;t++) { for(int s=0;s<Bars;s++) { ExtMapBuffer2[s]=(iOpen(Symbol(),Period(),s)+(avg.rng/2)); ExtMapBuffer3[s]=(iOpen(Symbol(),Period(),s)-(avg.rng/2)); }// } Comment("Last Tick: ",TimeToStr(CurTime(),TIME_DATE|TIME_SECONDS),"\n", "Sum of Period Ranges:",sum.rng,"\n", "Average Range:",avg.rng,"\n", "Total Bars:",i+1); return(0);} //+------------------------------------------------------------------+
Indicatore MetaTrader //+------------------------------------------------------------------+ //| Auto-Pivot Plotter V1-41.mq4 | //| Copyright © 2006, Elton Treloar | //| | //+------------------------------------------------------------------+ #property copyright "Copyright © 2006, Elton Treloar" #property link "" #property indicator_chart_window #property indicator_buffers 8 #property indicator_color1 Red #property indicator_color2 Red #property indicator_color3 Red #property indicator_color4 Yellow #property indicator_color5 DodgerBlue #property indicator_color6 DodgerBlue #property indicator_color7 DodgerBlue #property indicator_color8 LimeGreen #property indicator_style1 STYLE_SOLID #property indicator_style2 STYLE_SOLID #property indicator_style3 STYLE_SOLID #property indicator_style4 STYLE_SOLID #property indicator_style5 STYLE_SOLID #property indicator_style6 STYLE_SOLID #property indicator_style7 STYLE_SOLID #property indicator_style8 STYLE_SOLID //---- input parameters extern int StartHour=0; extern int StartMinute=0; extern int DaysToPlot=15; //---- buffers double Res3[]; double Res2[]; double Res1[]; double Pivot[]; double Supp1[]; double Supp2[]; double Supp3[]; double Extra1[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_LINE,STYLE_SOLID); SetIndexBuffer(0,Res3); SetIndexStyle(1,DRAW_LINE,STYLE_SOLID); SetIndexBuffer(1,Res2); SetIndexStyle(2,DRAW_LINE,STYLE_SOLID); SetIndexBuffer(2,Res1); SetIndexStyle(3,DRAW_LINE,STYLE_SOLID,1); SetIndexBuffer(3,Pivot); SetIndexStyle(4,DRAW_LINE,STYLE_SOLID); SetIndexBuffer(4,Supp1); SetIndexStyle(5,DRAW_LINE,STYLE_SOLID); SetIndexBuffer(5,Supp2); SetIndexStyle(6,DRAW_LINE,STYLE_SOLID); SetIndexBuffer(6,Supp3); SetIndexStyle(7,DRAW_LINE,STYLE_SOLID); SetIndexBuffer(7,Extra1); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); if(counted_bars<0) return(-1); //---- last counted bar will be recounted if(counted_bars>0) counted_bars--; int limit=Bars-counted_bars; int StartMinutesIntoDay=(StartHour*60)+StartMinute; // 8' o'clock x 60 = 480 int CloseMinutesIntoDay=StartMinutesIntoDay-Period(); // // **************************************************** // Check That cloes time isn't now a negative number. // Correct if it is by adding a full day's worth // of minutes. // **************************************************** if (CloseMinutesIntoDay<0) { CloseMinutesIntoDay=CloseMinutesIntoDay+1440; } // **************************************************** // Establish the nuber of bars in a day. // **************************************************** int BarsInDay=1440/Period(); // ****************************************************************************************** // ****************************************************************************************** // Main Loop // ****************************************************************************************** // ****************************************************************************************** for(int i=0; i<limit; i++) { // *************************************************************************** // Only do all this if we are within the plotting range we want. // i.e. DaysToPlot // If DaysToPlot is "0" (zero) we plot ALL available data. This can be // VERY slow with a large history and at small time frames. Expect to // wait if plotting a year or more on a say a five minute chart. On my PC // two years of data at Five Minutes takes around 30 seconds per indicator. // i.e. 30 seconds for main pivot levels indicator then another 30 seconds // to plot the seperate mid-levels indicator. // *************************************************************************** if ( (i<((DaysToPlot+1)*BarsInDay))||DaysToPlot==0) // Used to limit the number of days { // that are mapped out. Less waiting ;) // ***************************************************** // Find previous day's opening and closing bars. // ***************************************************** int PreviousClosingBar = FindLastTimeMatchFast(CloseMinutesIntoDay,i+1); int PreviousOpeningBar = FindLastTimeMatchFast(StartMinutesIntoDay,PreviousClosingBar+1); double PreviousHigh= High[PreviousClosingBar]; double PreviousLow = Low [PreviousClosingBar]; double PreviousClose = Close[PreviousClosingBar]; // ***************************************************** // Find previous day's high and low. // ***************************************************** for (int SearchHighLow=PreviousClosingBar;SearchHighLow<(PreviousOpeningBar+1);SearchHighLow++) { if (High[SearchHighLow]>PreviousHigh) PreviousHigh=High[SearchHighLow]; if (Low[SearchHighLow]<PreviousLow) PreviousLow=Low[SearchHighLow]; } // ************************************************************************ // Calculate Pivot lines and map into indicator buffers. // ************************************************************************ double P = (PreviousHigh+PreviousLow+PreviousClose)/3; double R1 = (2*P)-PreviousLow; double S1 = (2*P)-PreviousHigh; double R2 = P+(PreviousHigh - PreviousLow); double S2 = P-(PreviousHigh - PreviousLow); double R3 = (2*P)+(PreviousHigh-(2*PreviousLow)); double S3 = (2*P)-((2* PreviousHigh)-PreviousLow); Pivot[i]=P; Res1[i] =R1; Res2[i] =R2; Res3[i] =R3; Supp1[i]=S1; Supp2[i]=S2; Supp3[i]=S3; // Extra1[i]=OpenPriceAt+i; // ********************************************** // Calculate the mid-levels in to the buffers. // (for mid-levels version) // **********************************************(Twe) // Res1[i] =((R1-P)/2)+P; //M3 // Res2[i] =((R2-R1)/2)+R1; //M4 // Res3[i] =((R3-R2)/2)+R2; // Supp1[i]=((P-S1)/2)+S1; //M2 // Supp2[i]=((S1-S2)/2)+S2; //M1 // Supp3[i]=((S2-S3)/2)+S3; } //End of 'DaysToPlot 'if' statement. } // *************************************************************************************** // End of Main Loop // *************************************************************************************** // ***************************************** // Return from Start() (Main Routine) return(0); } //+-------------------------------------------------------------------------------------------------------+ // END Custom indicator iteration function //+-------------------------------------------------------------------------------------------------------+ // ***************************************************************************************** // ***************************************************************************************** // ----------------------------------------------------------------------------------------- // The following routine will use "StartingBar"'s time and use it to find the // general area that SHOULD contain the bar that matches "TimeToLookFor" // ----------------------------------------------------------------------------------------- int FindLastTimeMatchFast(int TimeToLookFor,int StartingBar) { int StartingBarsTime=(TimeHour(Time[StartingBar])*60)+TimeMinute(Time[StartingBar]); // *************************************************** // Check that our search isn't on the otherside of // the midnight boundary and correct for calculations // *************************************************** if (StartingBarsTime<TimeToLookFor) { StartingBarsTime=StartingBarsTime+1440; } // *************************************************** // Find out where the bar SHOULD be in time. // *************************************************** int HowFarBack=StartingBarsTime-TimeToLookFor; // *************************************************** // Translate that into Bars // *************************************************** int HowManyBarsBack=HowFarBack/Period(); // *************************************************** // We've found our starting point // Calculate it's relative time in minutes. // *************************************************** int SuggestedBar=StartingBar+HowManyBarsBack; int SuggestedBarsTime=(TimeHour(Time[SuggestedBar])*60)+TimeMinute(Time[SuggestedBar]); // *************************************************** // If we have what we're after let's just skip the // crap and return the position of the bar in the // chart to our main routine // *************************************************** if (SuggestedBarsTime==TimeToLookFor) { return(SuggestedBar); } // *************************************************** // Else find the difference in time from where we // were supposed to find the bar. // *************************************************** int DeltaTimeFound=TimeToLookFor-SuggestedBarsTime; int DeltaBarFound=DeltaTimeFound/Period(); // *************************************************** // I'd be worried if Delta was below zero. Would mean // that we have EXTRA bars in that day. Unlikely in // the extreme. // So I'm only checking for the other case. // ...now let's search in a narrow range to find that // bar we are after... // *************************************************** if (DeltaTimeFound>0) { for (int SearchCount=SuggestedBar ;SearchCount>(SuggestedBar-DeltaBarFound-2) ;SearchCount--) { // ****************************************************************************** // Find time (in minutes) of the current bar AND the two bars either side of it. // This is done to allow for any missing bars in the data. i.e. If THE bar you // were after were to be missing you'd never get a valid close/open time. // This is the same reason for searching rather than just looking back a certain // number of bars from the close time. Missing bars upset the count back and // screw up all pivot calculations. There is still room for error but it's improved. // The best calculations will come from having the best data. ...of course. :) // ****************************************************************************** // int PreviousBarsTime=(TimeHour(Time[SearchCount+1])*60)+TimeMinute(Time[SearchCount+1]); int CurrentBarsTime=(TimeHour(Time[SearchCount])*60)+TimeMinute(Time[SearchCount]); int NextBarsTime=(TimeHour(Time[SearchCount-1])*60)+TimeMinute(Time[SearchCount-1]); if (CurrentBarsTime==TimeToLookFor) { return(SearchCount); // *** If current bar is what we are after than lets get out. // *** without mucking about with the rest of the checks. } // ********************************** // Check that previous bar doesn't // lay on a different day. // Adjust if it is // ********************************** if(PreviousBarsTime>CurrentBarsTime) { PreviousBarsTime=PreviousBarsTime-1440; } // ********************************** // Check that following bar doesn't // lay on a different day. // Adjust if it is. // ********************************** if(NextBarsTime<CurrentBarsTime) { NextBarsTime=NextBarsTime+1440; } // ****************************************** // If this is the best we can get // to the actual bar we are after, then // exit, returning current bar number. // ******************************************* if(PreviousBarsTime<TimeToLookFor) { if( TimeToLookFor<NextBarsTime) { return(SearchCount); } } } } return (SuggestedBar); }

Forex Expert Advisor.

Avviso. I Forex Expert Advisor ed i mercati finanziari comportano rischi. Ti invitiamo a consultare il " Disclaimer " e la " Privacy "