Author: zzuegg
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
AutoS-R_v1
//+------------------------------------------------------------------+
//|                                                      AutoS-R.mq4 |
//|                                                    zzuegg        |
//|                                       when-money-makes-money.com |
//+------------------------------------------------------------------+
#property copyright "zzuegg"
#property link      "when-money-makes-money.com"

#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 Red
#property indicator_color2 Red
#property indicator_color3 Red
#property indicator_color4 Red
#property indicator_color5 Red
#property indicator_color6 Red
#property indicator_color7 Red
#property indicator_color8 Red
//---- buffers
double sr1[];
double sr2[];
double sr3[];
double sr4[];
double sr5[];
double sr6[];
double sr7[];
double sr8[];

extern int period=0;
extern int SR_Count=4;
extern color SR_Color = Red;
extern int SR_Size  = 3;
extern int ArrowCode=160;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_ARROW,STYLE_SOLID,SR_Size,SR_Color);
   SetIndexArrow(0,ArrowCode);
   SetIndexBuffer(0,sr1);
   SetIndexEmptyValue(0,0.0);
   
   SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,SR_Size,SR_Color);
   SetIndexArrow(1,ArrowCode);
   SetIndexBuffer(1,sr2);
   SetIndexEmptyValue(1,0.0);
   SetIndexStyle(2,DRAW_ARROW,STYLE_SOLID,SR_Size,SR_Color);
   SetIndexArrow(2,ArrowCode);
   SetIndexBuffer(2,sr3);
   SetIndexEmptyValue(2,0.0);
   SetIndexStyle(3,DRAW_ARROW,STYLE_SOLID,SR_Size,SR_Color);
   SetIndexArrow(3,ArrowCode);
   SetIndexBuffer(3,sr4);
   SetIndexEmptyValue(3,0.0);
   SetIndexStyle(4,DRAW_ARROW,STYLE_SOLID,SR_Size,SR_Color);
   SetIndexArrow(4,ArrowCode);
   SetIndexBuffer(4,sr5);
   SetIndexEmptyValue(4,0.0);
   SetIndexStyle(5,DRAW_ARROW,STYLE_SOLID,SR_Size,SR_Color);
   SetIndexArrow(5,ArrowCode);
   SetIndexBuffer(5,sr6);
   SetIndexEmptyValue(5,0.0);
   SetIndexStyle(6,DRAW_ARROW,STYLE_SOLID,SR_Size,SR_Color);
   SetIndexArrow(6,ArrowCode);
   SetIndexBuffer(6,sr7);
   SetIndexEmptyValue(6,0.0);
   SetIndexStyle(7,DRAW_ARROW,STYLE_SOLID,SR_Size,SR_Color);
   SetIndexArrow(7,ArrowCode);
   SetIndexBuffer(7,sr8);
   SetIndexEmptyValue(7,0.0);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int counted_bars = IndicatorCounted();
   if(counted_bars < 0)  return(-1);
   if(counted_bars > 0)   counted_bars--;
   int limit = Bars - counted_bars;
   if(counted_bars==0) limit--;

//----
   for(int i=limit;i>=0;i--){

      double swing_value[9]={0,0,0,0,0,0,0,0,0};
      int found=0;
      int j=iBarShift(Symbol(),period,Time[i],false);
      while(found<(SR_Count+1)&&j<Bars){
         if(iCustom(Symbol(),period,"ZigZag",6,5,3,0,j)!=0){
            swing_value[found]=iCustom(Symbol(),period,"ZigZag",6,5,3,0,j);
            found++;
         }
         j++;
      }      
      sr1[i]=swing_value[1];
      sr2[i]=swing_value[2];
      sr3[i]=swing_value[3];
      sr4[i]=swing_value[4];
      sr5[i]=swing_value[5];
      sr6[i]=swing_value[6];
      sr7[i]=swing_value[7]; 
      sr8[i]=swing_value[8];                                         
   }
   Comment("Support us, donate on this website: www.when-money-makes-money.com/download");
//----
   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 ---