- //+------------------------------------------------------------------+
- //| Darma System Indicator (beta).mq4 |
- //| tonyc2a@yahoo.com |
- //| |
- //+------------------------------------------------------------------+
- #property copyright "tonyc2a@yahoo.com"
- #property link ""
- #property indicator_chart_window
- #property indicator_buffers 4
- //---- input parameters
- extern int WingDings_Symbol = 108;
- //---- buffers
- double Buffer1[];
- double Buffer2[];
- double Buffer3[];
- double Buffer4[];
- double Buffer5[];
- double Buffer6[];
- //+------------------------------------------------------------------+
- //| Custom indicator initialization function |
- //+------------------------------------------------------------------+
- int init()
- {
- //---- indicators
- SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,2,Blue);
- SetIndexBuffer(0,Buffer1);
- SetIndexLabel(0,"Blue Bar");
- SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,2,Red);
- SetIndexBuffer(1,Buffer2);
- SetIndexLabel(1,"Red Bar");
- SetIndexStyle(2,DRAW_ARROW,STYLE_DOT,2,Blue);
- SetIndexBuffer(2,Buffer3);
- SetIndexLabel(2,"Blue Dot");
- SetIndexArrow(2,WingDings_Symbol);
- SetIndexStyle(3,DRAW_ARROW,STYLE_DOT,2,Red);
- SetIndexBuffer(3,Buffer4);
- SetIndexLabel(3,"Red Dot");
- SetIndexArrow(3,WingDings_Symbol);
- //SetIndexStyle(4,DRAW_SECTION,STYLE_SOLID,1,Blue);
- //SetIndexBuffer(4,Buffer5);
- //SetIndexLabel(4,"Blue");
- //SetIndexStyle(5,DRAW_SECTION,STYLE_SOLID,1,Red);
- //SetIndexBuffer(5,Buffer6);
- //SetIndexLabel(5,"Red");
- //----
- 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();
- //---- TODO: add your code here
- int adjustment=0; //change this value to make the indicator behave slightly differently. valid values are 0-4.
- int periods=3;
- int extremes=0;
- double smin, smax, SsMax, SsMin, pivothi, pivotlo, margins;
- bool flag1, flag2;
-
- for(int i=0;i<Bars;i++){
- if(extremes!=0){
- SsMax = High[Highest(NULL,0,MODE_OPEN,periods,i+adjustment)];
- SsMin = Low[Lowest(NULL,0,MODE_OPEN,periods,i+adjustment)];
- }
- else{
- SsMax = Open[Highest(NULL,0,MODE_OPEN,periods,i+adjustment)];
- SsMin = Open[Lowest(NULL,0,MODE_OPEN,periods,i+adjustment)];
- }
- smin = SsMin+(SsMax-SsMin)*margins/100;
- smax = SsMax-(SsMax-SsMin)*margins/100;
- pivothi=((2*High[i])+Low[i]+(2*Close[i]))/5;
- pivotlo=(High[i]+(2*Low[i])+(2*Close[i]))/5;
- if(pivotlo>smin && pivothi>smax) flag1=true; else flag1=false;
- if(pivothi<smax && pivotlo<smin) flag2=true; else flag2=false;
-
- if(flag1){
- Buffer1[i]=High[i];
- Buffer2[i]=Low[i];
- }
- if(flag2){
- Buffer1[i]=Low[i];
- Buffer2[i]=High[i];
- }
-
- double sig=iSAR(NULL,0,0.5,1,i);
- if(sig<Low[i]) Buffer3[i]=sig;
- if(sig>High[i]) Buffer4[i]=sig;
-
-
-
- }//end for
- //----
- return(0);
- }
- //+------------------------------------------------------------------+
|