Fibo MANIA

 

So I was introduced to a decent Fibo indicator. I found some bugs in it and fixed it, however, I cannot seem to acquire the levels data. I ran the following code in my EA just to see if I could see the data and the description values were empty. The Fibo shows up fine on the charts, but again, no data to play with. I later got frustrated and placed this code into the indicator itself and the result is the same.

Code to see values of levels:

// Where objouterId = to actual name, variable was properly assigned.

string text;
  for(int i=0;i<32;i++)
    {
     text=ObjectGetFiboDescription(objOuterId,i);
     //---- checking whether the objects has less than 32 levels
     if(GetLastError()!=0) break;
     Print(objOuterId,"level: ",i," description: ",text);
    } 

If I comment out the break condition, I see the print statements, but description is empty. Again, it doesn't matter whether this code is in my EA or the indicator EA. The attached file is my modification of the "QuickFib".

I planned on creating indicator buffer arrays to handle the data to the EA if I could get the above to work in the indicator, but apparently even the indicator is blind to the Fibo.

 

great, thanks

 

huh???

 

I think I have found some code I could place in my EA to get the top and bottom of the Fib, then I could just run some calculations to get the fib lines if I need too. Here is the code I came up with by researching anothers code.

int    obj_total=ObjectsTotal();
string index;
for(int i=0;i<obj_total;i++)
{
     index=ObjectName(i);
      string substr = StringSubstr(index, 0, 4);            
      if (substr == "QuickFib_outer")
      {
           NameFibs=index;
      }

}

if (StringLen(NameFibs) <1) return(-1);

double pr1=ObjectGet(NameFibs, OBJPROP_PRICE1);
double pr2=ObjectGet(NameFibs,OBJPROP_PRICE2);
double fibprop=(pr1-pr2);

It's ugly, but I think it might work, I am going to give it a try.

 

Nope, this didn't work either. Code was modified as follows:

int    obj_total=ObjectsTotal();
string index;
string NameFibs;
for(int i=0;i<obj_total;i++)
{
     index=ObjectName(i);
      string substr = StringSubstr(index, 0, 4);            
      if (substr == "QuickFib_outer")
      {
           NameFibs=index;
      }

}

if (StringLen(NameFibs) >= 1)
{
   double pr1=ObjectGet(NameFibs, OBJPROP_PRICE1);
   double pr2=ObjectGet(NameFibs,OBJPROP_PRICE2);
   double fibprop=(pr1-pr2);

   Print ("pr1: ", pr1, " pr2: ", pr2, " fibprop: ", fibprop);
}
else
{
   Print ("not good.");
}
 

Duh, I forgot to modify substr params to match my fibs name. Trying again.

 

It works, I got it. I had to increase substr length param to 14, length of the fibo name.

 

Question: How do I stop the Fib from being re-drawn until the price reaches the extension instead of when the price reaches the 100%?

 

My first thought is to wrap the following code up with a condition, like if price is greater than or equal to first or second extension line. However, on first itteration, the extension lines won't exist unless I allow it to run through.

   // If price breaking out to new highs or lows, don't redraw the fib until the next bar
   // That's what the -1 and 1 are for.
   int shiftLowest = iLowest(NULL, 0, MODE_LOW, bar - 1, 1);
   int shiftHighest = iHighest(NULL, 0, MODE_HIGH, bar - 1, 1);
 

Another idea, is to collect the values of each of the lines on the Fib and store them in seperate vars, then just do a comparison on a new candle leaving the var static with the initial extension values, then when I get a reverse signal in the extensions, I can collect the latest of the fib data.

Reason: