AnotherInstr1





#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red
//---- input parameters
extern string     Instr="GBPUSD";
extern int        multistep=6;
extern bool       mirror=false;

double OUT[];
 
int init()
  {
//---- indicators
   IndicatorShortName("AnotherInstr "+Instr);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,OUT);
//----
   return(0);
  }
int deinit()
  {
   return(0);
  }
int start()
  {
     int limit;
     int counted_bars=IndicatorCounted();
     limit=Bars-counted_bars;     
     for(int i=0; i<limit; i++){  
       int period=2;
       double MA=0;
       for (int j=1;j<=multistep;j++){      
         double anotherHi=iHigh(Instr,0,iHighest(Instr,0,MODE_HIGH,period,iBarShift(Instr,0,Time[i])));
         double anotherLo=iLow(Instr,0,iLowest(Instr,0,MODE_LOW,period,iBarShift(Instr,0,Time[i])));
         double anotherCl=iClose(Instr,0,iBarShift(Instr,0,Time[i]));
         double anotherWidth=(anotherHi-anotherLo);
         double Hi=iHigh(NULL,0,iHighest(NULL,0,MODE_HIGH,period,i));
         double Lo=iLow(NULL,0,iLowest(NULL,0,MODE_LOW,period,i));
         double Cl=iClose(NULL,0,i);
         double Width=(Hi-Lo);
         
         if (anotherWidth>0) double pos=(anotherCl-anotherLo)/anotherWidth; else pos=0;       
         if (mirror) MA=MA+(Hi-pos*Width); else MA=MA+(Lo+pos*Width);         
         period=period*2;
       }//for
       OUT[i]=MA/multistep;
     }//for 
   return(0);
  }







Sample





Analysis



Market Information Used:

Series array that contains open time of each bar
Series array that contains the highest prices of each bar
Series array that contains the lowest prices of each bar
Series array that contains close prices for each bar


Indicator Curves created:

Implements a curve of type DRAW_LINE


Indicators Used:



Custom Indicators Used:

Order Management characteristics:

Other Features: