Forex
Google

Go Back   Forex Trading > Programming > Metatrader Programming
Forex Forum Register FAQ Members List Calendar Search Today's Posts Mark Forums Read


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 11-07-2006, 09:18 PM
waaustin waaustin is offline
Member
 
Join Date: Sep 2006
Posts: 59
waaustin is on a distinguished road
Basic Indicator Question

I have an indicator that I want to print text objects on the chart, however, I want them to be on the right upper corner of the charts instead of the left upper corner. How do I code this in the indicator?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 11-08-2006, 12:13 AM
omelette omelette is offline
Senior Member
 
Join Date: Jan 2006
Posts: 989
omelette is on a distinguished road
Hi. I presume you are referring to the main chart window. You need to create an object (ObjectCreate), of type 'label', then set use ObjectSet to set the X&Y co-ords. to where you want to print.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 11-08-2006, 04:08 AM
waaustin waaustin is offline
Member
 
Join Date: Sep 2006
Posts: 59
waaustin is on a distinguished road
Quote:
Originally Posted by omelette
Hi. I presume you are referring to the main chart window. You need to create an object (ObjectCreate), of type 'label', then set use ObjectSet to set the X&Y co-ords. to where you want to print.
Can you, or someone, give me a couple of examples please?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-26-2008, 08:13 PM
Dave137 Dave137 is offline
Senior Member
 
Join Date: Oct 2007
Posts: 153
Dave137 is on a distinguished road
Red face

I know how to create several versions of ObjectCreate.

Here is the problem I am having: I want to create a big 'Up' arrow on the right side of the graph. The Wingding to be used is #233 (up arrow).

I want a logic statement that if a>0 then a big 'UP' Lime color arrow will display on the graph using ObjectCreate.

I do not know how to create the statement - if(a>0){ ???? } and then how to praise the Wingding (233) in the ObjectCreate statement so it will display properly, size 24??

Can somebody please help me with my problem!

Dave

I am a bit stumped at this point!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-26-2008, 09:56 PM
hiachiever hiachiever is offline
Member
 
Join Date: Jan 2006
Posts: 48
hiachiever is on a distinguished road
Quote:
Originally Posted by Dave137 View Post
I know how to create several versions of ObjectCreate.

Here is the problem I am having: I want to create a big 'Up' arrow on the right side of the graph. The Wingding to be used is #233 (up arrow).

I want a logic statement that if a>0 then a big 'UP' Lime color arrow will display on the graph using ObjectCreate.

I do not know how to create the statement - if(a>0){ ???? } and then how to praise the Wingding (233) in the ObjectCreate statement so it will display properly, size 24??

Can somebody please help me with my problem!

Dave

I am a bit stumped at this point!
Hi Dave,

Here is some code that I have extraxted from one of my indicators. I must first add that I took a whole chunk of code out, and then edited in a text editor, so this code is purely for example purposes only to give you an idea of how to code what you are looking to do.

Here is the code snippet.
{
//WingDing Codes
string Arrow12 = "é"; // Thick Arrow 12 o'clock
string Arrow6 = "ê"; // Thick Arrow 6 o'clock

int Corner_of_Chart_RIGHT_TOP = 0;
string arrow;
color LblColor;

//Set defaults
LblColor = Red;
Arrow= Arrow6;

if (A> 0) {LblColor = Lime; Arrow= Arrow12;}

CreateLabel("Price",Arrow, 30, "WingDings", LblColor, Corner_of_Chart_RIGHT_TOP,20,20);
}

void CreateLabel(string LblName, string LblTxt, double FontSz, string FontName, color FontColor, int Corner, int xPos, int yPos)
{
if(ObjectFind(LblName) != 0) ObjectCreate(LblName, OBJ_LABEL, 0, 0, 0);

ObjectSetText(LblName, LblTxt, FontSz, FontName, FontColor);
ObjectSet(LblName, OBJPROP_CORNER, Corner);
ObjectSet(l LblName Name, OBJPROP_XDISTANCE, xPos);
ObjectSet(LblName, OBJPROP_YDISTANCE, yPos);
}

If you get stuck feel free to PM me.

Cheers,
Hiachiever
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-26-2008, 11:21 PM
Dave137 Dave137 is offline
Senior Member
 
Join Date: Oct 2007
Posts: 153
Dave137 is on a distinguished road
Smile

I will play with this and see if I can master it. Thanks a bunch. If I get stuck, I will contact you direct.

Thanks again,

Dave
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 02-27-2008, 12:04 AM
cja's Avatar
cja cja is offline
Senior Member
 
Join Date: Apr 2006
Posts: 515
cja is on a distinguished road
Arrow code

Quote:
Originally Posted by Dave137 View Post
I will play with this and see if I can master it. Thanks a bunch. If I get stuck, I will contact you direct.

Thanks again,

Dave
This might help it is a very basic way of putting an arrow onto the chart using Wingdings

string MA_Signal="";
color ma_color;

double price = NormalizeDouble(MarketInfo(Symbol(),9),Digits);
double MA = iMA(Symbol(),0,15,0,1,0,0);

if(MA>price){MA_Signal="ê";ma_color =Red;}
if(MA<price){MA_Signal="é";ma_color =Lime;}


ObjectDelete("Arrow");
ObjectCreate("Arrow", OBJ_LABEL, 0, 0, 0);
ObjectSetText("Arrow",MA_Signal, 80, "Wingdings", ma_color );
ObjectSet("Arrow", OBJPROP_CORNER, 1);
ObjectSet("Arrow", OBJPROP_XDISTANCE, 20);
ObjectSet("Arrow", OBJPROP_YDISTANCE, 40 );

Here is an example indicator with this code in it and another indicator fanSimple which shows the use of the numbered Arrow code ie 233 234 etc

cja

Arrow Wingdings.mq4

fanSimple8-1a_NEW.mq4
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 02-27-2008, 12:41 AM
Dave137 Dave137 is offline
Senior Member
 
Join Date: Oct 2007
Posts: 153
Dave137 is on a distinguished road
Smile

Thanks! I did it and got it to work - Yahooo!

One more thing I have learned on programming this language. I have one other question I would like to post, but seeing it is getting late here in Houston, Texas, I will ask it tomorrow. I really appreciate the help - There are a great bunch of good people that are members that make up this forum - I say honestly that from my 3+ years of forex history this is probably the "Best Forex Forum" on the internet

Have a Great Night or Day, wherever you live!

Dave
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 04-02-2008, 02:54 PM
fireant's Avatar
fireant fireant is offline
Junior Member
 
Join Date: Mar 2008
Location: Perth Western Australia
Posts: 7
fireant is on a distinguished road
Is there a way to annotate bars ?

Hi all,

Does anyone know of a way to programmaticly add text to a bar ?
Like a number or a letter underneath it or above it ?

Cheers.

Ant
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Basic questions ... cardio Questions 58 06-27-2008 03:51 PM
MT4 (Basic) Questions stepwise Metatrader 4 2 05-21-2007 04:03 PM
Very basic coding help needed camisa Questions 1 05-08-2006 05:36 PM


All times are GMT. The time now is 03:06 AM.