//+------------------------------------------------------------------+
//|                        Copyright 2015, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright     "Pipfinite"
#property link          "http://www.pipfinite.com"
#property version       "2.60"
#property strict
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---


   //Uptrend Buffer = 0
   //DownTrend Buffer = 1
   //Buy Buffer = 14
   //Sell Buffer = 15   
   //Average Profit = 16
   //Minimum Move = 17     
   //Success Rate = 18
   //Best Profit = 19       
    
    
   /***Replace "Comment/Print" with your trade function***/  
        
   //Uptrend (Continuous)               
   if( GetIndicatorValue(0) > 0 )   Comment("iCustom: Trend Laser >> Uptrend");   
   
   //Downtrend (Continuous)
   if( GetIndicatorValue(1) > 0 )   Comment("iCustom: Trend Laser >> DownTrend");  


   //Buy Signal (Beginning of Uptrend)               
   if( GetIndicatorValue(14) > 0 )   Comment("iCustom: Trend Laser >> Buy Signal");   
   
   //Sell Signal (Beginning of Downtrend)    
   if( GetIndicatorValue(15) > 0 )   Comment("iCustom: Trend Laser >> Sell Signal");    
   

   //Average Profit (Realtime)               
   Print(DoubleToString (GetIndicatorValue(16),Digits)+" Average Profit");   
   
   //Minimum Move (Realtime)    
   Print(DoubleToString (GetIndicatorValue(17),Digits)+" Minimum Move");  

   //Success Rate (Realtime)    
   Print(DoubleToString (GetIndicatorValue(18),Digits)+" Success Rate");    

   //Best Profit (Realtime)    
   Print(DoubleToString (GetIndicatorValue(19),Digits)+" Best Profit");    
            
  }
//+------------------------------------------------------------------+


//+------------------------------------------------------------------+
//| Get Indicator Buffer Value                                       |
//+------------------------------------------------------------------+
double GetIndicatorValue(int buffer)
{

    return ( iCustom (
     
                              NULL,                                                                
                              0,                                     
                              "\\Market\\PipFinite Trend Laser", //File Path of indicator 
                                                                                       
                              //NEXT LINES WILL BE INDCATOR INPUTS                                  
                              " ",
                              3,
                              1000,   
                              " ",                                                                                    
                              true,                              
                              true, 
                              2,
                              15,
                              8, 
                              true,                              
                              " ",  
                              1, 
                              true,
                              " ",                                                                
                              false,                                 
                              false,                                 
                              false, 
                              //END FOR INPUTS
                                                              
                              buffer,//Index Buffer                               
                              1//Shift used is 1 because signals is at Close of bar                                   
                              
                       ));

}  

