MTF_AbsoluteStrength_sBar





//+------------------------------------------------------------------+
//|         MTF_     AbsoluteStrength_v1.1  Sidebar   mq4 |
//|       forex-tsd.com  Copyright © 2006, MetaQuotes Software Corp. |
//|                           Copyright © 2006, TrendLaboratory Ltd. |
//|            http://finance.groups.yahoo.com/group/TrendLaboratory |
//|                                       E-mail: igorad2004@list.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, TrendLaboratory Ltd."
#property link      "http://finance.groups.yahoo.com/group/TrendLaboratory"

#property indicator_separate_window

#property indicator_buffers 3
#property indicator_color1  LightBlue
#property indicator_color2 Tomato
#property indicator_color3 Yellow
#property indicator_maximum 77
#property indicator_minimum 1

//---- input parameters
extern int TimeFrame =0;
extern int ASbarLevel = 4; // bar location in sep.windpw(from 1(min) to 77(max))
extern int       Mode   =  0; // 0-RSI method; 1-Stoch method; 2-ADX method
extern string note = "Level:1-77;Mode:RSI1;Stoch2;ADX3";
extern int       Length = 10; // Period
extern int       Smooth =  5; // Period of smoothing
extern int       Signal =  5; // Period of Signal Line
extern int       Price  =  0; // Price mode : 0-Close,1-Open,2-High,3-Low,4-Median,5-Typical,6-Weighted
extern int       ModeMA =  3; // Mode of Moving Average
extern string note1 = "Price(OCHLMTF)ModeMa(SMA0,EMA1,SmmMA2,LWMA3";

/*************************************************************************
PERIOD_M1   1
PERIOD_M5   5
PERIOD_M15  15
PERIOD_M30  30 
PERIOD_H1   60
PERIOD_H4   240
PERIOD_D1   1440
PERIOD_W1   10080
PERIOD_MN1  43200
You must use the numeric value of the timeframe that you want to use
when you set the TimeFrame' value with the indicator inputs.
---------------------------------------
MODE_SMA    0 Simple moving average, 
MODE_EMA    1 Exponential moving average, 
MODE_SMMA   2 Smoothed moving average, 
MODE_LWMA   3 Linear weighted moving average. 
You must use the numeric value of the MA Method that you want to use
when you set the 'ma_method' value with the indicator inputs.

**********************************************************/
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];

double SmthBulls[];
double SmthBears[];
double SigBulls[];
double SigBears[];
double SigNoTrade[];

string TimeFrameStr;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
  SetIndexStyle(0,DRAW_ARROW);
  SetIndexBuffer(0,ExtMapBuffer1);
  SetIndexStyle(1,DRAW_ARROW);
  SetIndexBuffer(1,ExtMapBuffer2);
  SetIndexStyle(2,DRAW_ARROW);
  SetIndexBuffer(2,ExtMapBuffer3);

   SetIndexArrow(0,59);  // 111,249,250(hollowSquare);
   SetIndexArrow(1,59);// 176,177,164,165 (target)  161,162 circle
   SetIndexArrow(2,159);  // 251(x), 158,159(dot), 115,119(romb), 

   SetIndexLabel(0,"AS_Bulls("+TimeFrame+")");
   SetIndexLabel(1,"AS_Bears("+TimeFrame+")");
   SetIndexLabel(2,"AS_NoTrade("+TimeFrame+")");


switch(TimeFrame)
   {
      case 1 : TimeFrameStr="Period_M1"; break;
      case 5 : TimeFrameStr="Period_M5"; break;
      case 15 : TimeFrameStr="Period_M15"; break;
      case 30 : TimeFrameStr="Period_M30"; break;
      case 60 : TimeFrameStr="Period_H1"; break;
      case 240 : TimeFrameStr="Period_H4"; break;
      case 1440 : TimeFrameStr="Period_D1"; break;
      case 10080 : TimeFrameStr="Period_W1"; break;
      case 43200 : TimeFrameStr="Period_MN1"; break;
      default : TimeFrameStr="Current TimeFrame"; TimeFrame=0;
   }
   IndicatorShortName("MTF_ASsb("+TimeFrameStr+")["+Length+"]");  
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   datetime TimeArray[];
   int    i,limit,y=0,counted_bars=IndicatorCounted();
 
// Plot defined time frame on to current time frame
   ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame); 
   
   limit=Bars-counted_bars+TimeFrame/Period();
   for(i=0,y=0;i<limit;i++)
   {
   if (Time[i]<TimeArray[y]) y++;
 
   ExtMapBuffer1[i]=EMPTY_VALUE;
   ExtMapBuffer2[i]=EMPTY_VALUE;
   ExtMapBuffer3[i]=EMPTY_VALUE;
   
double SmthBulls   =iCustom(NULL,TimeFrame,"AbsoluteStrength_v1.1",  Mode, Length,Smooth, Signal, Price, ModeMA,0,0,0,y);
double SmthBears   =iCustom(NULL,TimeFrame,"AbsoluteStrength_v1.1",  Mode, Length,Smooth, Signal, Price, ModeMA,0,0,1,y);
double SigBulls    =iCustom(NULL,TimeFrame,"AbsoluteStrength_v1.1",  Mode, Length,Smooth, Signal, Price, ModeMA,0,0,2,y);
double SigBears    =iCustom(NULL,TimeFrame,"AbsoluteStrength_v1.1",  Mode, Length,Smooth, Signal, Price, ModeMA,0,0,3,y);
   
   if(SmthBulls >  SmthBears )ExtMapBuffer1[i] = ASbarLevel;//
   if(SmthBulls <= SmthBears )ExtMapBuffer2[i] = ASbarLevel;//
   if(SmthBulls < SigBulls && SmthBears < SigBears)ExtMapBuffer3[i] = ASbarLevel;//
}
   //----  Refresh buffers ++++++++++++++++++++ upgrade by Raff  
     int TimeFrame;   if (TimeFrame>Period()) {
     int PerINT=TimeFrame/Period()+1;
     datetime TimeArr[]; ArrayResize(TimeArr,PerINT);
     ArrayCopySeries(TimeArr,MODE_TIME,Symbol(),Period()); 
     for(i=0;i<PerINT+1;i++) {if (TimeArr[i]>=TimeArray[0]) {
 /********************************************************  
    Refresh buffers:         buffer[i] = buffer[0];
 ********************************************************/  

      ExtMapBuffer1[i] = ExtMapBuffer1[0];
      ExtMapBuffer2[i] = ExtMapBuffer2[0];
      ExtMapBuffer3[i] = ExtMapBuffer3[0];
//--
   } } }
//+++++++++++++++++++++++++++++++++++++++++++++++++++  Raff  
   return(0);
  }
//+-------------------------------------------------------+



Sample





Analysis



Market Information Used:

Series array that contains open time of each bar


Indicator Curves created:

Implements a curve of type DRAW_ARROW


Indicators Used:




Custom Indicators Used:
AbsoluteStrength_v1.1

Order Management characteristics:

Other Features: