Download MetaTrader 5
To add comments, please log in or register
Download documentation as one file. It is easy!
ForexTrader17
1041
ForexTrader17 2015.12.10 02:27 

I am trying to draw a horizontal line to show me this weeks Typical MA. I want it as a horizontal line. It does not draw a horizontal line but like a zig zag line up and down with the price value. I want a horizontal line across this weeks price action in any time frame. It will move around with price as it is this weeks forming Typical MA. I have attached the Indicator Code below.

Thank you. 

Files:
Stuart Browne
5782
Stuart Browne 2015.12.10 02:58  
ForexTrader17:

I am trying to draw a horizontal line to show me this weeks Typical MA. I want it as a horizontal line. It does not draw a horizontal line but like a zig zag line up and down with the price value. I want a horizontal line across this weeks price action in any time frame. It will move around with price as it is this weeks forming Typical MA. I have attached the Indicator Code below.

Thank you. 

It's "zig zagging" because you're feeding every bar in your buffer with different weekly moving average figures. A horizontal line should have the same value for every bar. And if it's just going to be a horizontal line, why not just draw a horizontal line rather than using buffers?

If you do want to continue using a buffer, try changing from this:

 

Buffer1[i] = iMA(NULL, PERIOD_W1, 1, 0, MODE_SMA, PRICE_TYPICAL,i); //Set indicator value at Moving Average

to this

Buffer1[i] = iMA(NULL, PERIOD_W1, 1, 0, MODE_SMA, PRICE_TYPICAL,0); //Set indicator value at current bar Weekly Moving Average
ForexTrader17
1041
ForexTrader17 2015.12.10 04:10  

Thanks. That worked. And what if I need it draw only for the current week? So start Sunday and end Friday.

Thanks. 

ForexTrader17
1041
ForexTrader17 2015.12.10 04:14  
Basically I want to draw this weeks Typical MA on the chart. So it will technically update with every tic.
/
To add comments, please log in or register