Buffer question

 

Hi there,

I understand how to use the iCustom() function in calling an indicator, and i understand basically how to use the buffers to determine if the indy is red or green... for eg. if you use the Henkein Ashi Indy, you can use the buffer 1 and buffer 2 to decide like this :


buffer1=iCustom(NULL,0,"Henkein_Ashi",0,2); // Buffer 1 on 3rd candle back
buffer2=iCustom(NULL,0,"Henkein_Ashi",1,2); // Buffer 2 on 3rd candle back


if buffer1<buffer2 -- indy is Green

if buffer1>buffer2 -- indy is Red


This seems simple BUT now comes my question....how do you handle an indy that has 6 buffers and you want to know if its red, green or yellow???


for e.g. (I have attached the T_T indy if you need to see it), I want to know when its Red, Green or Yellow...how do I do that??


Is it like this? :

tt=iCustom(Symbol(),0,"T_T",0.0,0.0001,-0.0001,5,10,16, 0.5,6,0); //is it right to put the 6 extern variables in like this?


buffer1=iCustom(NULL,0,"T_T",0,1);
buffer2=iCustom(NULL,0,"T_T",1,1);


if buffer1<buffer2 -- indy is green // is this correct?

if buffer1>buffer2 -- indy is red // is this correct?

And how do I determine when it is yellow??


Thanx in advance for the guidance

Files:
t_t.mq4  5 kb
 
Does any1 know how to do this?
 
Can any1 help me with this please?
 
23510 wrote >>

Hi there,

I understand how to use the iCustom() function in calling an indicator, and i understand basically how to use the buffers to determine if the indy is red or green... for eg. if you use the Henkein Ashi Indy, you can use the buffer 1 and buffer 2 to decide like this :

buffer1=iCustom(NULL,0,"Henkein_Ashi",0,2); // Buffer 1 on 3rd candle back
buffer2=iCustom(NULL,0,"Henkein_Ashi",1,2); // Buffer 2 on 3rd candle back

if buffer1<buffer2 -- indy is Green

if buffer1>buffer2 -- indy is Red

This seems simple BUT now comes my question....how do you handle an indy that has 6 buffers and you want to know if its red, green or yellow???

for e.g. (I have attached the T_T indy if you need to see it), I want to know when its Red, Green or Yellow...how do I do that??

Is it like this? :

tt=iCustom(Symbol(),0,"T_T",0.0,0.0001,-0.0001,5,10,16, 0.5,6,0); //is it right to put the 6 extern variables in like this?

buffer1=iCustom(NULL,0,"T_T",0,1);
buffer2=iCustom(NULL,0,"T_T",1,1);

if buffer1<buffer2 -- indy is green // is this correct?

if buffer1>buffer2 -- indy is red // is this correct?

And how do I determine when it is yellow??

Thanx in advance for the guidance

there are only three extern variables in yr indicator, so this portion in red is for this purpose

extern int High_Period_Comparison=5;
extern int FastEMA=10,SlowEMA=16;
extern double RedZone=0.5;

the colour of buffer is here

#property indicator_color1 SaddleBrown
#property indicator_color2 DodgerBlue
#property indicator_color3 Gold
#property indicator_color4 Red
#property indicator_color5 DarkOrange

and follows the buffer index as follows

SetIndexBuffer(0,ExtBuffer0);
SetIndexBuffer(1,ExtBuffer1);
SetIndexBuffer(2,ExtBuffer2);
SetIndexBuffer(5,ExtBuffer3);
SetIndexBuffer(4,ExtBuffer4);
SetIndexBuffer(3,ExtBuffer5);
SetIndexBuffer(3,ExtBuffer5);

so the buffer no of the colors are

saddlebrown is 0

dodgerblue is 1

gold is 2

etc

 
ronaldosim:

there are only three extern variables in yr indicator, so this portion in red is for this purpose

extern int High_Period_Comparison=5;
extern int FastEMA=10,SlowEMA=16;
extern double RedZone=0.5;

the colour of buffer is here

#property indicator_color1 SaddleBrown
#property indicator_color2 DodgerBlue
#property indicator_color3 Gold
#property indicator_color4 Red
#property indicator_color5 DarkOrange

and follows the buffer index as follows

SetIndexBuffer(0,ExtBuffer0);
SetIndexBuffer(1,ExtBuffer1);
SetIndexBuffer(2,ExtBuffer2);
SetIndexBuffer(5,ExtBuffer3);
SetIndexBuffer(4,ExtBuffer4);
SetIndexBuffer(3,ExtBuffer5);
SetIndexBuffer(3,ExtBuffer5);

so the buffer no of the colors are

saddlebrown is 0

dodgerblue is 1

gold is 2

etc

Thank you very much you have helped me to understand this concept a lot better, but how would I use the setindexbuffer values in an indy.

for example if I use henkein ashi i have to say buffr1<buffer2 = blue and buffer1>buffer2=red

how would I do that with so many buffers?

thanx Ronaldosim for the great advice!

 
23510 wrote >>

Thank you very much you have helped me to understand this concept a lot better, but how would I use the setindexbuffer values in an indy.

for example if I use henkein ashi i have to say buffr1<buffer2 = blue and buffer1>buffer2=red

how would I do that with so many buffers?

thanx Ronaldosim for the great advice!

colors are for indicators to show something on a chart; for EA u dont need colors but the condtions to do something

so if u want to send a buy order and the condition is say green and to get green, the condition is buffer>buffer2 then on

tt=iCustom(Symbol(),0,"T_T",5,16,0.5,0,0);

where the red refers to this index buffer

SetIndexBuffer(0,ExtBuffer0);

 
ronaldosim:

colors are for indicators to show something on a chart; for EA u dont need colors but the condtions to do something

so if u want to send a buy order and the condition is say green and to get green, the condition is buffer>buffer2 then on

tt=iCustom(Symbol(),0,"T_T",5,16,0.5,0,0);

where the red refers to this index buffer

SetIndexBuffer(0,ExtBuffer0);

Thank you, I think I understand so to get it to trade it something like this...


ttGreen =iCustom(Symbol(),0,"T_T",5,16,0.5,0,0);

ttRed = iCustom(Symbol(),0,"T_T",5,16,0.5,1,0);


f(ttGreen)

{

Ordersend(.....);

}

if(ttRed)

{

Ordersend(....);

}

 
23510 wrote >>

Thank you, I think I understand so to get it to trade it something like this...

ttGreen =iCustom(Symbol(),0,"T_T",5,16,0.5,0,0);

ttRed = iCustom(Symbol(),0,"T_T",5,16,0.5,1,0);

f(ttGreen)

{

Ordersend(.....);

}

if(ttRed)

{

Ordersend(....);

}

in your code tGreen is a point in time ie the level as indicatred by the green line at the current bar (see blue color 0)

ttGreen =iCustom(Symbol(),0,"T_T",5,16,0.5,0,0);

if you want the prev bar then change to 1

ttGreen =iCustom(Symbol(),0,"T_T",5,16,0.5,0,1 );

current bar and prev bar refers to the time frame u have chosen so if you use daily chart,

current bar is today, prev bar is yesterday

if time frame is hourly, then current bar is current hour, and prev bar is prev hour

so you need a condition like

if (tGreen > aValue) where aValue refers to some conparison u made eg price level, so u might have something like this

ttGreen0 =iCustom(Symbol(),0,"T_T",5,16,0.5,0,0);

ttGreen1 =iCustom(Symbol(),0,"T_T",5,16,0.5,0, 1 );

if (tGreen0> 1.2345) BUY

or

if(tGreen0>1.2345 && tGreen1 <1.2222) BUY

 
ronaldosim:

in your code tGreen is a point in time ie the level as indicatred by the green line at the current bar (see blue color 0)

ttGreen =iCustom(Symbol(),0,"T_T",5,16,0.5,0,0);

if you want the prev bar then change to 1

ttGreen =iCustom(Symbol(),0,"T_T",5,16,0.5,0,1 );

current bar and prev bar refers to the time frame u have chosen so if you use daily chart,

current bar is today, prev bar is yesterday

if time frame is hourly, then current bar is current hour, and prev bar is prev hour

so you need a condition like

if (tGreen > aValue) where aValue refers to some conparison u made eg price level, so u might have something like this

ttGreen0 =iCustom(Symbol(),0,"T_T",5,16,0.5,0,0);

ttGreen1 =iCustom(Symbol(),0,"T_T",5,16,0.5,0, 1 );

if (tGreen0> 1.2345) BUY

or

if(tGreen0>1.2345 && tGreen1 <1.2222) BUY

Thank you Ronaldosim, I appreciate the help.

Reason: