Line of code from a multitimeframe indicator that won't compile properly

To add comments, please log in or register
samuk1000
558
samuk1000  

This line of code relates to a wingding that is responsive to RSI. Here are the relevant lines of code:

item02 = Custom_Name + "DIR002";     
CCI5W[i]     = iRSI(NULL, PERIOD_M5,  CCI5_Period,    PRICE_TYPICAL, i);
     double CCI5WP     = iRSI(NULL, PERIOD_M5,  CCI5_Period,    PRICE_TYPICAL, i+1);
       {                             ObjectCreate (item02, OBJ_LABEL,CCI_WIN5D, 0, 0);
  if  (CCI5W[i] > 50 )          {ObjectSetText(item02,"(5)         "+DoubleToStr(CCI5W[i],0)+"", TextSize, "Tahoma Bold", clrLimeGreen);}
  if  (CCI5W[i] > OHLev_Up )    {ObjectSetText(item02,"(5)         "+DoubleToStr(CCI5W[i],0)+"", TextSize, "Tahoma Bold", clrYellow);}
  if  (CCI5W[i] < 50 )          {ObjectSetText(item02,"(5)         "+DoubleToStr(CCI5W[i],0)+"", TextSize, "Tahoma Bold", clrRed);}
  if  (CCI5W[i] < OHLev_Down )  {ObjectSetText(item02,"(5)         "+DoubleToStr(CCI5W[i],0)+"", TextSize, "Tahoma Bold", clrYellow);}
                                 ObjectSet    (item02, OBJPROP_XDISTANCE, C5LH);
                                 ObjectSet    (item02, OBJPROP_YDISTANCE, C5LV ); 
   }
         { ObjectCreate(item07, OBJ_LABEL,CCI_WIN5D, 0, 0); 
 //if  ((CCI5W[i] > 50 )&& (CCI5W[i] > CCI5WP )) {ObjectSetText("CCIT5D_lab5","é",10, "Wingdings", clrLimeGreen);}
 //if  ((CCI5W[i] > 50 )&& (CCI5W[i] < CCI5WP )) {ObjectSetText("CCIT5D_lab5","ê",10, "Wingdings", MediumSeaGreen);}
 if  ( (CCI5W[i] > CCI5WP )) {ObjectSetText(item07,"é",10, "Wingdings", clrLimeGreen);}
 if  ( (CCI5W[i] < CCI5WP )) {ObjectSetText(item07,"ê",10, "Wingdings", clrRed);}
 
//f  ( (CCI5W[i] > CCI5WP )) {ObjectSetText("CCIT5D_lab5","é",10, "Wingdings", clrRed);}
 //  ( (CCI5W[i] < CCI5WP )) {ObjectSetText("CCIT5D_lab5","ê",10, "Wingdings", IndianRed);}
     ObjectSet(item07, OBJPROP_XDISTANCE, C5LHD);
     ObjectSet(item07, OBJPROP_YDISTANCE, C5LV ); 
   }

     

When I compile the overall code, it creates problems in the display. Here is the display when the indicator is working:


If I compile the code though, the wingdings code gets messed up and it displays as follows. 

Any help appreciated - I want to change some parameters in the code, but I can't due to the issue that happens when I recompile:

I've tried using, for example, CharStringtoText(233) which is presented as a solution in other threads, but that does not pick up the right wingding...

 if  ( (CCI5W[i] > CCI5WP )) {ObjectSetText(item07,CharToStr("233"),10, "Wingdings", clrLimeGreen);}

//OR

 if  ( (CCI5W[i] > CCI5WP )) {ObjectSetText(item07,CharToString(233),10, "Wingdings", clrLimeGreen);}

//NEITHER OF THESE WORK
Marco vd Heijden
Moderator
12535
Marco vd Heijden  
//+------------------------------------------------------------------+ 
//| Create the arrow                                                 | 
//+------------------------------------------------------------------+ 
bool ArrowCreate(const long              chart_ID=0,           // chart's ID 
                 const string            name="Arrow",         // arrow name 
                 const int               sub_window=0,         // subwindow index 
                 datetime                time=0,               // anchor point time 
                 double                  price=0,              // anchor point price 
                 const uchar             arrow_code=252,       // arrow code 
                 const ENUM_ARROW_ANCHOR anchor=ANCHOR_BOTTOM, // anchor point position 
                 const color             clr=clrRed,           // arrow color 
                 const ENUM_LINE_STYLE   style=STYLE_SOLID,    // border line style 
                 const int               width=3,              // arrow size 
                 const bool              back=false,           // in the background 
                 const bool              selection=false,      // highlight to move 
                 const bool              hidden=true,          // hidden in the object list 
                 const long              z_order=0)            // priority for mouse click 
  { 
//--- set anchor point coordinates if they are not set 
   ChangeArrowEmptyPoint(time,price); 
//--- reset the error value 
   ResetLastError(); 
//--- create an arrow 
   if(!ObjectCreate(chart_ID,name,OBJ_ARROW,sub_window,time,price)) 
     { 
      Print(__FUNCTION__, 
            ": failed to create an arrow! Error code = ",GetLastError()); 
      return(false); 
     } 
//--- set the arrow code 
   ObjectSetInteger(chart_ID,name,OBJPROP_ARROWCODE,arrow_code); 
//--- set anchor type 
   ObjectSetInteger(chart_ID,name,OBJPROP_ANCHOR,anchor); 
//--- set the arrow color 
   ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr); 
//--- set the border line style 
   ObjectSetInteger(chart_ID,name,OBJPROP_STYLE,style); 
//--- set the arrow's size 
   ObjectSetInteger(chart_ID,name,OBJPROP_WIDTH,width); 
//--- display in the foreground (false) or background (true) 
   ObjectSetInteger(chart_ID,name,OBJPROP_BACK,back); 
//--- enable (true) or disable (false) the mode of moving the arrow by mouse 
//--- when creating a graphical object using ObjectCreate function, the object cannot be 
//--- highlighted and moved by default. Inside this method, selection parameter 
//--- is true by default making it possible to highlight and move the object 
   ObjectSetInteger(chart_ID,name,OBJPROP_SELECTABLE,selection); 
   ObjectSetInteger(chart_ID,name,OBJPROP_SELECTED,selection); 
//--- hide (true) or display (false) graphical object name in the object list 
   ObjectSetInteger(chart_ID,name,OBJPROP_HIDDEN,hidden); 
//--- set the priority for receiving the event of a mouse click in the chart 
   ObjectSetInteger(chart_ID,name,OBJPROP_ZORDER,z_order); 
//--- successful execution 
   return(true); 
  } 
//+------------------------------------------------------------------+ 
//| Move the anchor point                                            | 
//+------------------------------------------------------------------+ 
bool ArrowMove(const long   chart_ID=0,   // chart's ID 
               const string name="Arrow", // object name 
               datetime     time=0,       // anchor point time coordinate 
               double       price=0)      // anchor point price coordinate 
  { 
//--- if point position is not set, move it to the current bar having Bid price 
   if(!time) 
      time=TimeCurrent(); 
   if(!price) 
      price=SymbolInfoDouble(Symbol(),SYMBOL_BID); 
//--- reset the error value 
   ResetLastError(); 
//--- move the anchor point 
   if(!ObjectMove(chart_ID,name,0,time,price)) 
     { 
      Print(__FUNCTION__, 
            ": failed to move the anchor point! Error code = ",GetLastError()); 
      return(false); 
     } 
//--- successful execution 
   return(true); 
  } 
//+------------------------------------------------------------------+ 
//| Change the arrow code                                            | 
//+------------------------------------------------------------------+ 
bool ArrowCodeChange(const long   chart_ID=0,   // chart's ID 
                     const string name="Arrow", // object name 
                     const uchar  code=252)     // arrow code 
  { 
//--- reset the error value 
   ResetLastError(); 
//--- change the arrow code 
   if(!ObjectSetInteger(chart_ID,name,OBJPROP_ARROWCODE,code)) 
     { 
      Print(__FUNCTION__, 
            ": failed to change the arrow code! Error code = ",GetLastError()); 
      return(false); 
     } 
//--- successful execution 
   return(true); 
  } 
//+------------------------------------------------------------------+ 
//| Change anchor type                                               | 
//+------------------------------------------------------------------+ 
bool ArrowAnchorChange(const long              chart_ID=0,        // chart's ID 
                       const string            name="Arrow",      // object name 
                       const ENUM_ARROW_ANCHOR anchor=ANCHOR_TOP) // anchor type 
  { 
//--- reset the error value 
   ResetLastError(); 
//--- change anchor type 
   if(!ObjectSetInteger(chart_ID,name,OBJPROP_ANCHOR,anchor)) 
     { 
      Print(__FUNCTION__, 
            ": failed to change anchor type! Error code = ",GetLastError()); 
      return(false); 
     } 
//--- successful execution 
   return(true); 
  } 
//+------------------------------------------------------------------+ 
//| Delete an arrow                                                  | 
//+------------------------------------------------------------------+ 
bool ArrowDelete(const long   chart_ID=0,   // chart's ID 
                 const string name="Arrow") // arrow name 
  { 
//--- reset the error value 
   ResetLastError(); 
//--- delete an arrow 
   if(!ObjectDelete(chart_ID,name)) 
     { 
      Print(__FUNCTION__, 
            ": failed to delete an arrow! Error code = ",GetLastError()); 
      return(false); 
     } 
//--- successful execution 
   return(true); 
  } 
//+------------------------------------------------------------------+ 
//| Check anchor point values and set default values                 | 
//| for empty ones                                                   | 
//+------------------------------------------------------------------+ 
void ChangeArrowEmptyPoint(datetime &time,double &price) 
  { 
//--- if the point's time is not set, it will be on the current bar 
   if(!time) 
      time=TimeCurrent(); 
//--- if the point's price is not set, it will have Bid value 
   if(!price) 
      price=SymbolInfoDouble(Symbol(),SYMBOL_BID); 
  } 
//+------------------------------------------------------------------+ 

You could see this for example.

Then you can see it has:

//--- set the arrow code 
   ObjectSetInteger(chart_ID,name,OBJPROP_ARROWCODE,arrow_code);

Maybe give that a go.(Just the arrowcode number so not CharToString());

To add comments, please log in or register