[i]AO_MFI_MA_Ron_01

Author: Ron T
[i]AO_MFI_MA_Ron_01

This script is designed to display trading signals and supporting information on a currency chart within the MetaTrader platform. It uses several technical indicators to identify potential buying and selling opportunities.

Here's a breakdown of what the script does:

  1. Data Preparation: The script starts by gathering data from the currency chart, including opening prices, high prices, and low prices for each period (e.g., each minute, hour, or day).
  2. Moving Averages: It calculates two exponential moving averages (EMAs) of the opening prices. EMAs are lines that smooth out price fluctuations to show the general price trend. One EMA uses a shorter period (8) and the other a longer period (21).
  3. Money Flow Index (MFI): The script computes the Money Flow Index (MFI) for a specified period (14). The MFI is an oscillator that indicates the strength of money flowing into and out of a security.
  4. Awesome Oscillator (AO): The script calculates the Awesome Oscillator (AO) that uses moving averages to measure market momentum.
  5. Signal Generation: The core of the script involves combining these indicators to generate buy and sell signals:
    • Buy Signal: The script looks for moments when the Awesome Oscillator is above zero AND the Money Flow Index is at or above 60. When these conditions are met, it places an upward-pointing arrow on the chart at the high price of that period, indicating a potential buying opportunity.
    • Sell Signal: Conversely, the script identifies potential selling opportunities when the Awesome Oscillator is below zero AND the Money Flow Index is at or below 40. It marks these points with a downward-pointing arrow at the low price of the period.
  6. Display: Finally, the script draws the two EMAs as lines and the buy/sell signals as arrows on the chart.

In essence, this script provides a visual way to identify possible entry and exit points for trades, based on the combined signals from moving averages, momentum (AO), and money flow (MFI).

Price Data Components
Indicators Used
Moving average indicatorBill Williams Awesome oscillatorMoney flow index
Miscellaneous
Implements a curve of type %1
2 Views
0 Downloads
0 Favorites
[i]AO_MFI_MA_Ron_01
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//| MA + MFI + AO                               |
//+------------------------------------------------------------------+
#property copyright "Ron T"
#property link      "http://www.lightpatch.com/forex"

#property indicator_chart_window
#property indicator_buffers 5

#property indicator_color1 Red
#property indicator_color2 White

#property indicator_color3 Aqua
#property indicator_color4 LightGreen

#property indicator_color5 DodgerBlue

extern int MovingAvg1=8;
extern int MovingAvg2=21;
extern int MFIPeriod=14;

//---- buffers
double Buffer0[];
double Buffer1[];
double Buffer2[];
double Buffer3[];
double Buffer4[];



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

int init()
  {
   // 233 up arrow
   // 234 down arrow
   // 241 hollow up
   // 242 hollow down
   // 159 big dot
   // 158 little dot
   // 168 open square
   // 120 box with X
   
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexBuffer(0, Buffer0);
   SetIndexArrow(0,242);
   
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexBuffer(1, Buffer1);
   SetIndexArrow(1,241);

   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2, Buffer2);

   SetIndexStyle(3,DRAW_LINE);
   SetIndexBuffer(3, Buffer3);

   SetIndexStyle(4,DRAW_LINE);
   SetIndexBuffer(4, Buffer4);

   return(0);
  }


//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   int i;
   
   for( i=0; i<Bars; i++ ) Buffer0[i]=0;
   for( i=0; i<Bars; i++ ) Buffer1[i]=0;
   for( i=0; i<Bars; i++ ) Buffer2[i]=0;
   for( i=0; i<Bars; i++ ) Buffer3[i]=0;
   for( i=0; i<Bars; i++ ) Buffer4[i]=0;

   return(0);
  }


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


int start()
  {
   int      pos=Bars-100; // leave room for moving average periods
   int      ctr=0;

   double p=Point();

   double  i0, i1, i2, i3, i4;
         
   
   while(pos>=0)
     {
      
      i0=iMA(Symbol(),0,MovingAvg1,0,PRICE_OPEN,MODE_EMA,pos);
      i1=iMA(Symbol(),0,MovingAvg2,0,PRICE_OPEN,MODE_EMA,pos);
      i2=iAO(Symbol(),0,pos);
      i3=iMFI(Symbol(),0,MFIPeriod,pos);
      
      Buffer2[pos]=i0;
      Buffer3[pos]=i1;

      //Long AO above 0 and MFI above 60
      if (i2>0 && i3>=60)
        {
         Buffer1[pos]=High[pos];
        }
        
      //Short AO below 0 and MFI below 40
      if (i2<0 && i3<=40)
        {
         Buffer0[pos]=Low[pos]; 
        }
        

      
 	   pos--;
     }

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