Display some text on top of each bar on chart
Hi,
I found it. Works well. thanks for all your reply
double Vertical_Offset= Point*15; string Horizontal_Offset = " "; ObjectCreate("data", OBJ_TEXT, 0, Time[1], High[1]+ Vertical_Offset); ObjectSetText("data",Horizontal_Offset+DoubleToStr(AccountBalance(),2),10,"Times New Roman", Red); ObjectSet("data",OBJPROP_ANGLE,50);
If your text varies in size there are differences in the placement. I think because of the alignment that cannot be changed. So you have to fill it up with spaces. I have been trying to get it EXACTLY above the bar in question but it does not seem to be possible. The below is the best I could do.
void alert(string message, color kleur) { double Vertical_Offset= Point*80; int TextLen=StringLen(message); for(int i=1; i<TextLen; i++) message = message+" "; if(!kleur) { kleur = Black; } string Horizontal_Offset = ""; string objectname = "textabove" + TimeCurrent(); ObjectCreate(objectname, OBJ_TEXT, 0, Time[0], High[0]+ Vertical_Offset); ObjectSetText(objectname,Horizontal_Offset+message,7,"Arial Bold", kleur); ObjectSet(objectname,OBJPROP_ANGLE,90); ObjectSetInteger(0,objectname,OBJPROP_ANCHOR,ANCHOR_LEFT_UPPER); }
Hi everyone,
I am trying to display pattern name on candlestick once found. I have tried hard but as I am not familiar with Objects/buffers I end up with nothing working out for me. I would be very grateful if someone help me to implement either a arrow or text on candlestick pattern preferably through buffers.
double H1 = iHigh(Symbol(), TimeFrame(i),1);
double L1 = iLow(Symbol(), TimeFrame(i),1);
double O1 = iOpen(Symbol(), TimeFrame(i),1);
double C1 = iClose(Symbol(),TimeFrame(i),1);
if(Doji_Alert)
{
if(MathAbs(C1-O1)/(H1-L1)<0.1 && (H1-MathMax(C1,O1))>(3*MathAbs(C1-O1)) && (MathMin(C1,O1)-L1)>(3*MathAbs(C1-O1)))
{
// DRAW ARROW OR TEXT ON CANDLESTICK
Alert(EnumToString(TimeFrame(i))," ",Symbol()," DOJI ",TimeToString(tim));
}
break;
}
Thank you.
- www.mql5.com
Hi,
Can someone please tell how to put some text vertically or diagnolly starting from the High of each bar on the current chart
I tried below code but it it showing somewhere in the middel of chart.
I can use ObjectSet but how do i know the x and y coordinates of each bar's High ?
thanks