Download MetaTrader 5

Draw Moving Average by ObjectCreate

To add comments, please log in or register
chry
7
chry  
It should be easy to reach this, but i need help on the way.

I wonna just draw a moving average line on a Chart likes this. (Orange Line)

 



My result is just like this. The lines going are endless to the bottom instead connecting each point to a line. (Red) 



ObjectCreate( "movav" + mytime, OBJ_TREND, 0, Time[0], indicator );


Does Anybody has an easy example Code?
Mladen Rakic
64197
Mladen Rakic  
chry:
It should be easy to reach this, but i need help on the way.

I wonna just draw a moving average line on a Chart likes this. (Orange Line)

 



My result is just like this. The lines going are endless to the bottom instead connecting each point to a line. (Red) 



ObjectCreate( "movav" + mytime, OBJ_TREND, 0, Time[0], indicator );


Does Anybody has an easy example Code?

You are missing the second price and time for the trend line that you are using and you have to limit that trend line not to extend beyond the two points that you want it to draw from-to. For that you have to change the trend line ray property

Do something like this :

      ObjectCreate( "movav" + mytime, OBJ_TREND,0, Time[0], indicatorValueNow,Time[1], indicatorValuePreviousBar );
         ObjectSet( "movav" + mytime, OBJPROP_RAY,false);
Fstrifoerr8
36
Fstrifoerr8  

ObjectCreate"movav" + mytime, OBJ_TREND0Time[0], indicator );

 

It must have 2 times and 2 prices coordinats. Like this.

 ObjectCreate"movav" + mytime, OBJ_TREND0Time[1], 1.2253 ,Time[0],1.2255);

Fstrifoerr8
36
Fstrifoerr8  
Mladen Rakic:

You are missing the second price and time for the trend line that you are using and you have to limit that trend line not to extend beyond the two points that you want it to draw from-to. For that you have to change the trend line ray property

Do something like this :

      ObjectCreate( "movav" + mytime, OBJ_TREND,0, Time[0], indicatorValueNow,Time[1], indicatorValuePreviousBar );
         ObjectSet( "movav" + mytime, OBJPROP_RAY,false);

and for current bar he needs

ObjectMove"movav" + mytime,0, Time[0], indicatorValueNow);

 ObjectMove"movav" + mytime,1, Time[1], indicatorValuePreviousBar);

To add comments, please log in or register