All works fine for me in W1 and MN1 timeframes. Build 1090. Maybe something wrong in your code. Please, try this:
and check it.
Regards.
//--- enable (true) or disable (false) the mode of continuation of the line's display to the right
ObjectSetInteger(chart_ID,name,OBJPROP_RAY_RIGHT,ray_right);
the ray_right is a bool meaning true in my code.
the absurd thing is that it's working well on other timeframe.
and I find that the code is good on the individual timeframe, right now I am drawing the w1 and MN1 lines on timeframe 1H, the problem is still here. Maybe you can try this?
//--- enable (true) or disable (false) the mode of continuation of the line's display to the right
ObjectSetInteger(chart_ID,name,OBJPROP_RAY_RIGHT,ray_right);
the ray_right is a bool meaning true in my code.
Are you completely sure ?? The function you use (help tutorial) has a preset value ray_right = false:
bool TrendCreate(const long chart_ID=0, // chart's ID
const string name="TrendLine", // line name
const int sub_window=0, // subwindow index
datetime time1=0, // first point time
double price1=0, // first point price
datetime time2=0, // second point time
double price2=0, // second point price
const color clr=clrRed, // line color
const ENUM_LINE_STYLE style=STYLE_SOLID, // line style
const int width=1, // line width
const bool back=false, // in the background
const bool selection=true, // highlight to move
const bool ray_left=false, // line's continuation to the left
const bool ray_right=false, // line's continuation to the right
const bool hidden=true, // hidden in the object list
const long z_order=0) // priority for mouse click
{
Therefore, all this depends on how you have called that function. You have not shown the complete code. That's why I told you to substitute the variable 'ray_right' for the value 'true' directly and then you try that way.
If you do not want to try what I said, or show the complete code of the function you use and the call to that function, I do not think I can help much more.
Just say that in my MT4 (build 1090) it works fine. As an example, this little script uses the help tutorial function:
//+------------------------------------------------------------------+ //| Trend Create.mq4 | //| Copyright 2017, Robertomar | //| https://www.mql5.com/en/users/robertomar | //+------------------------------------------------------------------+ #property copyright "Copyright 2017, Robertomar" #property link "https://www.mql5.com/en/users/robertomar" #property version "1.00" #property strict //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { //--- TrendCreate(0, "TrendLine", 0, Time[5], Low[5], Time[0], Low[0]); } //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| Create a trend line by the given coordinates | //+------------------------------------------------------------------+ bool TrendCreate(const long chart_ID=0, // chart's ID const string name="TrendLine", // line name const int sub_window=0, // subwindow index datetime time1=0, // first point time double price1=0, // first point price datetime time2=0, // second point time double price2=0, // second point price const color clr=clrRed, // line color const ENUM_LINE_STYLE style=STYLE_SOLID, // line style const int width=1, // line width const bool back=false, // in the background const bool selection=true, // highlight to move const bool ray_left=false, // line's continuation to the left const bool ray_right=true, // line's continuation to the right const bool hidden=true, // hidden in the object list const long z_order=0) // priority for mouse click { //--- set anchor points' coordinates if they are not set // ChangeTrendEmptyPoints(time1,price1,time2,price2); //--- reset the error value ResetLastError(); //--- create a trend line by the given coordinates if(!ObjectCreate(chart_ID,name,OBJ_TREND,sub_window,time1,price1,time2,price2)) { Print(__FUNCTION__, ": failed to create a trend line! Error code = ",GetLastError()); return(false); } //--- set line color ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr); //--- set line display style ObjectSetInteger(chart_ID,name,OBJPROP_STYLE,style); //--- set line width 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 line 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); //--- enable (true) or disable (false) the mode of continuation of the line's display to the left ObjectSetInteger(chart_ID,name,OBJPROP_RAY_LEFT,ray_left); //--- enable (true) or disable (false) the mode of continuation of the line's display to the right ObjectSetInteger(chart_ID,name,OBJPROP_RAY_RIGHT,ray_right); //--- 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); }
I use it on W1 or MN1 and it draws the trend line with ray right. All ok.
If you want you can try it.
Regards.
Are you completely sure ?? The function you use (help tutorial) has a preset value ray_right = false:
bool TrendCreate(const long chart_ID=0, // chart's ID
const string name="TrendLine", // line name
const int sub_window=0, // subwindow index
datetime time1=0, // first point time
double price1=0, // first point price
datetime time2=0, // second point time
double price2=0, // second point price
const color clr=clrRed, // line color
const ENUM_LINE_STYLE style=STYLE_SOLID, // line style
const int width=1, // line width
const bool back=false, // in the background
const bool selection=true, // highlight to move
const bool ray_left=false, // line's continuation to the left
const bool ray_right=false, // line's continuation to the right
const bool hidden=true, // hidden in the object list
const long z_order=0) // priority for mouse click
{
Therefore, all this depends on how you have called that function. You have not shown the complete code. That's why I told you to substitute the variable 'ray_right' for the value 'true' directly and then you try that way.
If you do not want to try what I said, or show the complete code of the function you use and the call to that function, I do not think I can help much more.
Just say that in my MT4 (build 1090) it works fine. As an example, this little script uses the help tutorial function:
I use it on W1 or MN1 and it draws the trend line with ray right. All ok.
If you want you can try it.
Regards.
I know,and I modified it.that's why it's working on frame 1H 4H and 1Day
right now I am drawing the w1 and MN1 lines on timeframe 1H, the problem is still here as in the pic I posted on floor 1
I know,and I modified it.that's why it's working on frame 1H 4H and 1Day
right now I am drawing the w1 and MN1 lines on timeframe 1H, the problem is still here as in the pic I posted on floor 1
Did you try my script ?? Please open a W1 or MN1 chart and attach my script and you will see that it draws trend line with ray right. You can see here:
You did not even say whether the issue was about MT4 or MT5. It is not possible to deduce which platform you are using either by the code you showed or by the image. Since the 90% of questions that are made in this forum are about mql4, I assumed that you use MT4. I
also told you that I use build 1090 (which corresponds to MT4) and
uploaded a MT4 script and you did not say that MT4 was not the platform
you use, so I assume the question is about MT4, but anyway, I made another similar script for MT5 and it works fine too. If the question is about MT5 tell me and I will upload such script.
Therefore, your problem is due to your code, it is not an MT4 or MT5 bug.
Problem solved.
Regards
Did you try my script ?? Please open a W1 or MN1 chart and attach my script and you will see that it draws trend line with ray right. You can see here:
You did not even say whether the issue was about MT4 or MT5. It is not possible to deduce which platform you are using either by the code you showed or by the image. Since the 90% of questions that are made in this forum are about mql4, I assumed that you use MT4. I
also told you that I use build 1090 (which corresponds to MT4) and
uploaded a MT4 script and you did not say that MT4 was not the platform
you use, so I assume the question is about MT4, but anyway, I made another similar script for MT5 and it works fine too. If the question is about MT5 tell me and I will upload such script.
Therefore, your problem is due to your code, it is not an MT4 or MT5 bug.
Problem solved.
Regards
thank you for your patience.
maybe I didn't make it clear. I am using the mt4 and I am drawing the trend of w1 and MN1 on a timeframe 1H,
which means that I draw a trend line that calculated on w1 or mn1, on timeframe 1H,
on the pic I uploaded in floor one, the red and yellow ones correspond to the w1 and MN1 trend.
And I found another problem, that the W1 and MN1 trend line is working good on usoil chart, but not usdx, may be the problem lies in the data volume?
because the usdx data on my pc is not enough
Hi Sir
Know it's been long time you asked this topic, Today I just faced this challenge and found you here, hopefully I understand your concern since I have same problem now and I could fix it, here is the solution :
double price_1 = ... double price_2 = ... double time_1 = ... double time_2 = ... ObjectCreate(0,name,OBJ_TREND,0,MathMin(time_1,time_2),price_1,MathMax(time_1,time_2),price_2);
the first element of 'time' must be less than the second. that's why you see LEFT_RAY is looking like righ-ray.
hope this fix your problem.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
the following code is in the help tutorial and I am creating trend lines on frame_1H, the trendlines of (30 60 4H and 1day) is raying right as coded
but the trendline of PERIOD_W1 and PERIOD_MN1 is not raying right,but the opposite direction as shown in the image
any idea the problems?
//--- enable (true) or disable (false) the mode of continuation of the line's display to the right
ObjectSetInteger(chart_ID,name,OBJPROP_RAY_RIGHT,ray_right);