I seem to be finding the wrong buffers with iCustom()

 

I will show the part of my code that im having trouble with any tips would be much appreciated.

Have a nice day.

void OnTick()
{
    if (handleIndicator == INVALID_HANDLE)
    {
        handleIndicator = iCustom(_Symbol, SuperSignalTimeframe, "IndicatorName", SuperSignalPeriod1, SuperSignalPeriod2);
        if (handleIndicator == INVALID_HANDLE)
        {
            Print("Failed to create handle for the custom indicator. Error: ", GetLastError());
            return;
        }
    }

    int barsToCopy = 1;

    if (CopyBuffer(handleIndicator, 0, 0, barsToCopy, sellBuffer1) < 0)
    {
        Print("Failed to copy sellBuffer1 data. Error: ", GetLastError());
        return;
    }
    if (CopyBuffer(handleIndicator, 1, 0, barsToCopy, buyBuffer2) < 0)
    {
        Print("Failed to copy buyBuffer2 data");
        return;
    }
    if (CopyBuffer(handleIndicator, 2, 0, barsToCopy, sellBuffer3) < 0)
    {
        Print("Failed to copy sellBuffer3 data");
        return;
    }
    if (CopyBuffer(handleIndicator, 3, 0, barsToCopy, buyBuffer4) < 0)
    {
        Print("Failed to copy buyBuffer4 data");
        return;
    }
 
Tiago Antunes:

I will show the part of my code that im having trouble with any tips would be much appreciated.

Have a nice day.

Hi,

Will know more if you paste your custom indicator's Init code. The part which sets the buffers using "SetIndexBuffer".

Sometimes buffers can be hidden, so you might not see them on chart or Data Window.


If you have the mq5 for indicator, then best way would be to match the buffer indices.

But if you only have ex5, then it's a bit more difficult.

If buffers are visible on chart, go into Colors tab and change the colors.


E.g. this TDI_v4.ex4 has first buffer hidden:

(This is an mq4 example. But can still be a similar issue with your custom indicator)


The Data Window starts from the 2nd buffer. So if we just go by data window it will give wrong buffer numbers.


I'm not sure if it's the same problem with your code, but just check your buffer index numbers carefully :)

 
Tiago Antunes:

I will show the part of my code that im having trouble with any tips would be much appreciated.

Have a nice day.

unless you are going to properly explain your problem how do you expect to get any help!

what are you getting from the buffers?

what are you expecting from the buffers?

how have you check it yourself?

show the buffers from the data window to help reference it as well