Thanks for the contribution!
Nice looking indicator. Is that available somewhere?
Thanks,
Mark.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi everyone
As we know there are some requests about drawing rectangles on charts or just to make our custom indicators more "beautiful". By this I have made a function that can be used to do this kind of thing. Just give me credits for it if you use it, that's all I ask. So you probably asking how it works, for sure this is not the best way but for now is the way I can do, it gets the character 110(the square) from the font wingdings and draw 1, 2, 3...anyway how much it needs to make the cell, but don't worry the function is made to calculate how much squares are needed to don't be too heavy to draw. I hope soon metaquotes let us draw rectangles without making things like these.
To use it is simple:
nWindow = The window that will be used to draw.
nCellName = The base name for the cell(it's a base name so if it needs to draw 2 or more squares the names will be like "basename1", "basename2"...
nX = The top corner X position.
nY = The top corner Y position.
nWidth = Width of the cell.
nHeight = Height of the cell.
nColor = Color.
// DrawCell.
//
// Author: Alexandre A. B. Borela
// Description: Draws a cell using the minimum character
// as it can, so it's going to take less time
// to draw the cell.
void DrawCell(int nWindow, string nCellName, double nX, double nY, double nWidth, double nHeight, color nColor)
{
double iHeight, iWidth, iXSpace;
int iSquares, i;
if(nWidth > nHeight)
{
iSquares = MathCeil(nWidth/nHeight); // Number of squares used.
iHeight = MathRound((nHeight*100)/77); // Real height size.
iWidth = MathRound((nWidth*100)/77); // Real width size.
iXSpace = iWidth/iSquares - ((iHeight/(9-(nHeight/100)))*2);
for(i=0;i<iSquares;i++)
{
ObjectCreate (nCellName+i, OBJ_LABEL,nWindow,0,0);
ObjectSetText (nCellName+i, CharToStr(110),iHeight, "Wingdings", nColor);
ObjectSet (nCellName+i, OBJPROP_XDISTANCE,nX + iXSpace*i);
ObjectSet (nCellName+i, OBJPROP_YDISTANCE,nY);
ObjectSet (nCellName+i, OBJPROP_BACK, true);
}
}else{
iSquares = MathCeil(nHeight/nWidth); // Number of squares used.
iHeight = MathRound((nHeight*100)/77); // Real height size.
iWidth = MathRound((nWidth*100)/77); // Real width size.
iXSpace = iHeight/iSquares - ((iWidth/(9-(nWidth/100)))*2);
for(i=0;i<iSquares;i++)
{
ObjectCreate (nCellName+i, OBJ_LABEL,nWindow,0,0);
ObjectSetText (nCellName+i, CharToStr(110),iWidth, "Wingdings", nColor);
ObjectSet (nCellName+i, OBJPROP_XDISTANCE,nX);
ObjectSet (nCellName+i, OBJPROP_YDISTANCE,nY + iXSpace*i);
ObjectSet (nCellName+i, OBJPROP_BACK, true);
}
}
}An example of use:
{
ObjectsDeleteAll(0);
DrawCell(0,"test",200,200,20,100,White);
return(0);
}I hope this will improve the way we see those signal tables to make it even better, an example of my signal table using this feature: