Skip to main content

How to create a custom forex indicator for MT4

In this post, I am going to show you How to create a custom forex indicator for MT4. But if you learn how to, please note that the code below is given for educational purposes and if you want to to use it for commercial/ selling, you need to attribute the source. The code is licensed under creatives common.... Simply add https://keithrainz.me/ when giving it out.

We are going to create a Belly System simple indicator

This is part 1 of coding an indicator like belly system. For part 2, simply like the video, comment part 2, subscribe to my channel and share the video. will release part 2 when the video below gets 1k views.

Requirements to create a custom forex indicator for MT4

  • You will need MT4 installed
  • An internet connection.

How to create a custom forex indicator for MT4?

Watch the video below and get the error-free well coded source code.

//---- File Properties
#property copyright   "Keith Rainz"
#property link        "https://keithrainz.me/how-to-create-a-custom-forex-indicator-for-mt4/"
#property description "belly system-like indicator that plots breakout arrows."
#property version     "1.0"
#property strict
//---- Indicator drawing and buffers
#property indicator_chart_window
#property indicator_buffers 2
//---- Colors and sizes for buffers
#property indicator_color1 clrDodgerBlue
#property indicator_color2 clrTomato
#property indicator_width1 2
#property indicator_width2 2
//---- Buffer Arrays
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------
//| Custom indicator initialization function 
//+------------------------------------------
int init()

    // First buffer
    SetIndexBuffer(0, ExtMapBuffer1);  // Assign buffer array
    SetIndexStyle(0, DRAW_ARROW);      // Style to arrow
    SetIndexArrow(0, 233);             // Arrow code
    
    //Second buffer
    SetIndexBuffer(1, ExtMapBuffer2);  // Assign buffer array          
    SetIndexStyle(1, DRAW_ARROW);      // Style to arrow
    SetIndexArrow(1, 234);             // Arrow code
    
    // Exit
    return(0);

  
//+-------------------------------------
//| 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[])

    // Start and limit
    int start = 1;
    int limit;
    
    // Bars counted so far
    int counted_bars = IndicatorCounted();
    // No more bars?
    if(counted_bars < 0) 
        return(-1);
    // Do not check repeated bars
    limit = Bars - 1 - counted_bars;
    
    // Iterate bars from past to present
    for(int i = limit; i >= start; i--)
    
      // If not enough data...
      if(i > Bars-2) continue;
      
      // Check buy signal
      if(Close[i] > High[i+1])
      
         ExtMapBuffer1[i] = Low[i];
      
      
      // Sell check signal
      if(Close[i] < Low[i+1])
      
         ExtMapBuffer2[i] = High[i];
      
    
    
    // Exit
    return(rates_total);
https://youtu.be/K4ylkdZ-qJE
how to create a forex indicator
https://keithrainz.me/how-to-create-a-custom-forex-indicator-for-mt4/?feed_id=251&_unique_id=64b54238c82ab

Comments

Popular posts from this blog

Elliot Wave Theory Explained and how to use it

Ralph Elliott was a theorist and a professional accountant. In the 1930s, he identified the fundamental social concepts and developed analytical methods. He suggested that market prices follow precise patterns, which are now known as Elliott waves, or simply waves. What is Elliott Wave Theory? Elliott proposed that financial price movements were the outcome of investors' primary psychology. He discovered that changes in public opinion always manifested themselves in the same periodic "waves" in financial markets. The Elliott and Dow theories are similar in that they both acknowledge that stock values move in waves. Elliott, on the other hand, was able to dissect and study markets in far greater depth. Elliot began to investigate how these recurring patterns could be used to forecast future market movements. We know in the financial markets that "what goes up, must come down," because a price movement up or down is always followed by a price mo...

Kaza Spike Detector

The Kaza Spike Detector is the best Spike detector for Boom 1000 and Crash 1000 so far. You can download it for free from the link below. But before you download, please watch the video on how to install it. Features of the Kaza Spike detector: The Kaza spike detector has 9 indicators and 1 template. Please watch the video to know how to import and apply the indicators and templates. Download Kaza spike detector You can download the Kaza spike detector below. To keep on receiving free indicators, systems and other forex files, consider joining my email list , Telegram channel and subscribing to my YouTube channel. Kaza download link Here is the direct download link. Click here to download Watch the video below to learn how to install Kaza spike detector https://www.youtube.com/watch?v=12cdcVOd4QA https://keithrainz.me/kaza-spike-detector-2/?feed_id=433&_unique_id=64bd2cbbadacf

Important Features Of An FXOpen Islamic Account

FXOpen is one of the leading online foreign exchange brokerages that specialize in Islamic financial instruments. They offer FXOpen Islamic Account, which is a special type of Islamic financial account similar to trading accounts in other countries. Islamic Banking is strictly supervised by Islamic law. If you are looking for an Islamic Account, FXOpen is the best place for you to start. The best possible trading platform. For those investors who have limited knowledge about the forex market, FXOpen is the best possible online trading platform that will offer you easy-to-use features and tools, along with low spreads for trades. It offers customised products and tailor-made trading solutions for small and big investors, high frequency trading, and transparent execution speeds for both entry and exit. If you are new to forex trading and want to start with low spreads, then this is the best place for you. Low spreads on all free pairs. You can enjoy fast trading and low spread...