View Single Post
  #5 (permalink)  
Old 08-15-2007, 02:21 AM
mikeschra's Avatar
mikeschra mikeschra is offline
Junior Member
 
Join Date: Jan 2007
Posts: 9
mikeschra is on a distinguished road
Mode: This is the iCustom indicators vale it out puts to the chart and the data we will need for our EA code. Go grab a beer and get comfortable!

The parameters used for Mode are: 0,1,2,3,4,5,6,7. So we have up to 8 to choose from. Now here is the hard part, you need to dig into the iCustom indicator to figure out what the indicator is returning as a value. NOTE THE HARD PART!
Also you may not use all 8 values. Let’s figure out how many we will use first. In the icustom code of the N4 TF HAS Bar you will find a line of code like this, #property indicator_buffers 8, this tells us we will us all 8 values(Mode values=0,1,2,3,4,5,6,7)

Now we need to look at the N4 TF HAS Bar code to find the SetIndexBuffer syntax and we find the following code, notice the SetIndexBuffer is also associated with other parameters also used with the Mode value:
SetIndexStyle(0,DRAW_ARROW,0,BarWidth,BarColorUp);
SetIndexArrow(0,ArrSize);
SetIndexBuffer(0,buf1_up);
SetIndexEmptyValue(0,0.0);
SetIndexStyle(1,DRAW_ARROW,0,BarWidth,BarColorDown );
SetIndexArrow(1,ArrSize);
SetIndexBuffer(1,buf1_down);
SetIndexEmptyValue(1,0.0);
SetIndexStyle(2,DRAW_ARROW,0,BarWidth,BarColorUp);
SetIndexArrow(2,ArrSize);
SetIndexBuffer(2,buf2_up);
SetIndexEmptyValue(2,0.0);
SetIndexStyle(3,DRAW_ARROW,0,BarWidth,BarColorDown );
SetIndexArrow(3,ArrSize);
SetIndexBuffer(3,buf2_down);
SetIndexEmptyValue(3,0.0);
SetIndexStyle(4,DRAW_ARROW,0,BarWidth,BarColorUp);
SetIndexArrow(4,ArrSize);
SetIndexBuffer(4,buf3_up);
SetIndexEmptyValue(4,0.0);
SetIndexStyle(5,DRAW_ARROW,0,BarWidth,BarColorDown );
SetIndexArrow(5,ArrSize);
SetIndexBuffer(5,buf3_down);
SetIndexEmptyValue(5,0.0);
SetIndexStyle(6,DRAW_ARROW,0,BarWidth,BarColorUp);
SetIndexArrow(6,ArrSize);
SetIndexBuffer(6,buf4_up);
SetIndexEmptyValue(6,0.0);
SetIndexStyle(7,DRAW_ARROW,0,BarWidth,BarColorDown );
SetIndexArrow(7,ArrSize);
SetIndexBuffer(7,buf4_down);
SetIndexEmptyValue(7,0.0);

So lets take this one at a time. The first SetIndexBuffer Syntax set of code we come across is:
SetIndexStyle(0,DRAW_ARROW,0,BarWidth,BarColorUp);
SetIndexArrow(0,ArrSize);
SetIndexBuffer(0,buf1_up);
SetIndexEmptyValue(0,0.0);

So what is this telling us? Notice the first 0 in side all of the Brackets () ? This ties together all of the parameters of Mode=0. 0 is the Mode out put value of the SetIndexBuffer used in this example for the iCustom function for the parameter of MODE. In this case MODE = 0! Or iCustom (Null,0, “N4 TF HAS Bar”,MaMetod,MaPeriod,MaMetod2,MaPeriod2,BarWidth, BarColorUp,BarColorDown,TextColor,MaxBars,0

(Please do some digging into the MetaEditor library for more info on all of the SetIndex functions.)

So now we know that if we use MODE = 0 that it will produce a value of “buf1_up” on its chart! See above code for this: SetIndexBuffer(0,buf1_up); as buf1_up is the value of MODE = 0 seen on the iCustom indicators chart.
(Also note that SetIndexEmptyValue(0,0.0); is set to 0, This will make more sense latter)

Now what value does this return? To find this out we must go deeper into the N4 TF HAS Bar indicator code to find this:
case 1:buf1_down[i]=EMPTY_VALUE;buf1_up[i]=EMPTY_VALUE; if (haOpen>=haClose) buf1_down[i] = 1; else buf1_up[i] = 1; break;

So with this said it will return a value of buf1_up of 0 or 1 and buf1_down of 0 or 1.
(Hint: EMPTY_VALUE always = 0 also please see SetIndexEmptyValue)

Confused yet? Yep, time to grab another beer! Chug it. Then a bathroom break! Don’t forget another beer, then reread this. LOL, I had to!

Still more to come as soon as I can get the wife and kids to let me back on this PC!
Reply With Quote