R2_Arrows_v4b

Author: Copyright � 2007 , transport_david , David W Honeywell
R2_Arrows_v4b
Price Data Components
Series array that contains close prices for each barSeries array that contains the highest prices of each barSeries array that contains the lowest prices of each bar
Indicators Used
Moving average indicatorRelative strength index
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
R2_Arrows_v4b
//+------------------------------------------------------------------+
//|                                                R2_Arrows_v4a.mq4 |
//|           Copyright © 2007 , transport_david , David W Honeywell |
//|                                     hellonwheels.trans@gmail.com |
//+------------------------------------------------------------------+

#property copyright "Copyright © 2007 , transport_david , David W Honeywell"
#property link      "hellonwheels.trans@gmail.com"

#property indicator_chart_window

#property indicator_buffers 3

#property indicator_color1 DeepSkyBlue
#property indicator_color2 Coral
#property indicator_color3 White


extern string s1 = "---------------";
extern int    Ma_Periods          =     200;
extern int    Ma_Type             =       1;
extern int    Ma_Applied_Price    =       0;

extern string s2 = "---------------";
extern int    RsiPeriods          =       4;
extern int    Rsi_Applied_Price   =       1;

extern string s3 = "---------------";
extern int    BuyIfDay1RsiBelow   =      65; // 1st day of tracking must be < this setting
extern int    BuyIfDay3RsiBelow   =      65; // 3rd day must be < this setting

extern string s4 = "---------------";
extern int    SellIfDay1RsiAbove  =      35; // 1st day of tracking must be > this setting
extern int    SellIfDay3RsiAbove  =      35; // 3rd day must be > this setting

extern string s5 = "---------------";
extern int    ShowBars            =   1000;

double Trend_Ma[];
double Sell_Arrow[];
double Buy_Arrow[];
double Close_Trade_Marker[];

double prevtime;

//+-------------+
//| Init        |
//+-------------+
int init()
  {
   IndicatorBuffers(5);
   
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2);
   SetIndexEmptyValue(0,0.0);
   SetIndexBuffer(0,Trend_Ma);
   SetIndexLabel(0,"Trend_Ma_Periods ( "+Ma_Periods+" )");
   
   SetIndexEmptyValue(1,0.0);
   SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,1);
   SetIndexArrow(1,234);
   SetIndexBuffer(1,Sell_Arrow);
   SetIndexLabel(1,"Sell_Arrow ( RsiPeriods "+RsiPeriods+" )");
   
   SetIndexEmptyValue(2,0.0);
   SetIndexStyle(2,DRAW_ARROW,STYLE_SOLID,1);
   SetIndexArrow(2,233);
   SetIndexBuffer(2,Buy_Arrow);
   SetIndexLabel(2,"Buy_Arrow ( RsiPeriods "+RsiPeriods+" )");
   
   Print("Init complete");
  }


//+-------------+
//| De-init     |
//+-------------+
int deinit()
  {
   Print("De-init complete");
  }

//+-------------+
//| Start       |
//+-------------+
int start()
  {

   double    Day1;
   double    Day2;
   double    Day3;
   double    Today;

   int       shift;
   
     for ( shift = ShowBars; shift >= 0; shift-- )
      {
       
       Trend_Ma[shift] = iMA( Symbol(), 0, Ma_Periods, 0, Ma_Type, Ma_Applied_Price, shift);
       
       if (prevtime != Time[0]) { RefreshRates(); prevtime=Time[0]; } 
       
       Day1 = iRSI(Symbol(),0,RsiPeriods,Rsi_Applied_Price,shift+3);
       Day2 = iRSI(Symbol(),0,RsiPeriods,Rsi_Applied_Price,shift+2);
       Day3 = iRSI(Symbol(),0,RsiPeriods,Rsi_Applied_Price,shift+1);
       Today = iRSI(Symbol(),0,RsiPeriods,Rsi_Applied_Price,shift);
       
       //- Sell Arrows ---
       
       if ( (iClose(Symbol(),0,shift+1) < Trend_Ma[shift+1]) && (Day1 > SellIfDay1RsiAbove) && (Day2 > Day1) && (Day3 > Day2) && (Day3 > SellIfDay3RsiAbove) )
          
          Sell_Arrow[shift] = iHigh(Symbol(),0,shift) + (20*Point); // High arrow Sell
       
       //- Buy Arrows ---
       
       if ( (iClose(Symbol(),0,shift+1) > Trend_Ma[shift+1]) && (Day1 < BuyIfDay1RsiBelow) && (Day2 < Day1) && (Day3 < Day2) && (Day3 < BuyIfDay3RsiBelow) )
          
          Buy_Arrow[shift] = iLow(Symbol(),0,shift) - (20*Point); // Low arrow Buy 
       
      }
   
  }

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