xpf2003 wrote: Sat Nov 05, 2022 12:39 pm
Thanks Centuar.
Can you double check if buffers are updating correctly? I noticed that all buffers showed the same values even if the colour on the plots was changing. I think you have set all DTR buffers to a constant value and only updating the color indexes.
The buffer values are of no use, values only indicate the position on the separate window chart. If you are looking to link this indicator to an EA please link it to the color buffers only. I suggest using buffer number 21 as this represent the color of the bottom overall market trend (all condition to agree, if not the buffer takes the value of the previous position). If buffer 21 has a value of 0.0 it represent a long position and if buffer 21 has a value of 1.0 it represent a short position.
Example in EA:
Code: Select all
//--- indicator buffers
double DTR[];
//--- indicator handle
int DTR_Handle;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
DTR_Handle = iCustom(_Symbol, _Period, "Donchian Trend Ribbon", inp_donchian_channel_period);
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
if(CopyBuffer(DTR_Handle, 21, 0, 100, DTR) < 0)
{
PrintFormat("Error loading DTR - DTR data for %s, code %d", _Symbol, GetLastError());
return;
}
}