Small coding request

Post Reply
User avatar
BigMack
Posts: 5
Joined: Wed Nov 16, 2011 6:16 pm

Small coding request

Post by BigMack »

Hi all
Could someone please help me with the following coding problem.
I have written the attached ea that displays information in columns but as you can see from the attached picture the numbers move left and right across the screen depending on the number of digits in each column could some helpful person explain to me how to keep them in nice straight columns.
Many thanks for any help offered :) .
chart picture.JPG
Martins Indicator v1.mq4
You do not have the required permissions to view the files attached to this post.
magft
Trader
Posts: 195
Joined: Tue Nov 15, 2011 9:59 pm
Location: East Midlands, UK

Re: Small coding request

Post by magft »

You could get fancy and measure the length of each item and pad with spaces to get uniform columns, you would also need a monospaced font to make it look ok.

All the other indicators i have seen use labels and then you can line up the coordinates. I have attached Basket stats and i-profittracker as an examples.

Mike
You do not have the required permissions to view the files attached to this post.
User avatar
BigMack
Posts: 5
Joined: Wed Nov 16, 2011 6:16 pm

Re: Small coding request

Post by BigMack »

Hi Mike many thanks :D looks promising will study these examples and hopefully figure it out.
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Re: Small coding request

Post by SteveHopwood »

BigMack wrote:Hi Mike many thanks :D looks promising will study these examples and hopefully figure it out.
Take a tip from me, cos I have learned this the hard way. Once you have it sorted out, save the code in a file whose name reflects what you have done. Then save it in a dedicated folder called 'Examplar code snippets' or 'Template code snippets' or some such. Then create a text file where you list the file name and a description of what the code does. Then back up the folder in 15 different places and repeat the backup process every time you add a file. Include an online upload facility such as mediafire.

Once I learn to follow my own advice, I will save myself hours of time hunting for that routine that I know I coded some time........................ :lol:

:D
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
hayseed
Posts: 5
Joined: Wed Nov 16, 2011 10:44 pm

Re: Small coding request

Post by hayseed »

hey mack..... as you see, our hands are pretty much tied when using the comment() function to display info.....

most of us move to text objects.... the flexibilty is endless.....

also, you might find arrays far more convienent to repetitive code..... many of the indicators sold on the net might contain thousands of line of repetitive code..... they can very often be reduced to a few dozen lines when using arrays.....

here is a quick "ea" example..... which could be still reduced 50%....... i left it long so you could better see the idea.......h
You do not have the required permissions to view the files attached to this post.
User avatar
BigMack
Posts: 5
Joined: Wed Nov 16, 2011 6:16 pm

Re: Small coding request

Post by BigMack »

Hi Hayseed many thanks for this it is much appreciated :D I have a book that I am working through but it doesn't mention these text objects so your example will be very helpful. I can see straight away they do exactly what I want to do. The arrays I am sort of aware of just have no idea yet how to use them its hopefully just a matter of time and practice..
Will let you know how I progress :D

Thanks again to Hayseed & magft & steveH for your assistance
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Re: Small coding request

Post by SteveHopwood »

BigMack wrote:Hi Hayseed many thanks for this it is much appreciated :D I have a book that I am working through but it doesn't mention these text objects so your example will be very helpful. I can see straight away they do exactly what I want to do. The arrays I am sort of aware of just have no idea yet how to use them its hopefully just a matter of time and practice..
Will let you know how I progress :D

Thanks again to Hayseed & magft & steveH for your assistance
Google is a huge resource when we are stuck.

I remember wanting to learn how to extract values from labels printed on the screen by an indi.
"values from labels" didn't help,so I tried:
"values from labels mql4"

and gained what I wanted from the search. Wonderful thingy, Google.

:D
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
User avatar
KevinT
Trader
Posts: 113
Joined: Fri Jan 06, 2012 4:23 am

Re: Small coding request

Post by KevinT »

SteveHopwood wrote:
BigMack wrote:Hi Hayseed many thanks for this it is much appreciated :D I have a book that I am working through but it doesn't mention these text objects so ...
Google is a huge resource when we are stuck.

I remember wanting to learn how to extract values from labels printed on the screen by an indi.
"values from labels" didn't help,so I tried:
"values from labels mql4"

and gained what I wanted from the search. Wonderful thingy, Google.
:D

Hi OCCD's :mrgreen: all,

I too googled "prevent/skip/avoid/how not to/etc, display the dialog box mql" and no joy :(

So I ask a very naive, basic+simple question:

- How can I disable EA's from stopping & displaying the dialog box once dragged upon a chart (so they are executed immediately with the hard coded parameters...)

Post Scriptum: Durante solved half of the problem sugesting commenting out "#property show_inputs", and that nails it for the scripts :D, As for the EAs (at least some SH eas ;)) other method of calling the dialog box must have been used! :cry:

Regards, Kevin :|
Last edited by KevinT on Mon Apr 22, 2013 1:06 pm, edited 1 time in total.
fxprotrader
Trader
Posts: 26
Joined: Sat Jun 16, 2012 11:26 pm

Re: Small coding request

Post by fxprotrader »

KevinT wrote:
SteveHopwood wrote:
BigMack wrote:Hi Hayseed many thanks for this it is much appreciated :D I have a book that I am working through but it doesn't mention these text objects so ...
Google is a huge resource when we are stuck.

I remember wanting to learn how to extract values from labels printed on the screen by an indi.
"values from labels" didn't help,so I tried:
"values from labels mql4"

and gained what I wanted from the search. Wonderful thingy, Google.
:D

Hi OCCD's :mrgreen: all,

I too googled "prevent/skip/avoid/how not to/etc, display the dialog box mql" and no joy :(

So I ask a very naive, basic+simple question:

- How can I disable EA's from stopping & displaying the dialog box once dragged upon a chart (so they are executed immediately with the hard coded parameters...)

Post Scriptum: Durante solved half of the problem as making a label of "#property show_inputs", nailed it for the scripts :D, As for the EAs (at least some SH eas ;)) other method of calling the dialog box must have been used! :cry:

Regards, Kevin :|
Kevin-
It would a helpful if you posted the EA's code in question.
Post Reply

Return to “Coders Hangout”