You don't need an Indicator to change the colours of the candles (body or shadow). Just set them in the Properties (F8 -> Colors) of the Chart and then Save it as a Template (e.g. Default template):
Hello
Actually I need a kind of chart that Open of any Candle is equal to Close of Previous candle.
I mean this type of candle
for(i=pos+1; i<rates_total; i++) { NewOpenBuffer[i]=close[i-1]; NewCloseBuffer[i]=close[i]; NewLowBuffer[i]= MathMin(NewOpenBuffer[i],low[i]); NewHighBuffer[i]= MathMax(NewOpenBuffer[i],high[i]); }
I have 4 buffers for High-Open-Low-Close.
my External color:
input color ExtColor1 = Red;
input color ExtColor2 = LightSeaGreen;
and my SetIndexStyle:
SetIndexStyle(0,DRAW_HISTOGRAM,0,1,clrWhite);
SetIndexBuffer(0,NewLowBuffer);
SetIndexStyle(1,DRAW_HISTOGRAM,0,1,clrWhite);
SetIndexBuffer(1,NewHighBuffer);
SetIndexStyle(2,DRAW_HISTOGRAM,0,3,ExtColor1);
SetIndexBuffer(2,NewOpenBuffer);
SetIndexStyle(3,DRAW_HISTOGRAM,0,3,ExtColor2);
SetIndexBuffer(3,NewCloseBuffer);
Take a look at the "Heiken Ashi" indicator provided by MetaQuotes. You will be able to learn how to do what you want from that code.
You will find the "Heiken Ashi.mq4" file in your "Indicators" folder.
To tell the truth I changed the heiken ashi chart to my own chart,
Maybe I should define 6 buffer : 2 buffer for open and close with differrent colors and 2 buffer for high and 2 buffer for low
if close>open then it is a bullish and use the the buffer of high which is related to bullish color and so on and so forth.
Any idea??
To tell the truth I changed the heiken ashi chart to my own chart,
Maybe I should define 6 buffer : 2 buffer for open and close with differrent colors and 2 buffer for high and 2 buffer for low
if close>open then it is a bullish and use the the buffer of high which is related to bullish color and so on and so forth.
Any idea??
Yes. Drop the Heiken Ashi, make it all one color and create objects.
Yes. Drop the Heiken Ashi, make it all one color and create objects.
Sorry to say this, but that is a very BAD choice for this case. He is recreating candle bars. Buffers is the RIGHT way to go and the Heiken Ashi is the example he should use.
To tell the truth I changed the heiken ashi chart to my own chart,
Maybe I should define 6 buffer : 2 buffer for open and close with differrent colors and 2 buffer for high and 2 buffer for low
if close>open then it is a bullish and use the the buffer of high which is related to bullish color and so on and so forth.
Any idea??
@masoud0455_a: The Heiken Ashi I have only uses 4 buffers. All you have to do is substitute the calculations of the haOpen, haClose, haHigh and haLow for your own values that you wish to use.
The trick that is used in the Heiken Ashi indicator to getting the colours correct is to switch the High and Low values when the bar is in the opposite direction. So make sure you do not remove that functionality.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Is it possible to change the color of each candle in for loop?
is it possible to change the color of High/Low shadow for bearish and bullish candle same as body?
I attach my .mq4 file please have look. it take just a second time.