Author: CutzMF
cutz_trend
Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
cutz_trend
//+------------------------------------------------------------------+
//|                                                   cutz_TREND.mq4 |
//|                                                           CutzMF |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "CutzMF"
#property link      ""

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Green
#property indicator_color2 Red
//---- input parameters
extern double    BarBody=0.0094;
extern int CountBars=350;
//---- buffers
double UP[];
double DN[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,167);
   SetIndexBuffer(0,UP);
   SetIndexEmptyValue(0,0.0);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,167);
   SetIndexBuffer(1,DN);
   SetIndexEmptyValue(1,0.0);
   BarBody=BarBody*BarBody;
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    shift,i,counted_bars=IndicatorCounted(); 
   double bar;
   double csma2,psma2,
          csma7,psma7;
//----
   for (shift = CountBars; shift>=0; shift--)  
     {
     bar=Close[shift]-Open[shift];
     bar=(bar)*(bar);
     for (i=0;i<=3;i++)
     {
     psma2=iMA(NULL,0,2,0,i,PRICE_CLOSE,shift+1);//ïðåäûäóùèå
     psma7=iMA(NULL,0,7,0,i,PRICE_CLOSE,shift+1);
     csma2=iMA(NULL,0,2,0,i,PRICE_CLOSE,shift);//íàñòîÿùèå
     csma7=iMA(NULL,0,7,0,i,PRICE_CLOSE,shift);
     
     if ((csma2>psma2)&&(csma7>=psma7)&&(bar>=BarBody)) { UP[shift]=Low[shift]-10*Point; }
     if ((csma2<psma2)&&(csma7<=psma7)&&(bar>=BarBody)) { DN[shift]=High[shift]+10*Point; }
     }
     } 
//----
   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 ---