//+------------------------------------------------------------------+
//|                               Forex Generator version 5.0        |
//|                                 Copyright (C) 2013, Etasoft Inc. |
//|                                    http://www.forexgenerator.com |
//+------------------------------------------------------------------+
// Keywords: indicator developer, Forex indicator builder, create forex indicator, MT4


#property copyright "Your copyright"
#property link "Link to your website"
#property indicator_separate_window
#property indicator_buffers 1

#property indicator_color1 Green
#property indicator_width1 1



// exported variables
extern string sym1 = "";
extern string sym2 = "";
extern string sym3 = "";


// local variables
string LF = "\n";  // use this in custom or utility blocks where you need line feeds
int ObjCount = 0;  // count of all objects created on the chart, allows creation of objects with unique names
int current = 0; // variable points to current bar

double Buffer2[];


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
    if (false) ObjectsDeleteAll();      // clear the chart
    IndicatorShortName("Indicator name");
    IndicatorDigits(Digits+1);
    IndicatorBuffers(1);
    
    SetIndexBuffer(0, Buffer2);
    SetIndexStyle(0, DRAW_LINE, STYLE_SOLID);
    
    
    return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
{
    if (false) ObjectsDeleteAll();
    
    
    return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator start function                                  |
//+------------------------------------------------------------------+
int start()
{
    OnEveryTick1();
    
    return(0);
}

//+------------------------------------------------------------------+

void OnEveryTick1()
{
    
    int i;
    int counted_bars = IndicatorCounted();
    if(counted_bars < 0) return(-1);
    if(counted_bars > 0) counted_bars--;
    i = Bars - counted_bars;
    // main calculation loop
    while (i >= 0)
    {
        current = i;
        ChartLine2();
        
        i--;
    }
}

void ChartLine2()
{
    Buffer2[current]= (iClose(sym1,NULL,0)/iClose(sym2,NULL,0))*iClose(sym3,NULL,0);
    
}



