Download MetaTrader 5

ObjectGetValueByTime

To add comments, please log in or register
Mohamad Zulhairi Baba
2576
Mohamad Zulhairi Baba  

I have these code here to get ObjectGetValueByTime, for OBJ_REGRESSION 
https://docs.mql4.com/constants/objectconstants/enum_object/obj_regression
https://docs.mql4.com/objects/objectgetvaluebytime

it has been discuss before, and yet I still can't manage to get double return value, as it always return 0.
tried ChartRedraw(), same result.

link to last forum https://www.mql5.com/en/forum/157691

my code as below; Object Regression drawn perfectly on chart. Any ideas?

string      ObjIdentifier = "ABC_";

void OnTick()
{   
   static bool Regression_Channel=false;
   if(DrawRegressionChannel("Regression",Time[Point_1],Time[Point_2],STYLE_SOLID,clrRed,2,true))
   {
      ChartRedraw();
      Regression_Channel=true;
   }
   else Regression_Channel=false;
      
   double Line0 = ObjectGetValueByTime(0,ObjIdentifier+"Regression",TimeCurrent(),0);
   double Line1 = ObjectGetValueByTime(0,ObjIdentifier+"Regression",TimeCurrent(),1);
   double Line2 = ObjectGetValueByTime(0,ObjIdentifier+"Regression",TimeCurrent(),2);
   
   Comment( "\nTime Now : ",TimeCurrent(),            
            "\n\nLine 0 : ",Line0,
            "\n\Line 1 : ",Line1,
            "\n\Line 2 : ",Line2);
}

bool DrawRegressionChannel(string name, datetime T0, datetime T1, int style, color clr, int width, bool ray)
{   
   double P0 = 0, P1 = 0;
   
   if (ObjectFind(0,ObjIdentifier+name) != 0)
   {
      ObjectCreate(ObjIdentifier+name,OBJ_REGRESSION, 0, T0, P0, T1, P1 );
      ObjectSet(ObjIdentifier+name,OBJPROP_STYLE,style);
      ObjectSet(ObjIdentifier+name,OBJPROP_COLOR,clr);
      ObjectSet(ObjIdentifier+name,OBJPROP_WIDTH, width);
      ObjectSet(ObjIdentifier+name,OBJPROP_RAY, ray);
      ObjectSet(ObjIdentifier+name,OBJPROP_BACK,false);
      ObjectSetText(ObjIdentifier+name,name+" Channel",8,"Arial",EMPTY);
   }
   
   else
   {
      ObjectDelete(ObjIdentifier+name);
      ObjectCreate(ObjIdentifier+name,OBJ_REGRESSION, 0, T0, P0, T1, P1 );
      ObjectSet(ObjIdentifier+name,OBJPROP_STYLE,style);
      ObjectSet(ObjIdentifier+name,OBJPROP_COLOR,clr);
      ObjectSet(ObjIdentifier+name,OBJPROP_WIDTH, width);
      ObjectSet(ObjIdentifier+name,OBJPROP_RAY, ray);
      ObjectSet(ObjIdentifier+name,OBJPROP_BACK,false);
      ObjectSetText(ObjIdentifier+name,name+" Channel",8,"Arial",EMPTY);
   }
   return(true);
}
OBJ_REGRESSION - Object Types - Objects Constants - Standard Constants, Enumerations and Structures - MQL4 Reference
OBJ_REGRESSION - Object Types - Objects Constants - Standard Constants, Enumerations and Structures - MQL4 Reference
  • docs.mql4.com
OBJ_REGRESSION - Object Types - Objects Constants - Standard Constants, Enumerations and Structures - MQL4 Reference
whroeder1
15013
whroeder1  
  1. Post code that compiles. Undeclared identifier
    #define Point_1 1
    #define Point_2 15
      if(DrawRegressionChannel("Regression",Time[Point_1],Time[Point_2],STYLE_SOLID,clrRed,2,true))
  2. Post code that compiles. 'L' - unrecognized character escape sequence
                "\n\Line 1 : ",Line1,
                "\n\Line 2 : ",Line2);

  3. Check your return codes and find out why. What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles I added
       double Line0 = ObjectGetValueByTime(0,ObjIdentifier+"Regression",TimeCurrent(),0);
          Print(_LastError);
    
    and got

    4205

    ERR_OBJECT_COORDINATES_ERROR

    Object coordinates error

  4. Changed the time:
       double Line0 = ObjectGetValueByTime(0,ObjIdentifier+"Regression",Time[Point_1+1],0);
          Print(_LastError);
    And the error goes away. Don't request outside the object.
  5. Still got zero, so
Mohamad Zulhairi Baba
2576
Mohamad Zulhairi Baba  
whroeder1:
  1. Post code that compiles. Undeclared identifier
  2. Post code that compiles. 'L' - unrecognized character escape sequence
  3. Check your return codes and find out why. What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles I addedand got

    4205

    ERR_OBJECT_COORDINATES_ERROR

    Object coordinates error

  4. Changed the time:And the error goes away. Don't request outside the object.
  5. Still got zero, so


Hi whoeder1,

Incorporated your comment, still got zero value.
sent report to Service Desk, let see how they response.
will post the update.

Nguyen Nga
7890
Nguyen Nga  
Do not use TimeCurrent(), you must use Time[0].
whroeder1
15013
whroeder1  
Nguyen Nga: Do not use TimeCurrent(), you must use Time[0].
I already said that, try to keep up. #1.4
honest_knave
Moderator
2413
honest_knave  

You're trying to retrieve the values too quickly after creating the object (which your code recreates every tick...)

As this is an EA, just use a sleep.

string      ObjIdentifier = "ABC_";

void OnTick()
{   
   static bool Regression_Channel=false;
   if(DrawRegressionChannel("Regression",Time[Point_1],Time[Point_2],STYLE_SOLID,clrRed,2,true))
   {
      Sleep(50);
      Regression_Channel=true;
   }
   else Regression_Channel=false;
      
   double Line0 = ObjectGetValueByTime(0,ObjIdentifier+"Regression",TimeCurrent(),0);
   double Line1 = ObjectGetValueByTime(0,ObjIdentifier+"Regression",TimeCurrent(),1);
   double Line2 = ObjectGetValueByTime(0,ObjIdentifier+"Regression",TimeCurrent(),2);
   
   Comment( "\nTime Now : ",TimeCurrent(),            
            "\n\nLine 0 : ",Line0,
            "\n\nLine 1 : ",Line1,
            "\n\nLine 2 : ",Line2);
}

bool DrawRegressionChannel(string name, datetime T0, datetime T1, int style, color clr, int width, bool ray)
{   
   double P0 = 0, P1 = 0;
   
   if (ObjectFind(0,ObjIdentifier+name) != 0)
   {
      ObjectCreate(ObjIdentifier+name,OBJ_REGRESSION, 0, T0, P0, T1, P1 );
      ObjectSet(ObjIdentifier+name,OBJPROP_STYLE,style);
      ObjectSet(ObjIdentifier+name,OBJPROP_COLOR,clr);
      ObjectSet(ObjIdentifier+name,OBJPROP_WIDTH, width);
      ObjectSet(ObjIdentifier+name,OBJPROP_RAY, ray);
      ObjectSet(ObjIdentifier+name,OBJPROP_BACK,false);
      ObjectSetText(ObjIdentifier+name,name+" Channel",8,"Arial",EMPTY);
   }
   
   else
   {
      ObjectDelete(ObjIdentifier+name);
      ObjectCreate(ObjIdentifier+name,OBJ_REGRESSION, 0, T0, P0, T1, P1 );
      ObjectSet(ObjIdentifier+name,OBJPROP_STYLE,style);
      ObjectSet(ObjIdentifier+name,OBJPROP_COLOR,clr);
      ObjectSet(ObjIdentifier+name,OBJPROP_WIDTH, width);
      ObjectSet(ObjIdentifier+name,OBJPROP_RAY, ray);
      ObjectSet(ObjIdentifier+name,OBJPROP_BACK,false);
      ObjectSetText(ObjIdentifier+name,name+" Channel",8,"Arial",EMPTY);
   }
   return(true);
}
Mohamad Zulhairi Baba
2576
Mohamad Zulhairi Baba  
honest_knave:

You're trying to retrieve the values too quickly after creating the object (which your code recreates every tick...)

As this is an EA, just use a sleep.


Hi honest_knave, Nguyen, whoeder1,
Thanks for your reply.

tried Sleep(50) too, still return 0 value (both for indicator & EA).

Same goes to using Time[0]

Print(_LastError)

Last error return 4051: error_string="Invalid function parameter value";  

The strange things is, if I test using OBJ_TREND, it return double value, even using TimeCurrent(), or Time[0].

ObjectGetValueByTime only works for single line??
anyway, I did ask Service Desk for further clarifications.


input int   LR_Point_1  = 120, // Draw Bar Start
            LR_Point_2  = 10;  // Draw Bar End, 0 means current Bar

string      Objname,
            ObjIdentifier = "ABC_";

int OnInit()
{
   if (!IsTradeAllowed())
   {
      Alert("Please allow trading to run this EA");
      return INIT_FAILED;
   }
   
   EventSetTimer(60);
   return(INIT_SUCCEEDED);
}

void OnDeinit(const int reason)
  {
   EventKillTimer();
   
   for(int k = ObjectsTotal(); k>=0; k--)
   {
      Objname= ObjectName(k);
      if(StringSubstr(Objname,0,4)==ObjIdentifier) ObjectDelete(Objname);
   }
}

void OnTick()
{   
   //Test value trendline
   double TL_Point_1 = 1.23000, // Test dummy value 1
          TL_Point_2 = 1.25000; // Test dummy value 2
   DrawTrendLine("Test_Trend",Time[350],TL_Point_1,Time[10],TL_Point_2,STYLE_DOT,clrBlack,2,true);
   double LineTrend = ObjectGetValueByTime(0,ObjIdentifier+"Test_Trend",TimeCurrent(),0);
   
   
   //Test value Regression
   static bool Regression_Channel=false;
   if(DrawRegressionChannel("Regression",Time[LR_Point_1],Time[LR_Point_2],STYLE_SOLID,clrRed,2,true))
   {
      Sleep(50);
      // ChartRedraw();
      Regression_Channel=true;
   }
   else Regression_Channel=false;
      
   double Line0 = ObjectGetValueByTime(0,ObjIdentifier+"Regression",Time[1],0);
   Print(_LastError);
   double Line1 = ObjectGetValueByTime(0,ObjIdentifier+"Regression",Time[1],1);
   double Line2 = ObjectGetValueByTime(0,ObjIdentifier+"Regression",Time[1],2);
   
   Comment( "\nTime Now : ",TimeCurrent(),            
            "\n\nTest Value Regression 0 : ",Line0,
            "\nTest Value Trendline : ",LineTrend);
}

bool DrawRegressionChannel(string name, datetime T0, datetime T1, int style, color clr, int width, bool ray) export
{   
   double P0 = 0, P1 = 0;
   
   if (ObjectFind(0,ObjIdentifier+name) != 0)
   {
      ObjectCreate(ObjIdentifier+name,OBJ_REGRESSION, 0, T0, P0, T1, P1 );
      ObjectSet(ObjIdentifier+name,OBJPROP_STYLE,style);
      ObjectSet(ObjIdentifier+name,OBJPROP_COLOR,clr);
      ObjectSet(ObjIdentifier+name,OBJPROP_WIDTH, width);
      ObjectSet(ObjIdentifier+name,OBJPROP_RAY, ray);
      ObjectSet(ObjIdentifier+name,OBJPROP_BACK,false);
      ObjectSetText(ObjIdentifier+name,name+" Channel",8,"Arial",EMPTY);
   }
   
   else
   {
      ObjectDelete(ObjIdentifier+name);
      ObjectCreate(ObjIdentifier+name,OBJ_REGRESSION, 0, T0, P0, T1, P1 );
      ObjectSet(ObjIdentifier+name,OBJPROP_STYLE,style);
      ObjectSet(ObjIdentifier+name,OBJPROP_COLOR,clr);
      ObjectSet(ObjIdentifier+name,OBJPROP_WIDTH, width);
      ObjectSet(ObjIdentifier+name,OBJPROP_RAY, ray);
      ObjectSet(ObjIdentifier+name,OBJPROP_BACK,false);
      ObjectSetText(ObjIdentifier+name,name+" Channel",8,"Arial",EMPTY);
   }
   return(true);
}

void DrawTrendLine(string name, datetime T0, double P0, datetime T1, double P1, int style, color clr, int width, bool ray) export
{   
   if (ObjectFind(0,ObjIdentifier+name) != 0)
   {
      ObjectCreate(ObjIdentifier+name,OBJ_TREND, 0, T0, P0, T1, P1 );
      ObjectSet(ObjIdentifier+name,OBJPROP_STYLE,style);
      ObjectSet(ObjIdentifier+name,OBJPROP_COLOR,clr);
      ObjectSet(ObjIdentifier+name,OBJPROP_WIDTH, width);
      ObjectSet(ObjIdentifier+name,OBJPROP_RAY, ray);
      ObjectSet(ObjIdentifier+name,OBJPROP_BACK,true);
      //ObjectSetText(ObjIdentifier+name,name);
   }
   
   else
   {
      ObjectDelete(ObjIdentifier+name);
      ObjectCreate(ObjIdentifier+name,OBJ_TREND, 0, T0, P0, T1, P1 );
      ObjectSet(ObjIdentifier+name,OBJPROP_STYLE,style);
      ObjectSet(ObjIdentifier+name,OBJPROP_COLOR,clr);
      ObjectSet(ObjIdentifier+name,OBJPROP_WIDTH, width);
      ObjectSet(ObjIdentifier+name,OBJPROP_RAY, ray);
      ObjectSet(ObjIdentifier+name,OBJPROP_BACK,true);
      //ObjectSetText(ObjIdentifier+name,name);
   }
}
Mohamad Zulhairi Baba
2576
Mohamad Zulhairi Baba  

both of the test Regression & Test Trendline drawn perfectly on chart.


honest_knave
Moderator
2413
honest_knave  
Mohamad Zulhairi Baba:

both of the test Regression & Test Trendline drawn perfectly on chart.



Put the ChartRedraw() in with the Sleep().

input int   LR_Point_1  = 120, // Draw Bar Start
            LR_Point_2  = 10;  // Draw Bar End, 0 means current Bar

string      Objname,
            ObjIdentifier = "ABC_";

int OnInit()
{
   if (!IsTradeAllowed())
   {
      Alert("Please allow trading to run this EA");
      return INIT_FAILED;
   }
   EventSetTimer(60);
   return(INIT_SUCCEEDED);
}

void OnDeinit(const int reason)
  {
   EventKillTimer();
   
   for(int k = ObjectsTotal(); k>=0; k--)
   {
      Objname= ObjectName(k);
      if(StringSubstr(Objname,0,4)==ObjIdentifier) ObjectDelete(Objname);
   }
}

void OnTick()
{   
   //Test value trendline
   double TL_Point_1 = 1.23000, // Test dummy value 1
          TL_Point_2 = 1.25000; // Test dummy value 2
   DrawTrendLine("Test_Trend",Time[350],TL_Point_1,Time[10],TL_Point_2,STYLE_DOT,clrBlack,2,true);
   double LineTrend = ObjectGetValueByTime(0,ObjIdentifier+"Test_Trend",TimeCurrent(),0);
   
   
   //Test value Regression
   static bool Regression_Channel=false;
   if(DrawRegressionChannel("Regression",Time[LR_Point_1],Time[LR_Point_2],STYLE_SOLID,clrRed,2,true))
   {
      ChartRedraw();
      Sleep(50);
      Regression_Channel=true;
   }
   else Regression_Channel=false;
      
   double Line0 = ObjectGetValueByTime(0,ObjIdentifier+"Regression",Time[1],0);
   Print(_LastError);
   double Line1 = ObjectGetValueByTime(0,ObjIdentifier+"Regression",Time[1],1);
   double Line2 = ObjectGetValueByTime(0,ObjIdentifier+"Regression",Time[1],2);
   
   Comment( "\nTime Now : ",TimeCurrent(),            
            "\n\nTest Value Regression 0 : ",Line0,
            "\nTest Value Trendline : ",LineTrend);
}

bool DrawRegressionChannel(string name, datetime T0, datetime T1, int style, color clr, int width, bool ray) export
{   
   double P0 = 0, P1 = 0;
   
   if (ObjectFind(0,ObjIdentifier+name) != 0)
   {
      ObjectCreate(ObjIdentifier+name,OBJ_REGRESSION, 0, T0, P0, T1, P1 );
      ObjectSet(ObjIdentifier+name,OBJPROP_STYLE,style);
      ObjectSet(ObjIdentifier+name,OBJPROP_COLOR,clr);
      ObjectSet(ObjIdentifier+name,OBJPROP_WIDTH, width);
      ObjectSet(ObjIdentifier+name,OBJPROP_RAY, ray);
      ObjectSet(ObjIdentifier+name,OBJPROP_BACK,false);
      ObjectSetText(ObjIdentifier+name,name+" Channel",8,"Arial",EMPTY);
   }
   
   else
   {
      ObjectDelete(ObjIdentifier+name);
      ObjectCreate(ObjIdentifier+name,OBJ_REGRESSION, 0, T0, P0, T1, P1 );
      ObjectSet(ObjIdentifier+name,OBJPROP_STYLE,style);
      ObjectSet(ObjIdentifier+name,OBJPROP_COLOR,clr);
      ObjectSet(ObjIdentifier+name,OBJPROP_WIDTH, width);
      ObjectSet(ObjIdentifier+name,OBJPROP_RAY, ray);
      ObjectSet(ObjIdentifier+name,OBJPROP_BACK,false);
      ObjectSetText(ObjIdentifier+name,name+" Channel",8,"Arial",EMPTY);
   }
   return(true);
}

void DrawTrendLine(string name, datetime T0, double P0, datetime T1, double P1, int style, color clr, int width, bool ray) export
{   
   if (ObjectFind(0,ObjIdentifier+name) != 0)
   {
      ObjectCreate(ObjIdentifier+name,OBJ_TREND, 0, T0, P0, T1, P1 );
      ObjectSet(ObjIdentifier+name,OBJPROP_STYLE,style);
      ObjectSet(ObjIdentifier+name,OBJPROP_COLOR,clr);
      ObjectSet(ObjIdentifier+name,OBJPROP_WIDTH, width);
      ObjectSet(ObjIdentifier+name,OBJPROP_RAY, ray);
      ObjectSet(ObjIdentifier+name,OBJPROP_BACK,true);
      //ObjectSetText(ObjIdentifier+name,name);
   }
   
   else
   {
      ObjectDelete(ObjIdentifier+name);
      ObjectCreate(ObjIdentifier+name,OBJ_TREND, 0, T0, P0, T1, P1 );
      ObjectSet(ObjIdentifier+name,OBJPROP_STYLE,style);
      ObjectSet(ObjIdentifier+name,OBJPROP_COLOR,clr);
      ObjectSet(ObjIdentifier+name,OBJPROP_WIDTH, width);
      ObjectSet(ObjIdentifier+name,OBJPROP_RAY, ray);
      ObjectSet(ObjIdentifier+name,OBJPROP_BACK,true);
      //ObjectSetText(ObjIdentifier+name,name);
   }
}
Mohamad Zulhairi Baba
2576
Mohamad Zulhairi Baba  

Hi All,

Got reply from Service desk.
Attached file for reference.

Problem solve. Thanks fellows.


Files:
honest_knave
Moderator
2413
honest_knave  
Mohamad Zulhairi Baba:

Hi All,

Got reply from Service desk.
Attached file for reference.

Problem solve. Thanks fellows.



//+------------------------------------------------------------------+
//|                                                 TestChannel2.mq4 |
//|                        Copyright 2017, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2017, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict

input int                  LR_Point_1=120,// Draw Bar Start
LR_Point_2=10;  // Draw Bar End, 0 means current Bar

string      Objname,
ObjIdentifier="ABC_";
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   if(!IsTradeAllowed())
     {
      Alert("Please allow trading to run this EA");
      return INIT_FAILED;
     }

   EventSetTimer(60);

//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   EventKillTimer();
//---
   for(int k=ObjectsTotal(); k>=0; k--)
     {
      Objname=ObjectName(k);
      if(StringSubstr(Objname,0,4)==ObjIdentifier) ObjectDelete(Objname);
     }
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//Test value trendline
   double TL_Point_1=1.23000,
   TL_Point_2=1.25000;
   DrawTrendLine("hoh",Time[350],TL_Point_1,Time[10],TL_Point_2,STYLE_DOT,clrBlack,2,true);
   double LineTrend=ObjectGetValueByTime(0,"TM_hoh",TimeCurrent(),0);

//Test value Regression
   static bool Regression_Channel=false;
   if(DrawRegressionChannel("Regression",Time[LR_Point_1],Time[LR_Point_2],STYLE_SOLID,clrRed,2,true))
     {
      Sleep(5);
      ChartRedraw();
      Regression_Channel=true;
     }
   else Regression_Channel=false;

   double Line0=ObjectGetValueByTime(0,ObjIdentifier+"Regression",Time[LR_Point_1],0);
   Print(_LastError);
   double Line1 = ObjectGetValueByTime(0,ObjIdentifier+"Regression",Time[LR_Point_1],1);
   double Line2 = ObjectGetValueByTime(0,ObjIdentifier+"Regression",Time[LR_Point_1],2);

   Comment("\nTime Now : ",TimeCurrent(),
           "\n\nTest Value Regression 0 : ",Line0,
           "\nTest Value Regression 1 : ",Line1,
           "\nTest Value Regression 2 : ",Line2,
           "\nTest Value Trendline : ",LineTrend);

  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
bool DrawRegressionChannel(string name,datetime T0,datetime T1,int style,color clr,int width,bool ray) export
  {
   double P0=0,P1=0;

   if(ObjectFind(0,ObjIdentifier+name)!=0)
     {
      ObjectCreate(ObjIdentifier+name,OBJ_REGRESSION,0,T0,P0,T1,P1);
      ObjectSet(ObjIdentifier+name,OBJPROP_STYLE,style);
      ObjectSet(ObjIdentifier+name,OBJPROP_COLOR,clr);
      ObjectSet(ObjIdentifier+name,OBJPROP_WIDTH,width);
      ObjectSet(ObjIdentifier+name,OBJPROP_RAY,ray);
      ObjectSet(ObjIdentifier+name,OBJPROP_BACK,false);
      ObjectSetText(ObjIdentifier+name,name+" Channel",8,"Arial",EMPTY);
     }

   else
     {
      ObjectDelete(ObjIdentifier+name);
      ObjectCreate(ObjIdentifier+name,OBJ_REGRESSION,0,T0,P0,T1,P1);
      ObjectSet(ObjIdentifier+name,OBJPROP_STYLE,style);
      ObjectSet(ObjIdentifier+name,OBJPROP_COLOR,clr);
      ObjectSet(ObjIdentifier+name,OBJPROP_WIDTH,width);
      ObjectSet(ObjIdentifier+name,OBJPROP_RAY,ray);
      ObjectSet(ObjIdentifier+name,OBJPROP_BACK,false);
      ObjectSetText(ObjIdentifier+name,name+" Channel",8,"Arial",EMPTY);
     }
   return(true);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void DrawTrendLine(string name,datetime T0,double P0,datetime T1,double P1,int style,color clr,int width,bool ray) export
  {
   if(ObjectFind(0,ObjIdentifier+name)!=0)
     {
      ObjectCreate(ObjIdentifier+name,OBJ_TREND,0,T0,P0,T1,P1);
      ObjectSet(ObjIdentifier+name,OBJPROP_STYLE,style);
      ObjectSet(ObjIdentifier+name,OBJPROP_COLOR,clr);
      ObjectSet(ObjIdentifier+name,OBJPROP_WIDTH,width);
      ObjectSet(ObjIdentifier+name,OBJPROP_RAY,ray);
      ObjectSet(ObjIdentifier+name,OBJPROP_BACK,true);
      //ObjectSetText(ObjIdentifier+name,name);
     }

   else
     {
      ObjectDelete(ObjIdentifier+name);
      ObjectCreate(ObjIdentifier+name,OBJ_TREND,0,T0,P0,T1,P1);
      ObjectSet(ObjIdentifier+name,OBJPROP_STYLE,style);
      ObjectSet(ObjIdentifier+name,OBJPROP_COLOR,clr);
      ObjectSet(ObjIdentifier+name,OBJPROP_WIDTH,width);
      ObjectSet(ObjIdentifier+name,OBJPROP_RAY,ray);
      ObjectSet(ObjIdentifier+name,OBJPROP_BACK,true);
      //ObjectSetText(ObjIdentifier+name,name);
     }
  }
//+------------------------------------------------------------------+


Who would have thought that would be the solution, eh? 



12
To add comments, please log in or register