Forex
Google
New signals service!

Go Back   Forex Trading > Programming > Metatrader Programming


Register in Forex TSD!
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time).
Click here to register and get more information

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-08-2008, 05:00 PM
Junior Member
 
Join Date: Jun 2008
Posts: 2
FrankUnique is on a distinguished road
Contribution: drawing rectangles on charts

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.

Quote:
//================================================== =======
// 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:

Quote:
int start()
{
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:

Example.jpg

Last edited by FrankUnique; 07-10-2008 at 02:10 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 07-08-2008, 08:31 PM
Senior Member
 
Join Date: Apr 2006
Location: Oregon
Posts: 116
67-17454 is on a distinguished road
Thanks for the contribution!

Nice looking indicator. Is that available somewhere?

Thanks,

Mark.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 07-08-2008, 10:19 PM
Junior Member
 
Join Date: Jun 2008
Posts: 2
FrankUnique is on a distinguished road
That was made by me and it's not available yet, for now I'm just dealing with the function that generate those signals because it calculate over a lot of bars to generate a signal for each time frame, this make some lags as you may imagine, as soon as I make it better I'll post here.

Last edited by FrankUnique; 07-08-2008 at 10:25 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Final contribution don_forex Expert Advisors - Metatrader 4 18 10-18-2007 08:34 PM
Drawing line from yesterday close Boogie Indicators - Metatrader 4 0 05-24-2007 08:33 AM
EA Drawing webjeff Expert Advisors - Metatrader 4 2 03-25-2007 06:49 PM
Auto LRC (Liner Regression Channel) drawing indicator! mqldev Indicators - Metatrader 4 22 02-02-2007 03:01 PM
Help with indicator drawing hi-low of time range 00009 Metatrader 4 4 05-28-2006 04:24 AM


All times are GMT. The time now is 12:14 PM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.