Here again :-)
I use this indi...
It draws a custom fibo on my charts.
This is the fibo appearance on my chart...
and this is what I'd like to draw.
I'd like to draw a coloured zone (I think a rectangle) between 382 and 618 level... is it possible ??
Thank you in advance.
I use this indi...
Inserted Code
//+------------------------------------------------------------------+
//| testFibo.mq4 |
//| Copyright © 2007, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
#property indicator_chart_window
#property indicator_width1 3
#property indicator_style1 STYLE_SOLID
#property indicator_width1 3
#property indicator_width2 3
#property indicator_width3 3
#property indicator_width4 3
#property indicator_width5 3
#property indicator_width6 3
#property indicator_width7 3
bool b_firstTimeFlag = true;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
if(b_firstTimeFlag)
{
double high = High[3];
double low = Low[3];
datetime time = Time[3];
bool result = createFib("fibdaily", time, low - 0.01, high + 0.01, Black, true);
if(result == false)
Print("error creating fib: ", GetLastError());
b_firstTimeFlag = false;
}//end if first time
return(0);
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| function setFib |
//+------------------------------------------------------------------+
bool createFib(string name, datetime date, double price1, double price2, color fibColor, bool bRayFlag)
{
bool ret = false;
bool result = false;
result = ObjectCreate(name, OBJ_FIBO, 0, date, price1, date, price2);
Print("createFib: result = ", result);
if(result == true)
{
//set the number of fib levels
ObjectSet(name, OBJPROP_FIBOLEVELS, 13);
//set the value of each fib level
ObjectSet(name, OBJPROP_FIRSTLEVEL+1, 0.000);
ObjectSet(name, OBJPROP_LEVELWIDTH, 3);
ObjectSet(name, OBJPROP_FIRSTLEVEL+3, 0.382);
ObjectSet(name, OBJPROP_FIRSTLEVEL+4, 0.500);
ObjectSet(name, OBJPROP_FIRSTLEVEL+5, 0.618);
ObjectSet(name, OBJPROP_FIRSTLEVEL+8, 1.000);
ObjectSet(name, OBJPROP_FIRSTLEVEL+9, 1.38100);
ObjectSet(name, OBJPROP_FIRSTLEVEL+10, -0.381);
//set the description of each fib level
ObjectSetFiboDescription(name, 1, "Resistenza W");
ObjectSetFiboDescription(name, 3, "Long weekly");
ObjectSetFiboDescription(name, 4, "Pivot weekly");
ObjectSetFiboDescription(name, 5, "Short weekly");
ObjectSetFiboDescription(name, 8, "Supporto W");
ObjectSetFiboDescription(name, 9, "Target W");
ObjectSetFiboDescription(name, 10, "Target W");
//set the ray flag
ret = ObjectSet(name, OBJPROP_RAY, bRayFlag);
//set the color of the fib
ret = ObjectSet(name, OBJPROP_COLOR, fibColor);
///////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////// I ADDED THIS, THIS IS WHAT YOU NEED TO PLAY WITH TO SET COLOR //////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////
//set the color of the fib levels
ret = ObjectSet(name, OBJPROP_LEVELCOLOR, fibColor);
///////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////
//debug code
Print("color set: ", ret, ": color = ", fibColor);
if(ret == 0)
{ Print("error: ", GetLastError());}
//end debug code
}//end if the fib object is created with no errors
ret = result;
return (ret);
}//end function setFib This is the fibo appearance on my chart...
and this is what I'd like to draw.
I'd like to draw a coloured zone (I think a rectangle) between 382 and 618 level... is it possible ??
Thank you in advance.