# Custom indicator based on another indicator values

53

Hello,

Would like to know is it possible to make custom indicator based on these calculations:

Best regards,

Roberts

3243

in this century everything is possible
15726

1.  Play video Please edit your post. For large amounts of code, attach it.

2. You probably mean i+5 not i-5, you can't see the future.
6374

A problem might be also

time bar5 EurCad is not time5 other currency

and number of bars one currency is different number of bars other currency

on 1 minute it can happen easily some missing bars

53

WHRoeder:
1.  Play video Please edit your post. For large amounts of code, attach it.

2. You probably mean i+5 not i-5, you can't see the future.

sry, 5 bars ago.
53

deVries:

A problem might be also

time bar5 EurCad is not time5 other currency

and number of bars one currency is different number of bars other currency

on 1 minute it can happen easily some missing bars

Maybe someone already have tried to make custom indicator based on another indicator values?

Can someone help in solving this?

Best regards,

Roberts

53

```#property indicator_separate_window   // Indicator is drawn in the main window
#property indicator_buffers 4       // Number of buffers
#property indicator_color1 Red     // Color of the 1st line
#property indicator_color2 Green      // Color of the 2nd line
#property indicator_color3 Blue     // Color of the 1st line
#property indicator_color4 Purple      // Color of the 2nd line

double Buf_0[];Buf_1[];Buf_2[];Buf_3[];             // Declaring arrays (for indicator buffers)

int init()                          // Special function init()
{
SetIndexBuffer(0,Buf_0);         // Assigning an array to a buffer
SetIndexStyle (0,DRAW_LINE,STYLE_SOLID,1);// Line style
SetIndexBuffer(1,Buf_1);         // Assigning an array to a buffer
SetIndexStyle (1,DRAW_LINE,STYLE_SOLID,1);// Line style
SetIndexBuffer(2,Buf_2);         // Assigning an array to a buffer
SetIndexStyle (2,DRAW_LINE,STYLE_SOLID,1);// Line style
SetIndexBuffer(3,Buf_3);         // Assigning an array to a buffer
SetIndexStyle (3,DRAW_LINE,STYLE_SOLID,1);// Line style

return;                          // Exit the special funct. init()
}

int start()                         // Special function start()
{
int i,                           // Bar index
Counted_bars;                // Number of counted bars
//--------------------------------------------------------------------
Counted_bars=IndicatorCounted(); // Number of counted bars
i=Bars-Counted_bars-1;           // Index of the first uncounted
while(i>=0)                      // Loop for uncounted bars

{

}
return;                          // Exit the special funct. start()
}```

Here is the code:

how would you figure it?

Best regards,

Roberts

3243

use iCustom
53

```#property indicator_separate_window   // Indicator is drawn in the main window
#property indicator_buffers 4       // Number of buffers
#property indicator_color1 Red     // Color of the 1st line
#property indicator_color2 Green      // Color of the 2nd line
#property indicator_color3 Blue     // Color of the 1st line
#property indicator_color4 Purple      // Color of the 2nd line

double Buf_0[],Buf_1[],Buf_2[],Buf_3[];             // Declaring arrays (for indicator buffers)

int init()                          // Special function init()
{
SetIndexBuffer(0,Buf_0);         // Assigning an array to a buffer
SetIndexStyle (0,DRAW_LINE,STYLE_SOLID,1);// Line style
SetIndexBuffer(1,Buf_1);         // Assigning an array to a buffer
SetIndexStyle (1,DRAW_LINE,STYLE_SOLID,1);// Line style
SetIndexBuffer(2,Buf_2);         // Assigning an array to a buffer
SetIndexStyle (2,DRAW_LINE,STYLE_SOLID,1);// Line style
SetIndexBuffer(3,Buf_3);         // Assigning an array to a buffer
SetIndexStyle (3,DRAW_LINE,STYLE_SOLID,1);// Line style

return;                          // Exit the special funct. init()
}

int start()                         // Special function start()
{
int i,                           // Bar index
Counted_bars;                // Number of counted bars
//--------------------------------------------------------------------
Counted_bars=IndicatorCounted(); // Number of counted bars
i=Bars-Counted_bars-1;           // Index of the first uncounted
if(i>=0)                      // Loop for uncounted bars

{

}
return;                          // Exit the special funct. start()
}```

When I changed the code only with Buf_0 everything worked fine, but with Buf_1, Buf_2, Buf_3 at compile it shows Buf_1 -some operator expected, Buf_2 -some operator expected, Buf_3 -some operator expected. Why is that?

Best regards,

Roberts

Moderator
32827

Franko:

When I changed the code only with Buf_0 everything worked fine, but with Buf_1, Buf_2, Buf_3 at compile it shows Buf_1 -some operator expected, Buf_2 -some operator expected, Buf_3 -some operator expected. Why is that?

Best regards,

Roberts

```      Buf_0[i]=(((iADX("EURUSD",PERIOD_M1,28,PRICE_CLOSE,MODE_MAIN,(i+5)))-(iADX("EURUSD",PERIOD_M1,28,PRICE_CLOSE,MODE_MAIN,(i)))));