StochCCI_Arrows_v7

Author: Gideon Smolders copyright 2007
StochCCI_Arrows_v7
Indicators Used
Stochastic oscillatorCommodity channel index
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
StochCCI_Arrows_v7
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+

#property copyright "Gideon Smolders copyright 2007"
#property link      "MetaTrader Group"

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Coral
#property indicator_color2 White


//---- input parameters


extern int RSIfast         =3;
extern int RSIslow         =10;

extern int StochFast       =4;
extern int StochSlow       =10;

extern int CCIperiod       =34;

//---- buffers

double ExtMapBuffer0[];
double ExtMapBuffer1[];
double ExtMapBuffer2[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+

int init()
  {
//---- indicators
   
   IndicatorBuffers(3);
   
   SetIndexEmptyValue(0,0.0);
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,234);
   SetIndexBuffer(0,ExtMapBuffer0);
   
   SetIndexEmptyValue(1,0.0);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,233);
   SetIndexBuffer(1,ExtMapBuffer1);
   
   SetIndexEmptyValue(2,0.0);
   SetIndexStyle(2,DRAW_ARROW);
   SetIndexArrow(2,172);
   SetIndexBuffer(2,ExtMapBuffer2);
   
   IndicatorShortName("RSI_Arrows");
   
//----
   return(0);
  }

//+------------------------------------------------------------------+ 
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+

int deinit()
  {
//---- 
   
//----
   return(0);
  } 

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+ 

int start()
  {
   
//---- 
   for (int i=Bars-50; i>=0; i--)
      {
      
      double prevtime;
      if (prevtime != Time[0]) { RefreshRates(); prevtime=Time[0]; } 
      
      double StochSignal0 = iStochastic(Symbol(),0,StochFast,StochFast,1,MODE_LWMA,1,MODE_SIGNAL,i);
      double StochSignal1 = iStochastic(Symbol(),0,StochFast,StochFast,1,MODE_LWMA,1,MODE_SIGNAL,i+1);
      
      double StochSignal0slow = iStochastic(Symbol(),0,StochSlow,StochSlow,1,MODE_LWMA,1,MODE_SIGNAL,i);
      double StochSignal1slow = iStochastic(Symbol(),0,StochSlow,StochSlow,1,MODE_LWMA,1,MODE_SIGNAL,i+1);
   
      double CCIslow0 = iCCI(Symbol(),0,7,PRICE_OPEN,i);
      double CCIslow1 = iCCI(Symbol(),0,7,PRICE_OPEN,i+1);
      
      double CCIfast0 = iCCI(Symbol(),0,7,PRICE_CLOSE,i);
      double CCIfast1 = iCCI(Symbol(),0,7,PRICE_CLOSE,i+1);
      
      //- Sell Arrows ---
      if (
         (StochSignal0slow<80 && StochSignal1slow>80 && StochSignal0<StochSignal1 && CCIfast0<CCIslow0)||
         (StochSignal0<80 && StochSignal1>80 && StochSignal0<StochSignal0slow && StochSignal1>StochSignal1slow && CCIfast0<CCIslow0)
         )
         ExtMapBuffer0[i]=High[i]+(5*Point);//High arrow Sell
      
      //- Buy Arrows ----
      if (
         (StochSignal0slow>20 && StochSignal1slow<20 && StochSignal0>StochSignal1 && CCIfast0>CCIslow0)||
         (StochSignal0>20 && StochSignal1<20 && StochSignal0>StochSignal0slow && StochSignal1<StochSignal1slow && CCIfast0>CCIslow0)
         )
         ExtMapBuffer1[i]=Low[i]-(5*Point);//Low arrow Buy 
      

      }
       
//----
   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 ---