GreenTrader & Trend (по просьбе Munmar) GREEN TRADER //+------------------------------------------------------------------+ //| GreenTrader.mq4 | //| | //| | //+------------------------------------------------------------------+ #property copyright "Slim" #property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 Red #property indicator_color2 DarkViolet #property indicator_level1 0.0 //---- input parameters //extern int x_prd=0; extern int period1=21; extern int period2=44; extern int period3=89; extern int period4=200; extern int depth =15; extern int CountBars=3000; //---- buffers double Line[]; //double indOBV[]; //double prise[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicator line IndicatorBuffers(2); SetIndexBuffer(0,Line); SetIndexStyle(0,DRAW_LINE,EMPTY, 2); //---- //---- return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int start() { int i,j; double EMA1[10],EMA2[10],EMA3[10],EMA4[10]; //---- //---- if (CountBars<Bars-period4-1) i=CountBars; else i=Bars-period4-1; while(i>=0) { Line=0; j=0; while(j<=depth) { if ( iMA(NULL,0,period1,0 ,MODE_EMA,PRICE_CLOSE,i+j)>iMA(NULL,0,period1,0 ,MODE_EMA,PRICE_CLOSE,i+j+1) ) EMA1[j] =1; else EMA1[j] =-1 ; if ( iMA(NULL,0,period2,0 ,MODE_EMA,PRICE_CLOSE,i+j)>iMA(NULL,0,period2,0 ,MODE_EMA,PRICE_CLOSE,i+j+1) ) EMA2[j] =1; else EMA2[j] =-1 ; if ( iMA(NULL,0,period3,0 ,MODE_EMA,PRICE_CLOSE,i+j)>iMA(NULL,0,period3,0 ,MODE_EMA,PRICE_CLOSE,i+j+1) ) EMA3[j] =1; else EMA3[j] =-1 ; if ( iMA(NULL,0,period4,0 ,MODE_EMA,PRICE_CLOSE,i+j)>iMA(NULL,0,period4,0 ,MODE_EMA,PRICE_CLOSE,i+j+1) ) EMA4[j] =1; else EMA4[j] =-1 ; j++; } //if (i==0) Alert(EMA1[0]," ", EMA1[1]," ",EMA1[2]," ",EMA1[3]," "); for(j=0;j<=depth;j++) { Line=Line+EMA1[j]+EMA2[j]+EMA3[j]+EMA4[j]; } i--; } return(0); } //+------------------------------------------------------------------+ TREND //+------------------------------------------------------------------+ //| Trend.mq4 | //| | //| Ramdass - Conversion only | //+------------------------------------------------------------------+ #property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 Blue #property indicator_color2 Red //---- input parameters extern int Bands_Mode_0_2=0; // =0-2 MODE_MAIN, MODE_LOW, MODE_HIGH extern int Power_Price_0_6=0; // =0-6 PRICE_CLOSE,PRICE_OPEN,PRICE_HIGH,PRICE_LOW,PRICE_MEDIAN,PRICE_TYPICAL,PRICE_WEIGHTED extern int Price_Type_0_3=0; // =0-3 PRICE_CLOSE,PRICE_OPEN,PRICE_HIGH,PRICE_LOW extern int Bands_Period=20; extern int Bands_Deviation=2; extern int Power_Period=13; extern int CountBars=300; //---- buffers double value[]; double value2[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { // string short_name; //---- indicator line IndicatorBuffers(2); SetIndexStyle(0,DRAW_LINE); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(0,value); SetIndexBuffer(1,value2); //---- //---- return(0); } //+------------------------------------------------------------------+ //| Trend | //+------------------------------------------------------------------+ int start() { SetIndexDrawBegin(0,Bars-CountBars+Bands_Period+1); SetIndexDrawBegin(1,Bars-CountBars+Bands_Period+1); int i,CurrentBar,Bands_Mode,counted_bars=IndicatorCounted(); double Power_Price,CurrentPrice; //---- if(Bars<=Bands_Period) return(0); //---- initial zero if(counted_bars<Bands_Period) { for(i=1;i<=Bands_Period;i++) value[bars-i]=0.0; for(i=1;i<=Bands_Period;i++) value2[bars-i]=0.0; } //---- i=CountBars-Bands_Period-1; if(counted_bars>=Bands_Period) i=CountBars-counted_bars-1; if (Bands_Mode_0_2==1) Bands_Mode=MODE_LOW; if (Bands_Mode_0_2==2) Bands_Mode=MODE_HIGH; if (Bands_Mode_0_2==0) Bands_Mode=MODE_MAIN; if (Power_Price_0_6==1) Power_Price=PRICE_OPEN; if (Power_Price_0_6==2) Power_Price=PRICE_HIGH; if (Power_Price_0_6==3) Power_Price=PRICE_LOW; if (Power_Price_0_6==4) Power_Price=PRICE_MEDIAN; if (Power_Price_0_6==5) Power_Price=PRICE_TYPICAL; if (Power_Price_0_6==6) Power_Price=PRICE_WEIGHTED; if (Power_Price_0_6==6) Power_Price=PRICE_CLOSE; for (i=CountBars-1; i>=0; i--) { if (Price_Type_0_3==1) CurrentPrice=Open; if (Price_Type_0_3==2) CurrentPrice=High; if (Price_Type_0_3==3) CurrentPrice=Low; if (Price_Type_0_3==0) CurrentPrice=Close; value=CurrentPrice-iBands(NULL,0,Bands_Period,Bands_Deviation,0,Bands_Mode,Power_Price,i); value2=-(iBearsPower(NULL,0,Power_Period,Power_Price,i)+iBullsPower(NULL,0,Power_Period,Power_Price,i)); } return(0); } //+------------------------------------------------------------------+