| New signals service! | |
|
|||||||
| Register in Forex TSD! | |
|
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time). Click here to register and get more information |
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
MT4 Indicator codes coming out of my ears!
Hi all
Here's some real good indicators for MT4 but all I have is the code. Can someone make then uploadable so we can all share them? Here goes.......... NRTR Rosh v2.mq4 //+------------------------------------------------------------------+ //| NRTR Rosh v2.mq4 | //| Rosh | //| http://forexsystems.ru/phpBB/index.php | //+------------------------------------------------------------------+ #property copyright "Rosh" #property link "http://forexsystems.ru/phpBB/index.php" #property indicator_chart_window #property indicator_buffers 4 #property indicator_color1 Tomato #property indicator_color2 DeepSkyBlue #property indicator_color3 DeepSkyBlue #property indicator_color4 Tomato //---- input parameters extern int PerATR=40; extern double kATR=2.0; extern bool useSendMail=true; //---- buffers double SellBuffer[]; double BuyBuffer[]; double Ceil[]; double Floor[]; double Trend[]; int sm_Bars; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators IndicatorBuffers(5); SetIndexStyle(0,DRAW_ARROW); SetIndexArrow(0,251); SetIndexBuffer(0,SellBuffer); SetIndexEmptyValue(0,0.0); SetIndexStyle(1,DRAW_ARROW); SetIndexArrow(1,251); SetIndexBuffer(1,BuyBuffer); SetIndexEmptyValue(1,0.0); SetIndexStyle(2,DRAW_ARROW); SetIndexArrow(2,159); SetIndexBuffer(2,Ceil); SetIndexEmptyValue(2,0.0); SetIndexStyle(3,DRAW_ARROW); SetIndexArrow(3,159); SetIndexBuffer(3,Floor); SetIndexEmptyValue(3,0.0); SetIndexBuffer(4,Trend); SetIndexEmptyValue(4,0); //---- return(0); } //+------------------------------------------------------------------+ //| пробитие верха ДАУНтренда | //+------------------------------------------------------------------+ bool BreakDown(int shift) { bool result=false; if (Close[shift]>SellBuffer[shift+1]) result=true; return(result); } //+------------------------------------------------------------------+ //| пробитие дна АПтренда | //+------------------------------------------------------------------+ bool BreakUp(int shift) { bool result=false; if (Close[shift]<BuyBuffer[shift+1]) result=true; return(result); } //+------------------------------------------------------------------+ //| взятие нового минимума по ДАУНтренду | //+------------------------------------------------------------------+ bool BreakFloor(int shift) { bool result=false; if (High[shift]<Floor[shift+1]) result=true; return(result); } //+------------------------------------------------------------------+ //| взятие нового максимума по АПтренду | //+------------------------------------------------------------------+ bool BreakCeil(int shift) { bool result=false; if (Low[shift]>Ceil[shift+1]) result=true; return(result); } //+------------------------------------------------------------------+ //| определение предыдущего тренда | //+------------------------------------------------------------------+ bool Uptrend(int shift) { //Print("Trend=",Trend[shift+1]); bool result=false; if (Trend[shift+1]==1) result=true; if (Trend[shift+1]==-1) result=false; if ((Trend[shift+1]!=1)&&(Trend[shift+1]!=-1)) Print("Внимание! Тренд не определен, такого быть не может. Бар от конца ",(Bars-shift)); return(result); } //+------------------------------------------------------------------+ //| вычисление волатильности | //+------------------------------------------------------------------+ double ATR(int iPer,int shift) { double result; //result=iMA(NULL,0,Per,0,MODE_SMA,PRICE_HIGH,shift+ 1)-iMA(NULL,0,Per,0,MODE_SMA,PRICE_LOW,shift+1); result=iATR(NULL,0,iPer,shift); //if (result>1.0) Alert("Большой АТР=",result); //Print("ATR[",shift,"]=",result); return(result); } //+------------------------------------------------------------------+ //| установка нового уровня потолка | //+------------------------------------------------------------------+ void NewCeil(int shift) { Ceil[shift]=Close[shift]; Floor[shift]=0.0; } //+------------------------------------------------------------------+ //| установка нового уровня пола | //+------------------------------------------------------------------+ void NewFloor(int shift) { Floor[shift]=Close[shift]; Ceil[shift]=0.0; } //+------------------------------------------------------------------+ //| установка уровня поддержки АПтренда | //+------------------------------------------------------------------+ void SetBuyBuffer(int shift) { BuyBuffer[shift]=Close[shift]-kATR*ATR(PerATR,shift); SellBuffer[shift]=0.0; } //+------------------------------------------------------------------+ //| установка уровня поддержки ДАУНтренда | //+------------------------------------------------------------------+ void SetSellBuffer(int shift) { SellBuffer[shift]=Close[shift]+kATR*ATR(PerATR,shift); BuyBuffer[shift]=0.0; } //+------------------------------------------------------------------+ //| реверс тренда и установка новых уровней | //+------------------------------------------------------------------+ void NewTrend(int shift) { if (Trend[shift+1]==1) { Trend[shift]=-1; NewFloor(shift); SetSellBuffer(shift); } else { Trend[shift]=1; NewCeil(shift); SetBuyBuffer(shift); } if ((Trend[shift+1]!=1)&&(Trend[shift+1]!=-1)) Print("Внимание! Тренд не определен, такого быть не может"); } //+------------------------------------------------------------------+ //| продолжение тренда | //+------------------------------------------------------------------+ void CopyLastValues(int shift) { SellBuffer[shift]=SellBuffer[shift+1]; BuyBuffer[shift]=BuyBuffer[shift+1]; Ceil[shift]=Ceil[shift+1]; Floor[shift]=Floor[shift+1]; Trend[shift]=Trend[shift+1]; } //+------------------------------------------------------------------+ //| продолжение тренда | //+------------------------------------------------------------------+ void SendSMS(int shift) { if (sm_Bars!=Bars) sm_Bars=Bars; if ((Trend[shift+1]*Trend[shift+2]==-1)&&(shift==0)&&useSendMail) // сменился тренд { if (Trend[shift+1]==1) { SendMail("NRTR",Symbol()+" "+Period()+" развернулся вверх, Bid="+NormalizeDouble(Bid,Digits)); } else { SendMail("NRTR",Symbol()+" "+Period()+" развернулся вниз, Bid="+Bid); } } return; } //+------------------------------------------------------------------+ //| Custor indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); int limit; if (counted_bars>0) limit=Bars-counted_bars; if (counted_bars<0) return(0); if (counted_bars==0) { limit=Bars-PerATR-1; if (Close[limit+1]>Open[limit+1]) {Trend[limit+1]=1;Ceil[limit+1]=Close[limit+1];BuyBuffer[limit+1]=Close[limit+1]-kATR*ATR(PerATR,limit+1);} if (Close[limit+1]<Open[limit+1]) {Trend[limit+1]=-1;Floor[limit+1]=Close[limit+1];SellBuffer[limit+1]=Close[limit+1]+kATR*ATR(PerATR,limit+1);} if (Close[limit+1]==Open[limit+1]) {Trend[limit+1]=1;Ceil[limit+1]=Close[limit+1];BuyBuffer[limit+1]=Close[limit+1]-kATR*ATR(PerATR,limit+1);} } //---- for (int cnt=limit;cnt>=0;cnt--) { SendSMS(cnt); if (Uptrend(cnt)) { //Print("UpTrend"); if (BreakCeil(cnt)) { NewCeil(cnt); SetBuyBuffer(cnt); Trend[cnt]=1; continue; } if (BreakUp(cnt)) { NewTrend(cnt); continue; } CopyLastValues(cnt); } else { //Print("DownTrend"); if (BreakFloor(cnt)) { NewFloor(cnt); SetSellBuffer(cnt); Trend[cnt]=-1; continue; } if (BreakDown(cnt)) { NewTrend(cnt); continue; } CopyLastValues(cnt); } } //---- return(0); } //+------------------------------------------------------------------+ |
|
|||
|
And there's more....
NRTR WATR-hist.mq4
//+------------------------------------------------------------------+ //| NRTR WATR.mq4 | //| | //| Ramdass - Conversion only | //+------------------------------------------------------------------+ #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Tomato #property indicator_color2 DeepSkyBlue //---- input parameters extern int AveragePeriod=10; extern int Variant=2; extern int CountBars=300; //---- buffers double value1[]; double value2[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicator line IndicatorBuffers(4); SetIndexStyle(0,DRAW_HISTOGRAM,0,2);//SetIndexStyle(0,DRAW_ARROW); //SetIndexArrow(0,167); SetIndexStyle(1,DRAW_HISTOGRAM,0,2);//SetIndexStyle(1,DRAW_ARROW); //SetIndexArrow(1,167); SetIndexStyle(2,DRAW_HISTOGRAM,0,2); SetIndexStyle(3,DRAW_HISTOGRAM,0,2); SetIndexBuffer(0,value1); SetIndexBuffer(1,value2); //---- //---- return(0); } //+------------------------------------------------------------------+ //| NRTR WATR | //+------------------------------------------------------------------+ int start() { if (CountBars>=Bars) CountBars=Bars - AveragePeriod - 2; // CountBars = CountBars - AveragePeriod - 3; SetIndexDrawBegin(0,Bars-CountBars+1); SetIndexDrawBegin(1,Bars-CountBars+1); int i,i2,bar,counted_bars=IndicatorCounted(); double value,WATR; double trend=1,dK,AvgRange,price,AveragePeriod_D; AveragePeriod_D=AveragePeriod; //---- if(Bars<=AveragePeriod) return(0); //---- initial zero if(counted_bars<1) { for(i=1;i<=AveragePeriod;i++) value1[Bars-i]=0.0; for(i=1;i<=AveragePeriod;i++) value2[Bars-i]=0.0; } AvgRange=0; if ((Variant == 2) || (Variant == 3)) { for (i=AveragePeriod; i>=1; i--) { dK = 1+(AveragePeriod_D-i)/AveragePeriod_D; AvgRange=AvgRange + dK*MathAbs(High[i]-Low[i]); } if (Symbol()=="USDJPY" || Symbol()=="GBPJPY" || Symbol()=="EURJPY") {WATR = AvgRange/AveragePeriod_D/100;} else {WATR = AvgRange/AveragePeriod_D;} } if (Variant == 1) { for (i=1; i<=AveragePeriod; i++) { dK = 1+(AveragePeriod_D-i)/AveragePeriod_D; AvgRange=AvgRange + dK*MathAbs(High[CountBars + i]-Low[CountBars + i]); } WATR = AvgRange/AveragePeriod_D; } if (Close[CountBars-1] > Open[CountBars-1]) { value1[CountBars - 1] = Close[CountBars - 1] * (1 - WATR); trend = 1; value2[CountBars - 1] = 0.0; } if (Close[CountBars-1] < Open[CountBars-1]) { value2[CountBars - 1] = Close[CountBars - 1] * (1 + WATR); trend = -1; value1[CountBars - 1] = 0.0; } //---- bar=CountBars; while(bar>=0) { value1[bar]=0.0; value2[bar]=0.0; if (Variant == 3) { AvgRange=0; for (i=1; i<=AveragePeriod; i++) { dK = 1+(AveragePeriod_D-i)/AveragePeriod_D; AvgRange=AvgRange+ dK*MathAbs(High[bar + i]-Low[bar + i]); } WATR = AvgRange/AveragePeriod_D; } if (trend == 1) { if (Close[bar] > price) price = Close[bar]; value = price * (1 - WATR); if (Close[bar] < value) { price = Close[bar]; value = price * (1 + WATR); trend = -1; } } if (trend == -1) { if (Close[bar] < price) price = Close[bar]; value = price * (1 + WATR); if (Close[bar] > value) { price = Close[bar]; value = price * (1 - WATR); trend = 1; } } if (trend == 1) {value1[bar]=Low[bar]; value2[bar]=High[bar];}//if (trend == 1) {value1[bar]=value; value2[bar]=0.0;} if (trend == -1) {value2[bar]=Low[bar]; value1[bar]=High[bar];}//if (trend == -1) {value2[bar]=value; value1[bar]=0.0;} bar--; } return(0); } //+------------------------------------------------------------------+ NRTR WATR.mq4 //+------------------------------------------------------------------+ //| NRTR WATR.mq4 | //| | //| Ramdass - Conversion only | //+------------------------------------------------------------------+ #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Blue #property indicator_color2 Red //---- input parameters extern int AveragePeriod=10; extern int Variant=2; extern int CountBars=300; //---- buffers double value1[]; double value2[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicator line IndicatorBuffers(2); SetIndexStyle(0,DRAW_ARROW); SetIndexArrow(0,167); SetIndexStyle(1,DRAW_ARROW); SetIndexArrow(1,167); SetIndexBuffer(0,value1); SetIndexBuffer(1,value2); //---- //---- return(0); } //+------------------------------------------------------------------+ //| |
|
|||
|
more......
Wiseman 1.mq4 Divergence Indictor - wiseman1
//+------------------------------------------------------------------+ //| Wiseman 1.mq4 | //| Bill Williams Wiseman 1 Divergent bars | //| Author: David Thomas | //| MQ4 Conversion: Pavel Kulko | //| polk@alba.dp.ua | //+------------------------------------------------------------------+ #property copyright "Copyright © 2005, Pavel Kulko" #property link "polk@alba.dp.ua" #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Aqua #property indicator_color2 Red double UpBuf[],DnBuf[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { SetIndexStyle(0,DRAW_HISTOGRAM,0,2); SetIndexBuffer(0,UpBuf); SetIndexStyle(1,DRAW_HISTOGRAM,0,2); SetIndexBuffer(1,DnBuf); return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int result; double median; int counted_bars=IndicatorCounted(); int limit = Bars-counted_bars-1; for(int i=limit; i>=0; i--) { result = 0; median = (High[i]+Low[i])/2; if((Low[i] < Low[i+1]) && (Close[i] > median)) result = -1; if((High[i] > High[i+1]) && (Close[i] < median)) result = 1; if(result > 0) { UpBuf[i] = Low[i]; DnBuf[i] = High[i]; } if(result < 0) { UpBuf[i] = High[i]; DnBuf[i] = Low[i]; } } return(0); } //+------------------------------------------------------------------+ William36HistogramWalerttest.mq4 Let Willie check your swing /* original formula) WH:=HHV(HIGH,5); WL:=LLV(LOW,5); //WRD:=(( HHV( WH,36 )-c ) /( HHV(WH,36 ) - LLV( WL,36) ) ) *- 100, //WDo:=WRD+50; //WU:=IF(WDo>0,WDo,0); //WD:=IF(WDo<0,WDo,0); //{- this will give you the william's when it is below zero and it is plotted red} //LN:=0; */ #property indicator_separate_window #property indicator_buffers 3 #property indicator_color1 LimeGreen #property indicator_color2 Red #property indicator_color3 Gray #property indicator_maximum 50 #property indicator_minimum -50 #property indicator_level1 0 #property indicator_level2 15 #property indicator_level3 -15 //---- input parameters //---- buffers double WU[],WD[],W[],Zero[]; int Ssw=0,Bsw=0; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { string short_name; //---- 3 additional buffers are used for counting. IndicatorBuffers(4); SetIndexBuffer(3,W); //---- indicator lines SetIndexStyle(0,DRAW_HISTOGRAM,0,3); SetIndexBuffer(0,WU); SetIndexStyle(1,DRAW_HISTOGRAM,0,3); SetIndexBuffer(1,WD); SetIndexStyle(2,DRAW_LINE,0,2); SetIndexBuffer(2,Zero); //---- name for DataWindow and indicator subwindow label short_name="William%R36 With Alert"; IndicatorShortName(short_name); //---- indicator lines //---- SetIndexDrawBegin(0,40); //---- return(0); } //+------------------------------------------------------------------+ //| BSPVolume //+------------------------------------------------------------------+ int start() { int i,k,counted_bars=IndicatorCounted(); if(Bars<=40) return(0); //---- initial zero /* if(counted_bars<1) { for(i=1;i<=CCIPeriod;i++) CCIBuffer[Bars-i]=0.0; for(i=1;i<=CCIPeriod;i++) DevBuffer[Bars-i]=0.0; for(i=1;i<=CCIPeriod;i++) MovBuffer[Bars-i]=0.0; } */ //---- last counted bar will be recounted int limit=Bars-counted_bars; if (counted_bars>0) limit++; else if (limit>300) limit=300; for(i=0; i<limit; i++) W[i]=50+(-100)*(High[Highest(NULL,0,MODE_HIGH,40,i)]-Close[i])/(High[Highest(NULL,0,MODE_HIGH,40,i)]-Low[Lowest(NULL,0,MODE_LOW,40,i)]); for(i=0; i<limit; i++) Zero[i]=0; for(i=0; i<limit; i++) { if (W[i]<0 && W[i+1]>0 && i<2) { Ssw=1; Bsw=0; } if (W[i]>0 && W[i+1]<0 && i<2) { Ssw=0; Bsw=1; } if (Bsw==1 && i<2 && W[i]>=15 ) { Ssw=0; Bsw=0; Alert (Symbol()," ",Period()," Willy Says B U Y"); } if (Ssw==1 && i<2 && W[i]<=-15 ) { Ssw=0; Bsw=0; Alert (Symbol()," ",Period()," Willy Says S E L L"); } if (Ssw==1) Comment ("SELL SWITCH ON","i ",i,"W[i] ",W[i],"W[i+1] ",W[i+1]); if (Bsw==1) Comment ("BUY SWITCH ON","i ",i,"W[i] ",W[i],"W[i+1] ",W[i+1]); if (Bsw==0 && Ssw==0) Comment ("NO SWITCH ON","i ",i,"W[i] ",W[i],"W[i+1] ",W[i+1]); if (W[i]>0) {WU[i]=W[i];WD[i]=0;} else if (W[i]<0) {WU[i]=0;WD[i]=W[i];} else {WU[i]=0;WD[i]=0;} } return(0); } XO.mq4 Similar to iTrend. Used in Goldengoose and GoldenEagle experts authored by Autofx and Amir (moneytec). Enjoy //+------------------------------------------------------------------+ |
|
|||
|
More.....
//| XO.mq4 | //| Original Author SHARIPOV AINUR | //| Conversion to MT4 and modification only adoleh2000 | //+------------------------------------------------------------------+ #property copyright "Copyright © 2005, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" #property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 Lime //XO up #property indicator_color2 Red //XO down extern double KirPER=10; double cb,valuel,valueh,CurrentBar; double Kir ,Hi, Lo, KirUp, KirDn,mode,cnt,cnt1,cur,kr,no; double ExtMapBuffer1[]; // XO up double ExtMapBuffer2[]; // Xo down int loopbegin; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+
int init() { IndicatorBuffers(2); //---- drawing settings SetIndexBuffer(0,ExtMapBuffer1);//bbMacd line SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,2); SetIndexBuffer(1,ExtMapBuffer2);//Upperband line SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,2); IndicatorShortName("XO ("+KirPER+"), "+valueh+","+valuel); SetIndexLabel(0,"XO Up"); SetIndexLabel(1,"XO Down"); //---- indicators //---- 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--; loopbegin = Bars-1; for(int i = loopbegin; i >= 0; i--) { if (Kir<1) { Hi=Close[i]; Lo=Close[i]; Kir=1; } cur=(Close[i]); if (cur > (Hi+KirPER * Point)) { Kir=Kir+1; Hi=cur; Lo=cur-KirPER*Point; KirUp=1; KirDn=0; kr=kr+1; no=0; } if (cur < (Lo-KirPER*Point)) { Lo=cur; Hi=cur+KirPER*Point; KirUp=0; KirDn=1; Kir=Kir+1; no=no+1; kr=0; } valueh=kr; ExtMapBuffer1[i]=valueh;//XO up if (valueh < 0) { ExtMapBuffer1[i] = 0; } if (valueh > 0) { ExtMapBuffer1[i] = 1; } valuel=0-no; ExtMapBuffer2[i]=valuel;// XO down if (valuel > 0) { ExtMapBuffer2[i] = 0; } if (valuel < 0) { ExtMapBuffer2[i] = -1; } } //---- return(0); } //+------------------------------------------------------------------+ Triggerlines.mq4 Unique MA cross. When lines are blue trend is up when lines are red trend is down. Wait for close below or above trigger lines to confirm trend reversal. Width of seperation and angle are important clues of trend strength and duration. Updated 8/24/2005 Enjoy! //+------------------------------------------------------------------+ //| Trigger Line | //| Copyright © 2005 dwt5 and adoleh2000 | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "Copyright © 2005 dwt5 and adoleh2000 " #property link "http://www.metaquotes.net/" //---- indicator settings #property indicator_chart_window #property indicator_buffers 4 #property indicator_color1 Red #property indicator_color2 Red #property indicator_color3 Blue #property indicator_color4 Blue //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; double ExtMapBuffer3[]; double ExtMapBuffer4[]; int width; extern int Rperiod = 15; extern int LSMA_Period = 5; int Draw4HowLong; int shift; int i; int j; int loopbegin; int length; int lsma_length; double lengthvar; double tmp ; double tmp2 ; double wt[]; double sum[]; double lsma_sum[]; double lsma_ma[]; double middle[]; int c; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- 7 additional buffers are used for counting. IndicatorBuffers(7); //---- drawing settings SetIndexBuffer(0,ExtMapBuffer1); SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2); SetIndexBuffer(1,ExtMapBuffer2); SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2); SetIndexBuffer(2,ExtMapBuffer3); SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,2); SetIndexBuffer(3,ExtMapBuffer4); SetIndexStyle(3,DRAW_LINE,STYLE_SOLID,2); SetIndexBuffer(4,sum); SetIndexBuffer(5,wt); SetIndexBuffer(6,lsma_ma); //---- initialization done return(0); } int start() { Draw4HowLong = Bars-Rperiod - 5; //Rperiod = 20 length = Rperiod; //length now = 20 lsma_length = LSMA_Period; loopbegin = Draw4HowLong - length - 1; for(shift = loopbegin; shift >= 0; shift--) // MAIN For Loop { sum[1] = 0; for(i = length; i >= 1 ; i--) //LSMA loop { lengthvar = length + 1; //lengthvar = 21 lengthvar /= 3; //lengthvar = 7 tmp = 0; tmp = ( i - lengthvar)*Close[length-i+shift]; //tmp = 20 - 7 * close[20-i+shift] sum[1]+=tmp; } wt[shift] = sum[1]*6/(length*(length+1)); j = shift; lsma_ma[shift] = wt[j+1] + (wt[j]-wt[j+1])* 2/(lsma_length+1); //========== COLOR CODING =========================================== ExtMapBuffer1[shift] = wt[shift]; ExtMapBuffer2[shift] = lsma_ma[shift]; ExtMapBuffer3[shift] = wt[shift]; ExtMapBuffer4[shift] = lsma_ma[shift]; if (wt[shift] < lsma_ma[shift]) { ExtMapBuffer4[shift] = EMPTY_VALUE; ExtMapBuffer3[shift] = EMPTY_VALUE; } } } //+------------------------------------------------------------------+ TTM.mq4 TTM indicator based on code provided by members of MT yahoo group. Trend indicator. Blue bar bar when trend is up, Red bar when trend is down. Enjoy! //+------------------------------------------------------------------+ //| |
|
|||
|
More....
TTM.mq4 | //| Copyright © 2005, adoleh2000 and dwt5| //|
http://www.metaquotes.net | //+------------------------------------------------------------------+ //| Based on code offered at MT Yahoo group | //+------------------------------------------------------------------+ #property copyright "Copyright © 2005, adoleh2000" #property link "adoleh2000@yahoo.com" #property indicator_chart_window #property indicator_buffers 4 #property indicator_color1 Blue #property indicator_color2 Red #property indicator_color3 EMPTY #property indicator_color4 EMPTY //---- input parameters extern int TTMperiod=6; //---- buffers double HighBuffer[]; double LowBuffer[]; double Low_ma, High_ma, Low_third[], High_third[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { string short_name; //---- indicator line SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,2); SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,2); SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,2); SetIndexStyle(3,DRAW_LINE,STYLE_SOLID,2); SetIndexBuffer(0,HighBuffer); SetIndexBuffer(1,LowBuffer); SetIndexBuffer(2,High_third); SetIndexBuffer(3,Low_third); //---- name for DataWindow and indicator subwindow label short_name="TTM"; IndicatorShortName(short_name); SetIndexLabel(0,short_name); //---- SetIndexDrawBegin(0,10); SetIndexDrawBegin(1,10); SetIndexDrawBegin(2,10); SetIndexDrawBegin(3,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=TTMperiod+1; i=(Bars-counted_bars); for (shift=i; shift>=0;shift--) { Low_ma= iMA(NULL,0,TTMperiod,0,MODE_EMA,PRICE_LOW,shift); High_ma = iMA(NULL,0,TTMperiod,0,MODE_EMA,PRICE_HIGH,shift); Low_third[shift] = (High_ma- Low_ma) / 3 + Low_ma; High_third[shift] = 2 * (High_ma- Low_ma) / 3 + Low_ma; //Comment ("Low_third=",Low_third[shift],"; ","High_third=",High_third[shift]); if (Close[shift] > High_third[shift]) { HighBuffer[shift]=High[shift]; LowBuffer[shift]=Low[shift]; } else if (Close[shift] < Low_third[shift]) { LowBuffer[shift]=High[shift]; HighBuffer[shift]=Low[shift]; } //---- } return(0); } //+------------------------------------------------------------------+ MACD.mq4 MACD - the correct computation and display. It includes the MACD line, the signal line, and the histogram of the difference. //+------------------------------------------------------------------+ |
|
|||
|
Lastly......
//| MACD.mq4 | //| Copyright © 2005, David W. Thomas | //| mailto:davidwt@usa.net | //+------------------------------------------------------------------+ // This is the correct computation and
display of MACD. #property copyright "Copyright © 2005, David W. Thomas" #property link "mailto:davidwt@usa.net" #property indicator_separate_window #property indicator_buffers 3 #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+","+SlowMA Period+","+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); } //+------------------------------------------------------------------+ DogiStars.mq4 Shows Dogis plus Morning and Evening Dogi Stars /* * Filename: DogiStars.mq4 * Author: DriverDan * Date: Oct 28, 2005 * * Description: Indicator that displays Dogis and Morning and Evening Dogi stars. * * Version: 1.0 * Initial release */ #property copyright "Copyright © 2005, DriverDan" #property indicator_chart_window #property indicator_buffers 3 #property indicator_color1 Yellow #property indicator_color2 Red #property indicator_color3 Red #define UP 1 #define DOWN 2 extern int showDogis = 1; // 1 = Show a star for Dogis extern int showArrows = 1; // 1 = Arrows for morning and evening Dogi stars double dogiBuffer[]; double upBuffer[]; double downBuffer[]; /* * Initialization function */ int init() { SetIndexStyle(0, DRAW_ARROW); SetIndexStyle(1, DRAW_ARROW); SetIndexStyle(2, DRAW_ARROW); SetIndexArrow(0, 171); SetIndexArrow(1, 225); SetIndexArrow(2, 226); SetIndexBuffer(0, dogiBuffer); SetIndexBuffer(1, upBuffer); SetIndexBuffer(2, downBuffer); SetIndexLabel(0, "Dogi"); SetIndexLabel(1, "Up Signal"); SetIndexLabel(2, "Down Signal"); return(0); } /* * Function to find a Dogi */ int findDogi(int i) { int retVal = 0; if(Low[i] < Low[i + 1] && Open[i] == Close[i]) { retVal = UP; } else if(High[i] > High[i + 1] && Open[i] == Close[i]) { retVal = DOWN; } return(retVal); } /* * Main program */ int start() { int i, dogiVal; int counted_bars = IndicatorCounted(); if(Bars < 3) return(0); // Loop and look for pivots for(i = Bars - counted_bars; i >= 0; i--) { if(i < Bars - 3) { // If we are showing Dogis look for them if(showDogis == 1) { dogiVal = findDogi(i); // If we found a dogi mark it if(dogiVal == UP) { dogiBuffer[i] = Low[i] - 4 * Point; } else if(dogiVal == DOWN) { dogiBuffer[i] = High[i] + 4 * Point; } } // If we are showing morning and evening dogi stars look for them if(showArrows == 1) { dogiVal = findDogi(i + 2); // If we found a morning or evening dogi star mark it if(dogiVal == UP && Open[i + 3] > Close[i + 3] && Open[i + 1] < Close[i + 1]) { upBuffer[i + 1] = Low[i + 1] - 4 * Point; } else if(dogiVal == DOWN && Open[i + 3] < Close[i + 3] && Open[i + 1] > Close[i + 1]) { downBuffer[i + 1] = High[i + 1] + 4 * Point; } } } } return(0); } b-clock.mq4 A very usefull Bar time counter. It assists in determining how much time is left before bar closing. Enjoy! //+------------------------------------------------------------------+ //| b-clock.mq4 | //| Copyright © 2005, Nick Bilak | //| Slightly Modified by adoleh2000 | //+------------------------------------------------------------------+ #property copyright "Copyright © 2005, Nick Bilak" #property link "http://metatrader.50webs.com/" #property indicator_chart_window #property indicator_buffers 1 //#property indicator_color1 OrangeRed //---- buffers double s1[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { /*SetIndexStyle(0,DRAW_HISTOGRAM,0,4,indicator_colo r1); SetIndexBuffer(0,s1); SetIndexLabel(0,"time to end"); IndicatorDigits(1); */ return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { double i; int m,s,k; m=Time[0]+Period()*60-CurTime(); i=m/60.0; s=m%60; m=(m-m%60)/60; Comment(m + " minutes " + s + " seconds left to bar end"); i=NormalizeDouble(i,1); for (k=1;k<=Bars-1;k++) s1[k]=0.0000001; for (k=1;k<=2;k++) s1[k]=i; //s1[0]=i; return(0); } //+------------------------------------------------------------------+ b-clock modified.mq4 Bar time counter similar to b-clock indicator with modification that counter is placed to the right of the bar and updates with every tick instead of a seperate window. Enjoy! //+------------------------------------------------------------------+ //| b-clock.mq4 | //| Core time code by Nick Bilak | //| http://metatrader.50webs.com/ beluck[at]gmail.com | //| modified by adoleh2000 and dwt5 | //+------------------------------------------------------------------+ #property copyright "Copyright © 2005, Nick Bilak" #property link "http://metatrader.50webs.com/" #property indicator_chart_window //---- buffers double s1[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { } return(0); //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { double i; int m,s,k; m=Time[0]+Period()*60-CurTime(); i=m/60.0; s=m%60; m=(m-m%60)/60; Comment( m + " minutes " + s + " seconds left to bar end"); ObjectDelete("time"); if(ObjectFind("time") != 0) { ObjectCreate("time", OBJ_TEXT, 0, Time[0], Close[0]+ 0.0005); ObjectSetText("time", " <"+m+":"+s, 12, "Arial", Black); } else { ObjectMove("time", 0, Time[0], Close[0]+0.0005); } return(0); } //+------------------------------------------------------------------+ EMAPredictive2.mq4 EMAPredictive2 -- a 'predicing' indicator using two EMAs. |
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Error codes script! | codersguru | Tools and utilities | 6 | 05-03-2008 12:14 AM |
| Spam of members coming from this forum : Aegis | BrunoFX | Non Related Discussions | 5 | 04-18-2007 03:50 PM |
| need help on codes | antone | Indicators - Metatrader 4 | 15 | 03-01-2007 01:48 PM |