Candle Doji

Author: DeltaTrader
0 Views
0 Downloads
0 Favorites
Candle Doji
ÿþ

#property copyright "DeltaTrader"

#property link      "www.deltatrader.com.br"

#property version   "1.00"

//

#property indicator_chart_window

#property indicator_buffers 1

#property indicator_plots   1



//--- plot Arrows

#property indicator_label1  "Arrows"

#property indicator_type1   DRAW_ARROW

#property indicator_color1  clrYellow

#property indicator_width1  8



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

//|                                                                  |

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

double IndValue[];



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

//| Custom indicator initialization function                         |

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

int OnInit()

  {

//--- indicator buffers mapping

   SetIndexBuffer(0,IndValue,INDICATOR_DATA);

// especificar qual tipo de "arrow" deve ser utilizado

   PlotIndexSetInteger(0,PLOT_ARROW,0x8C);

   PlotIndexSetInteger(0,PLOT_ARROW_SHIFT,0);

   PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,0);

   

//---

   return(INIT_SUCCEEDED);

  }

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

//| Custom indicator iteration function                              |

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

int OnCalculate(const int rates_total,

                const int prev_calculated,

                const datetime &time[],

                const double &open[],

                const double &high[],

                const double &low[],

                const double &close[],

                const long &tick_volume[],

                const long &volume[],

                const int &spread[])

  {

//---

   // DOJI

   if(prev_calculated==0) // loop inicial

     {

      // open == close

      for(int i=0;i<rates_total;i++)

        {

         // 

         if(open[i]==close[i])

           {

            IndValue[i] = low[i] - 50;

           }

         else

           {

            IndValue[i] = 0;

           }

        }

     }

   else // atualiza apenas o candle corrente

     {

      if(open[rates_total-1]==close[rates_total-1])

        {

         IndValue[rates_total-1] = low[rates_total-1] - 50;

        }

      else

        {

         IndValue[rates_total-1] = 0;

        }

     }

   

//--- return value of prev_calculated for next call

   return(rates_total);

  }

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

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