Author: Copyright � 2010, InvestmentKit.com
Doda-Trend
Indicators Used
Indicator of the average true rangeStandard Deviation indicator
2 Views
1 Downloads
0 Favorites
Doda-Trend
//+------------------------------------------------------------------+
//|                                                   Doda-Trend.mq4 |
//|                              Copyright © 2010, InvestmentKit.com |
//|                                     http://www.InvestmentKit.com |
//|                                        http://www.DodaCharts.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, InvestmentKit.com"
#property link      "http://www.InvestmentKit.com"

#property indicator_chart_window


double myatr, mystd;
string atrresult;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
//----
ObjectCreate("myatr",OBJ_LABEL,0,0,0);
ObjectCreate("myatrheading",OBJ_LABEL,0,0,0);

   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   ObjectDelete("myatr");   
   ObjectDelete("myatrheading");   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
//----
myatr = iATR(NULL,0,14,0);
mystd = iStdDev(NULL,0,14,0,MODE_EMA,PRICE_CLOSE,0);

if (myatr > mystd) atrresult = "Range-Bound";
if (myatr < mystd) atrresult = "Trending";

///////////////////////////////////////////////////////

ObjectSetText("myatrheading","Trend Indicator v1.0 by InvestmentKit.com", 10, "Arial", Red);
ObjectSet("myatrheading",OBJPROP_XDISTANCE,2);
ObjectSet("myatrheading",OBJPROP_YDISTANCE,40);
ObjectSet("myatrheading", OBJPROP_CORNER, 2);

ObjectSetText("myatr",StringConcatenate("Current Trend: ", atrresult), 10, "Arial", Red);
ObjectSet("myatr",OBJPROP_XDISTANCE,2);
ObjectSet("myatr",OBJPROP_YDISTANCE,20);
ObjectSet("myatr", OBJPROP_CORNER, 2);
//----
   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 ---