Metatrader Expert Advisor

Indicatore Metatrader - 3shadeopen//+------------------------------------------------------------------+ //| 3shadeopen.mq4 | //| Copyright © 2006, sx ted | //| Purpose: shade New York or other sessions for chart time frames | //| M1 to H4 (at a push). | //| version: 2 - enhanced for speed but with MT4 beeing so fast no | //| difference will be noticed, all the sessions are | //| shaded in the init(), last session if it is current | //| is widened in the start() in lieu of repainting all.| //+------------------------------------------------------------------+ #property copyright "Copyright © 2006, sx ted" #property link "" #property indicator_chart_window //---- input parameters extern color ShadeColor=Gold; /* // if in Moscow #define NY_OPEN_HH 17 // NY session open hour #define NY_OPEN_MM 30 // NY session open minutes #define NY_CLOSE_HH 00 // NY session close hour #define NY_CLOSE_MM 05 // NY session close minutes */ /* if in London #define NY_OPEN_HH 14 // NY session open hour #define NY_OPEN_MM 30 // NY session open minutes #define NY_CLOSE_HH 21 // NY session close hour #define NY_CLOSE_MM 05 // NY session close minutes */ // if in New York #define NY_OPEN_HH 06 // NY session open hour #define NY_OPEN_MM 30 // NY session open minutes #define NY_CLOSE_HH 13 // NY session close hour #define NY_CLOSE_MM 05 // NY session close minutes #define MAX_DAYS_TO_SHADE 5 // maximum number of days back from last chart date to be shaded //---- global variables to program string obj[]; //array of object names int iPrevious=0, iStart=-1, iEnd; double dLow, dHigh; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { if(Period()>PERIOD_H4) return(0); // no shading required int iMaxBarsOnChart=iBars(NULL,0), i, iBarDay, iBarTime; // find approximate start of first day to shade int iBarsToDo=MathMin((MAX_DAYS_TO_SHADE*PERIOD_D1)/Period(),iMaxBarsOnChart); // find start of first day to shade for(i=iBarsToDo; i<iMaxBarsOnChart; i++) { iBarDay=TimeYear(Time[i])*PERIOD_MN1*12+TimeMonth(Time[i])*PERIOD_MN1+TimeDay(Time[i])*PERIOD_D1; iBarTime=iBarDay+TimeHour(Time[i])*60+TimeMinute(Time[i]); if(iBarTime>=iBarDay+NY_OPEN_HH*60+NY_OPEN_MM && iBarTime<=iBarDay+NY_CLOSE_HH*60+NY_CLOSE_MM) iStart=i; else if(iStart>-1) break; } if(iStart>-1) iBarsToDo=iStart; iStart=-1; // shade previous sessions and current session if started for(i=iBarsToDo; i>=0; i--) { iBarDay=TimeYear(Time[i])*PERIOD_MN1*12+TimeMonth(Time[i])*PERIOD_MN1+TimeDay(Time[i])*PERIOD_D1; iBarTime=iBarDay+TimeHour(Time[i])*60+TimeMinute(Time[i]); if(iBarTime>=iBarDay+NY_OPEN_HH*60+NY_OPEN_MM && iBarTime<=iBarDay+NY_CLOSE_HH*60+NY_CLOSE_MM) { if(iBarDay==iPrevious) // current NY session { dLow =MathMin(dLow, Low[i]); dHigh=MathMax(dHigh, High[i]); } else // new NY session { dLow=Low[i]; dHigh=High[i]; iStart=i; iPrevious=iBarDay; } iEnd=i; } else if(iStart>-1) { PaintRectangle(); iStart=-1; } } if(iStart>-1) PaintRectangle(); // paint the last one if session not closed return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { int iaCount=ArraySize(obj); for(int i=0; i<iaCount; i++) { if(ObjectFind(obj[i])>-1) ObjectDelete(obj[i]); } return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int i=0, iBarDay, iBarTime; iBarDay=TimeYear(Time[i])*PERIOD_MN1*12+TimeMonth(Time[i])*PERIOD_MN1+TimeDay(Time[i])*PERIOD_D1; iBarTime=iBarDay+TimeHour(Time[i])*60+TimeMinute(Time[i]); if(iBarTime>=iBarDay+NY_OPEN_HH*60+NY_OPEN_MM && iBarTime<=iBarDay+NY_CLOSE_HH*60+NY_CLOSE_MM) { if(iBarDay==iPrevious) // current NY session { dLow =MathMin(dLow, Low[i]); dHigh=MathMax(dHigh, High[i]); } else // new NY session { dLow=Low[i]; dHigh=High[i]; iStart=i; iPrevious=iBarDay; } iEnd=i; PaintRectangle(); } return(0); } //+------------------------------------------------------------------+ //| Paint rectangle | //+------------------------------------------------------------------+ void PaintRectangle() { string sObj="ShadeNY_"+DoubleToStr(iPrevious, 0); // name for the object if(ObjectFind(sObj)>-1) { // current session object found, so just widen it ObjectSet(sObj,OBJPROP_PRICE1,dLow-Point); ObjectSet(sObj,OBJPROP_TIME2 ,Time[iEnd]); ObjectSet(sObj,OBJPROP_PRICE2,dHigh+Point); } else { // otherwise create new object for the session int iaCount=ArraySize(obj); ArrayResize(obj, iaCount+1); obj[iaCount]=sObj; ObjectCreate(sObj,OBJ_RECTANGLE,0,Time[iStart],dLow-Point,Time[iEnd],dHigh+Point); ObjectSet(sObj,OBJPROP_COLOR,ShadeColor); } } //+------------------------------------------------------------------+
Indicatore Metatrader -  3LineBreak//+------------------------------------------------------------------+ //| 3LineBreak.mq4 | //| Copyright © 2004, Poul_Trade_Forum | //| Aborigen | //| http://forex.kbpauk.ru/ | //+------------------------------------------------------------------+ #property copyright "Poul Trade Forum" #property link "http://forex.kbpauk.ru/" #property indicator_chart_window #property indicator_buffers 2 //---- input parameters extern int Lines_Break=3; //---- buffers double HighBuffer[]; double LowBuffer[]; double VALUE1,VALUE2,Swing=1,OLDSwing; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { string short_name; //---- indicator line SetIndexStyle(0,DRAW_HISTOGRAM,EMPTY,2,Blue); SetIndexStyle(1,DRAW_HISTOGRAM,EMPTY,2,Red); SetIndexBuffer(0,HighBuffer); SetIndexBuffer(1,LowBuffer); SetIndexEmptyValue(0,0); SetIndexEmptyValue(1,0); //---- name for DataWindow and indicator subwindow label short_name="3LineBreak"; IndicatorShortName(short_name); SetIndexLabel(0,short_name); //---- SetIndexDrawBegin(0,10); SetIndexDrawBegin(1,10); //---- return(0); } //+------------------------------------------------------------------+ //| Custor indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- TODO: add your code here //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(),i,shift; //---- TODO: add your code here if (counted_bars==0) counted_bars=Lines_Break+1; i=(Bars-counted_bars); for (shift=i; shift>=0;shift--) { OLDSwing=Swing; VALUE1=High[Highest(NULL,0,MODE_HIGH,Lines_Break,shift+1)]; VALUE2= Low[Lowest(NULL,0,MODE_LOW,Lines_Break,shift+1)]; if (OLDSwing==1 && Low[shift]<VALUE2) Swing=-1; if (OLDSwing==-1 && High[shift]>VALUE1 ) Swing=1; if (Swing==1) { HighBuffer[shift]=High[shift]; LowBuffer[shift]=Low[shift]; } if (Swing==-1) { LowBuffer[shift]=High[shift]; HighBuffer[shift]=Low[shift]; } //---- } return(0); } //+------------------------------------------------------------------+
Indicatore Metatrader - 2CCI ZeroCross Alert.//+------------------------------------------------------------------+ //| 2CCI_ZeroCross_Alert.mq4 | //| Copyright © 2005, Jason Robinson (jnrtrading). | //| http://www.jnrtrading.co.uk | //+------------------------------------------------------------------+ #property copyright "Copyright © 2005, Jason Robinson (jnrtrading)." #property link "http://www.jnrtrading.co.uk" #property indicator_chart_window extern int CCI_Trend = 50; extern int CCI_Entry = 14; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators //---- return(0); } //+------------------------------------------------------------------+ //| Custor indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); double cciTrendNow, cciTrendPrevious, cciEntry; cciTrendNow = iCCI(NULL, 0, CCI_Trend, PRICE_TYPICAL, 0); cciTrendPrevious = iCCI(NULL, 0, CCI_Trend, PRICE_TYPICAL, 1); cciEntry = iCCI(NULL, 0, CCI_Entry, PRICE_TYPICAL, 0); //---- //Print(cciTrendNow, "...", cciTrendPrevious, "...", cciEntry); if(cciEntry < 0) { if((cciTrendNow < 0) && (cciTrendPrevious >= 0)) { Alert(Symbol(), " M", Period(), " Trend & Entry CCI Have both crossed below zero"); } } else if(cciEntry > 0) { if((cciTrendNow > 0) && (cciTrendPrevious <= 0)) { Alert(Symbol(), " M", Period(), " Trend & Entry CCI Have both crossed above zero"); } } Comment("Trend CCI: ", cciTrendNow, " Entry CCI: ", cciEntry); //---- return(0); } //+------------------------------------------------------------------+
Indicatore Metatrader - MACD Classico//+------------------------------------------------------------------+ //| MACD.mq4 | //| Copyright © 2005, David W. Thomas | //| mailto:Questo indirizzo email è protetto dagli spambots. È necessario abilitare JavaScript per vederlo. document.getElementById('cloak282757d759b73ef863c82420a70e0fbe').innerHTML = ''; var prefix = 'ma' + 'il' + 'to'; var path = 'hr' + 'ef' + '='; var addy282757d759b73ef863c82420a70e0fbe = 'davidwt' + '@'; addy282757d759b73ef863c82420a70e0fbe = addy282757d759b73ef863c82420a70e0fbe + 'usa' + '.' + 'net'; var addy_text282757d759b73ef863c82420a70e0fbe = 'davidwt' + '@' + 'usa' + '.' + 'net';document.getElementById('cloak282757d759b73ef863c82420a70e0fbe').innerHTML += ''+addy_text282757d759b73ef863c82420a70e0fbe+''; | //+------------------------------------------------------------------+ // This is the correct computation and display of MACD. #property copyright "Copyright © 2005, David W. Thomas" #property link "mailto:Questo indirizzo email è protetto dagli spambots. È necessario abilitare JavaScript per vederlo. document.getElementById('cloak953bef19ef8d608156556f0d30ce86a3').innerHTML = ''; var prefix = 'ma' + 'il' + 'to'; var path = 'hr' + 'ef' + '='; var addy953bef19ef8d608156556f0d30ce86a3 = 'davidwt' + '@'; addy953bef19ef8d608156556f0d30ce86a3 = addy953bef19ef8d608156556f0d30ce86a3 + 'usa' + '.' + 'net'; var addy_text953bef19ef8d608156556f0d30ce86a3 = 'davidwt' + '@' + 'usa' + '.' + 'net';document.getElementById('cloak953bef19ef8d608156556f0d30ce86a3').innerHTML += ''+addy_text953bef19ef8d608156556f0d30ce86a3+''; " #property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 Blue #property indicator_color2 Red //#property indicator_color3 Green //---- input parameters extern int FastMAPeriod=12; extern int SlowMAPeriod=26; extern int SignalMAPeriod=9; //---- buffers double MACDLineBuffer[]; double SignalLineBuffer[]; double HistogramBuffer[]; //---- variables double alpha = 0; double alpha_1 = 0; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+1); //---- indicators SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,MACDLineBuffer); SetIndexDrawBegin(0,SlowMAPeriod); SetIndexStyle(1,DRAW_LINE,STYLE_DOT); SetIndexBuffer(1,SignalLineBuffer); SetIndexDrawBegin(1,SlowMAPeriod+SignalMAPeriod); // SetIndexStyle(2,DRAW_HISTOGRAM); // SetIndexBuffer(2,HistogramBuffer); // SetIndexDrawBegin(2,SlowMAPeriod+SignalMAPeriod); //---- name for DataWindow and indicator subwindow label IndicatorShortName("MACD("+FastMAPeriod+","+SlowMAPeriod+","+SignalMAPeriod+")"); SetIndexLabel(0,"MACD"); SetIndexLabel(1,"Signal"); //---- alpha = 2.0 / (SignalMAPeriod + 1.0); alpha_1 = 1.0 - alpha; //---- return(0); } //+------------------------------------------------------------------+ //| Custor indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int limit; int counted_bars = IndicatorCounted(); //---- check for possible errors if (counted_bars<0) return(-1); //---- last counted bar will be recounted if (counted_bars>0) counted_bars--; limit = Bars - counted_bars; for(int i=limit; i>=0; i--) { MACDLineBuffer[i] = iMA(NULL,0,FastMAPeriod,0,MODE_EMA,PRICE_CLOSE,i) - iMA(NULL,0,SlowMAPeriod,0,MODE_EMA,PRICE_CLOSE,i); SignalLineBuffer[i] = alpha*MACDLineBuffer[i] + alpha_1*SignalLineBuffer[i+1]; HistogramBuffer[i] = MACDLineBuffer[i] - SignalLineBuffer[i]; } //---- return(0); } //+------------------------------------------------------------------+
Indicatori Metatrader - Hi-Lo Channel#property indicator_chart_window #property indicator_buffers 4 #property indicator_color1 Black #property indicator_color2 Black #property indicator_color3 Green #property indicator_color4 Red extern int ChannelPeriod=20; double UpperLine[]; double LowerLine[]; double BuyBuffer[]; double SellBuffer[]; int EMAPeriod=120; int StartEMAShift=6; int EndEMAShift=0; double AngleTreshold=0.32; int init() { SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,UpperLine); SetIndexLabel(0,"UpperLine"); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,LowerLine); SetIndexLabel(1,"LowerLine"); SetIndexStyle(2,DRAW_NONE); SetIndexArrow(2,241); SetIndexBuffer(2,BuyBuffer); SetIndexLabel(2,"Buy"); SetIndexStyle(3,DRAW_NONE); SetIndexArrow(3,242); SetIndexBuffer(3,SellBuffer); SetIndexLabel(3,"Sell"); IndicatorShortName("DonchianChannel("+ChannelPeriod+")"); SetIndexDrawBegin(0,ChannelPeriod); SetIndexDrawBegin(1,ChannelPeriod); return(0); } //+------------------------------------------------------------------+ //| Price Channel | //+------------------------------------------------------------------+ int start() { int i, start ,counted_bars=IndicatorCounted(); int k; double high,low,price, fEndMA, fStartMA, fAngle; if(Bars<=ChannelPeriod) return(0); if(counted_bars>=ChannelPeriod) { start=Bars-counted_bars-1; } else { start=Bars-ChannelPeriod-1; } BuyBuffer[0]=0; SellBuffer[0]=0; for(i=start;i>=0;i--) { UpperLine[i]=High[Highest(NULL, 0, MODE_HIGH, ChannelPeriod, i)]; LowerLine[i]=Low[Lowest(NULL, 0, MODE_LOW, ChannelPeriod, i)]; // next 3 lines from jpkfox, EMAAngle.mq4 fEndMA=iMA(NULL,0,EMAPeriod,0,MODE_EMA,PRICE_MEDIAN,i+EndEMAShift); fStartMA=iMA(NULL,0,EMAPeriod,0,MODE_EMA,PRICE_MEDIAN,i+StartEMAShift); fAngle = 10000.0 * (fEndMA - fStartMA)/(StartEMAShift-EndEMAShift); if(UpperLine[i+1]<High[i] && fAngle > AngleTreshold) { BuyBuffer[i]=High[i]; } if(LowerLine[i+1]>Low[i] && fAngle < -AngleTreshold) { SellBuffer[i]=Low[i]; } if (BuyBuffer[0]!=0) { Print("Donchian Buy Signal at " + BuyBuffer[0] + " -> " + Symbol() + "/" + Period()); // PlaySound("expert.wav"); } if (SellBuffer[0]!=0) { Print("Donchian Sell Signal at " + SellBuffer[0] + " -> " + Symbol() + "/" + Period()); // PlaySound("expert.wav"); } } } //+------------------------------------------------------------------+
Expert Advisor - Indicatori Metatrader - Divergenza di 2 Medie mobili.// Trend Manager.mq4 // Based on indicator sold at traderstradingsystem.com #property indicator_chart_window #property indicator_buffers 4 #property indicator_color1 Blue #property indicator_color2 Red #property indicator_color3 Aqua #property indicator_color4 LawnGreen // Divergence controls extern double DVLimit=0.0007; extern bool ShowMAs=false; extern int Fast_TimeFrame=0; extern int Fast_Period=23; extern int Fast_Price = PRICE_OPEN; extern int Fast_Mode = MODE_SMA; extern int Fast_Shift=0; extern int Slow_TimeFrame=0; extern int Slow_Period=84; extern int Slow_Price = PRICE_OPEN; extern int Slow_Mode = MODE_SMA; extern int Slow_Shift=0; extern int BarCount=1500; double SpanA_Buffer[]; double SpanB_Buffer[]; double ma1[]; double ma2[]; int tickcount=0; int init() { // histogram defined by top and bottom buffer // pos or neg from top buffer determines color SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID); SetIndexBuffer(0,SpanB_Buffer); //SetIndexDrawBegin(0,TM_Period+TM_Shift-1); //SetIndexLabel(0,"TM_Period+"); SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID); SetIndexBuffer(1,SpanA_Buffer); //SetIndexDrawBegin(1,TM_Period+TM_Shift-1); //SetIndexLabel(1,"TM_Period"); SetIndexStyle(2,DRAW_LINE); SetIndexBuffer(2,ma1); SetIndexStyle(3,DRAW_LINE); SetIndexBuffer(3,ma2); } int start() { int pos; int iFileHandle; double maF1, maF2, maS1, maS2; double D; for(pos=BarCount; pos>=0; pos--) { // Create Divergence stage one maF1=iMA(Symbol(),Fast_TimeFrame,Fast_Period,Fast_Shift,Fast_Mode,Fast_Price,pos); maS1=iMA(Symbol(),Slow_TimeFrame,Slow_Period,Slow_Shift,Slow_Mode,Slow_Price,pos); D=maF1-maS1; if( D >= DVLimit ) { SpanA_Buffer[pos] = High[pos]; SpanB_Buffer[pos] = High[pos]+(D-DVLimit); } if( D <= (DVLimit*(-1)) ) { SpanA_Buffer[pos] = Low[pos]; SpanB_Buffer[pos] = Low[pos]+(D-DVLimit); } if(ShowMAs) { ma1[pos]=maS1; ma2[pos]=maF1; } } //for } //start

Forex Expert Advisor.

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