Metatrader 5 coding questions / issues - page 4

 
mladen:
Doc It is not impossible. It is simply too specific and, due to usage of trendlines (which are objects) it is sort of "too specific". You already have a solution in metatrader 4 - conversion of that to metatrader 5 using ObjectGetValueByTime() function is not that difficult

I did ask something like that for view only how should be the zz function

 
dr.house7:
I did ask something like that for view only how should be the zz function

Doc

ZigZag indicator is usually drawn using one of the 2 special drawing types of drawing : DRAW_SECTION or DRAW_ZIGZAG. Both mean that there are values only in "control points" (peaks and throughs). All the rest of the points are actually empty. And since they are drawn using buffers, you would get wrong values for those empty points.

ZigZag would need to be made differently for the purpose you are talking about : code should do a linear interpolation between the "control points" for all the buffer points that would usually be empty and after that it is a simple case of comparing two buffer values at a same bar

 

Metatrader 5 seems more and more like a lost cause. And even metatrader 4 with latest changes it taking a similar path

 
mladen:
Doc It is not impossible. It is simply too specific and, due to usage of trendlines (which are objects) it is sort of "too specific". You already have a solution in metatrader 4 - conversion of that to metatrader 5 using ObjectGetValueByTime() function is not that difficult

Good morning Mladen,

I tried to make the code for mt5 but doesn't work...what's the reason this time?

zz1l[0] = ObjectGetValueByTime(0,"trend_2",time[0],OBJ_TREND);

zz1h[0] = ObjectGetValueByTime(0,"trend_1",time[0],OBJ_TREND);

Files:
zz_signal.mq5  12 kb
 
dr.house7:
Good morning Mladen,

I tried to make the code for mt5 but doesn't work...what's the reason this time?

zz1l[0] = ObjectGetValueByTime(0,"trend_2",time[0],OBJ_TREND);

zz1h[0] = ObjectGetValueByTime(0,"trend_1",time[0],OBJ_TREND);

Doc,

Last parameter of the ObjectGetValueByTime() function when it comes to trend lines is always 0 (according to metaquoyes documentation). Also, make sure that trend lines named "trend_1" and "trend_2" actually exist on the chart

 
mladen:
Doc, Last parameter of the ObjectGetValueByTime() function when it comes to trend lines is always 0 (according to metaquoyes documentation). Also, make sure that trend lines named "trend_1" and "trend_2" actually exist on the chart

Thanks Mladen, this happens when a beginner passes from one editor to another, I forgot to check name of trend lines...

By the way I wrote this and still doesn't work:

zz1l[0] = ObjectGetValueByTime(0,"ZigZagChannel1Lower Line",time[0],0);

zz1h[0] = ObjectGetValueByTime(0,"ZigZagChannel1Upper Line",time[0],0);
Files:
zz_signal_2.mq5  12 kb
 
dr.house7:
Thanks Mladen, this happens when a beginner passes from one editor to another, I forgot to check name of trend lines...

By the way I wrote this and still doesn't work:

zz1l[0] = ObjectGetValueByTime(0,"ZigZagChannel1Lower Line",time[0],0);

zz1h[0] = ObjectGetValueByTime(0,"ZigZagChannel1Upper Line",time[0],0);

When you are using default time from the OnCalculate() parameters, then use time[rates_total-1] instead of time[0] (since time[] that is passed in parameters of the OnCalculate() function is a C like array not as we used to be in metatrader 4 0th element is the first (oldest) element, not the last (current bar))

 
mladen:
When you are using default time from the OnCalculate() parameters, then use time[rates_total-1] instead of time[0] (since time[] that is passed in parameters of the OnCalculate() function is a C like array not as we used to be in metatrader 4 0th element is the first (oldest) element, not the last (current bar))

Thanks once again Any chance to see how make the code more functional omitting the function iCustom, I really don't know how to start

 
dr.house7:
Thanks once again Any chance to see how make the code more functional omitting the function iCustom, I really don't know how to start

Doc

You would need to have all the calculation from the custom indicator transferred into a function

 

My apologies if this is not the correct place to post this but I'm looking for a reputable coder in MT5 to convert an indicator and create an EA based on the indicator. This is of course paid work. Could someone point me in the right direction please. Many thanks