Inquiry Regarding MQL Object Properties (Color and Degree) OBJ_ELLIOTWAVE5

 

Hello everybody, 

I'm trying to set the color and degree properties for an Elliott Wave object with the following code

ObjectSetInteger(0,"ElliottWaveMotive",OBJPROP_COLOR, clrWhite);

ObjectSetInteger(0,"ElliottWaveMotive",OBJPROP_DEGREE,ELLIOTT_INTERMEDIATE);

However, the color and degree are not being updated as expected. Could you help me figure out why this is happening or suggest an alternative method?

Thanks!


 
Ahmd Fwzy Hamd ʿLy Albshbyshy:
OBJPROP_DEGREE

  1. Please use the </>button to format your code!
  2. If you want a proper answer, you need to share more of your code. Based on the two lines you've provided, I don't see anything wrong.
  3. But what I can recommend you is to check the return value of your ObjectSetInteger calls. For example:
string name = "ElliottWaveMotive";

if (!ObjectSetInteger(0, name, OBJPROP_COLOR, clrWhite)) {
    Print("Failed to set color for '", name, "'. Error: ", GetLastError());
}

if (!ObjectSetInteger(0, name, OBJPROP_DEGREE, ELLIOTT_INTERMEDIATE)) {
    Print("Failed to set degree for '", name, "'. Error: ", GetLastError());
}


 
thank you , i already found the error but i forget comment that the problem solved, sorry for that :(, i added an argument "NameNumber" to the function to be concatenated to the "ElliottWaveMotive" string, and i did concatenate it and used it the ObjectCreate() function call
but forget to use it in the ObjectSetInteger()  function calls, so the property remained the default.
here the code , i updated it after adding the NameNumber to distinguish the waves, i added string variable ElliottWaveMotiveName  and concatenate the NameNubmer argument value to the "ElliottMotiveWave",
and the problem solved, 

void drawElliottWaveMotive(int NameNumber, int wave1Index,double wave1Val,
                           int wave2Index, double wave2Val,
                           int wave3Index, double wave3Val,
                           int wave4Index, double wave4Val,
                           int wave5Index, double wave5Val)
  {
  string ElliottWaveMotiveName = "ElliottWaveMotive" + IntegerToString(NameNumber);

   ObjectCreate(0, "ElliottWaveMotive" + IntegerToString(NameNumber), OBJ_ELLIOTWAVE5, 0,
                barTime(wave1Index), wave1Val,
                barTime(wave2Index), wave2Val,
                barTime(wave3Index), wave3Val,
                barTime(wave4Index), wave4Val,
                barTime(wave5Index), wave5Val);
   ObjectSetInteger(0,ElliottWaveMotiveName,OBJPROP_DRAWLINES,false);
   ObjectSetInteger(0,ElliottWaveMotiveName,OBJPROP_BACK,true);
//--- set the object's color
   ObjectSetInteger(0,ElliottWaveMotiveName,OBJPROP_COLOR, clrWhite);
//--- set the line style
   ObjectSetInteger(0,ElliottWaveMotiveName,OBJPROP_STYLE,STYLE_SOLID);
//--- set width of the lines
   ObjectSetInteger(0,ElliottWaveMotiveName,OBJPROP_WIDTH,3);
//--- set wave degree
   ObjectSetInteger(0,ElliottWaveMotiveName,OBJPROP_DEGREE,ELLIOTT_INTERMEDIATE);
  }