AnotherInstr1sep

AnotherInstr1sep
Price Data Components
Series array that contains the highest prices of each barSeries array that contains the lowest prices of each barSeries array that contains close prices for each bar
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
AnotherInstr1sep
#property indicator_separate_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_HISTOGRAM);
   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]=Cl-MA/multistep;
     }//for 
   return(0);
  }



Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---