Help with Indicator for finds objects in the Chart of another indicator.

 

Can someone help me with an indicator that finds objects in the Chart of another indicator?

My Indicator finds objects, but copies them, and does not show its own colors.

I need it to show its own colors according to its own buffers. Thank you


indi


#property indicator_separate_window
#property indicator_buffers 3


#property indicator_color1 Gray
#property indicator_width1 2


#property indicator_color2 Lime
#property indicator_width2 2

#property indicator_color3 Red
#property indicator_width3 2


 
 
#property indicator_minimum 0
#property indicator_maximum 0.1


// exported variables


// 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 Buffer3[];
double Buffer2[];
double Buffer4[];

datetime lastbuy,lastsell,close;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
    if (false) ObjectsDeleteAll();      // clear the chart
    IndicatorShortName("indicator tester");
    IndicatorDigits(Digits+1);
    IndicatorBuffers(3);
    
    SetIndexBuffer(0, Buffer4);
    SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_SOLID);
    
    SetIndexBuffer(1, Buffer3);
    SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID);
    
    SetIndexBuffer(2, Buffer2);
    SetIndexStyle(2, DRAW_HISTOGRAM, 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;
        TechnicalAnalysis4();
        TechnicalAnalysis5();
        TechnicalAnalysis6();
        
        i--;
    }
}

void TechnicalAnalysis4()
{
    if(ObjectFind(0,"IT__BUY_")) return(0);
    {
     Histogram3();
      
    }
}

void Histogram3()
{
    Buffer3[current]= Close[current];
    
}

void TechnicalAnalysis5()
{
    if(ObjectFind(0,"IT__SELL_")) return(0);
    {
    Histogram2();
     
    }
}

void Histogram2()
{
    Buffer2[current]= Close[current];
    
}

void TechnicalAnalysis6()
{
    if(ObjectFind(0,"IT__CLOSE_")) return(0);
    {
     Histogram4();
    
    }
}

void Histogram4()
{
    Buffer4[current]= Close[current];
    
}



 
Topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.
I have moved your topic to the MQL4 and Metatrader 4 section.
 
Keith Watford:
Topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.
I have moved your topic to the MQL4 and Metatrader 4 section.
Thank you and I'm sorry.
 

Hi Jiri,

i would advise you to set the chart_id (first parameter) of the ObjectFind function.


Best regards

 

Thanks, but it didn't help much. I'm not that experienced a coder, and I've looked at this feature, but I don't know exactly how to use it.


Can you write me a piece of code for a sample?


Reason: