Just made an IDE for MQL4

Post Reply
User avatar
gaheitman
Trader
Posts: 655
Joined: Tue Nov 15, 2011 10:55 pm
Location: Richmond, VA, US

Abbreviations

Post by gaheitman »

A couple other things I am working on...

I have modified mql.properties so that we have our own abbreviations file in <SciTE Directory>\abbrevs. I added the following lines to mql.properties:

Code: Select all

# abbreviations
abbreviations.$(file.patterns.mql)=$(SciteDefaultHome)/abbrevs/mql.abbrev
Abbreviations are entered in the form (without the brackets):
<shortcut>=<lots of stuff with embedded newlines and tabs, whatever else you want but all on one line>

So, a simple abbreviation to put in a header for a function could look like this:

Code: Select all

//+=//+------------------------------------------------------------------+\n//|  \n//+------------------------------------------------------------------+
Then, when you type "//+" and press Ctrl-B you'll get the expanded text.

Code: Select all

//+------------------------------------------------------------------+
//  
//+------------------------------------------------------------------+
These abbreviation puts in the ol' default text when creating a new script in Empty4, with a few modifications:

Code: Select all

/script=//+------------------------------------------------------------------+\n//|                                                 <Scriptname>.mq4 |\n//|                                    Copyright © 2012, <your name> |\n//+------------------------------------------------------------------+\n#property copyright "Copyright © 2012, <yourname>"\n\n//+------------------------------------------------------------------+\n//| script program start function                                    |\n//+------------------------------------------------------------------+\nint start()\n  {\n   return(0);\n  }\n//+------------------------------------------------------------------+
While working with these abbreviations I came across a problem with the sidebar code. It was throwing an error when I highlighted an abbreviation on the panel. Apparently, it was supposed to be showing me a preview as a calltip/annotation. I ended up turning off a bit of codepage translation to make it work, so who knows what far reaching impact this might have! I've included the updated sidebar.lua script.

One more tip, if you have your own code, formats, whatever that you want turned into abbreviations, you can paste them into a blank document and then format them via search and replace. Just search for "\r\n" and replace with "\\n". Make sure to select the option in the replace dialog to "Transform backslash expressions". This will collapse everything to one line.

George
You do not have the required permissions to view the files attached to this post.
cybernick
Posts: 4
Joined: Sun Oct 14, 2012 2:41 pm

Re: Just made an IDE for MQL4

Post by cybernick »

is there a way to view the Help predefined functions / variables at the bottom like in the mql editor?
phaholj
Trader
Posts: 25
Joined: Thu Aug 16, 2012 6:25 am

Re: Just made an IDE for MQL4

Post by phaholj »

How do i install and run the IDE for MQL4?
User avatar
gaheitman
Trader
Posts: 655
Joined: Tue Nov 15, 2011 10:55 pm
Location: Richmond, VA, US

Re: Just made an IDE for MQL4

Post by gaheitman »

phaholj wrote:How do i install and run the IDE for MQL4?
That was answered earlier in the thread. I'd recommend reading the whole of it, but if you are pressed for time search the thread for "install".

George
phaholj
Trader
Posts: 25
Joined: Thu Aug 16, 2012 6:25 am

Re: Just made an IDE for MQL4

Post by phaholj »

gaheitman wrote:
phaholj wrote:How do i install and run the IDE for MQL4?
That was answered earlier in the thread. I'd recommend reading the whole of it, but if you are pressed for time search the thread for "install".

George

Thanks
I have read the whole thread now and i have lot of info and it is now working.
This is great, i will stop using MetaEditor and focus on the code.
phaholj
Trader
Posts: 25
Joined: Thu Aug 16, 2012 6:25 am

Re: Just made an IDE for MQL4

Post by phaholj »

gaheitman wrote:
dietcoke wrote:
gaheitman wrote:
BTW, I've added the rest of the reserved words to the api file, which is why I got so many choices to begin with.

I haven't mentioned this yet, but I'm loving this editor!
George

George,

would you mind posting your mods?
Certainly. First off, I have hacked together a way to create an api file from source using the existing sidebar functionality.

You need to tell SciTE to use a secondary mql.api file. I named it _mql.api and it is in the same directory as the first. To do this, modify mql.properties --

This:

Code: Select all

api.$(file.patterns.mql)=$(SciteDefaultHome)\api\mql.api
becomes this:

Code: Select all

api.$(file.patterns.mql)=$(SciteDefaultHome)\api\mql.api;$(SciteDefaultHome)\api\_mql.api
The attached Sidebar.lua (uploaded as sidebar.txt since the board doesn't allow .lua) file adds an item to the context menu of the Functions/Bookmarks pane to "Save api". When selecting this, it will basically write the contents of that pane to the _mql.api file. Unfortunately, SciTE doesn't immediately re-read api files, you have to switch to a different file type (in another buffer) and then switch back. Working on that....

Context menu:
IMG_41.gif
After running "Save api" on MultiBob, here's the Calltip (after the autocomplete, of course, since I had the case wrong :>)

Calltip from MultiBob:
IMG_42.gif
I also changed the file mask to be *.mq4 so the directory view is immediately useful (for mql programming, that is).

EDIT: Updated mql.txt to include all constants.

George
Where do you place the SideBar.lua?
On which directory?
User avatar
gaheitman
Trader
Posts: 655
Joined: Tue Nov 15, 2011 10:55 pm
Location: Richmond, VA, US

Re: Just made an IDE for MQL4

Post by gaheitman »

phaholj wrote:
Where do you place the SideBar.lua?
On which directory?
It's in the \additions folder off of wherever you installed the program. There will be a SideBar.lua there already.

George
phaholj
Trader
Posts: 25
Joined: Thu Aug 16, 2012 6:25 am

Re: Just made an IDE for MQL4

Post by phaholj »

gaheitman wrote:
phaholj wrote:
Where do you place the SideBar.lua?
On which directory?
It's in the \additions folder off of wherever you installed the program. There will be a SideBar.lua there already.

George

Thanks
Its now working.
It also display only *.mq4 file on the FileMan tab of the SlideBar
User avatar
gaheitman
Trader
Posts: 655
Joined: Tue Nov 15, 2011 10:55 pm
Location: Richmond, VA, US

Re: Just made an IDE for MQL4

Post by gaheitman »

phaholj wrote:
gaheitman wrote:
phaholj wrote:
Where do you place the SideBar.lua?
On which directory?
It's in the \additions folder off of wherever you installed the program. There will be a SideBar.lua there already.

George

Thanks
Its now working.
It also display only *.mq4 file on the FileMan tab of the SlideBar
Yes, I set the filter to start that way. If you right click on a file in the box, you can set it to show all files. If you find the start behavior annoying, you'll have to edit sidebar.lua. Just search for *.mq4 and replace it with the extension you would like (or *.*, of course).

George
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: Just made an IDE for MQL4

Post by SteveHopwood »

w633, when I try to compile a script, I get these error messages:

2;76;C:\Program Files\Cowboy IBFX Trader 4\Cowboy IBFX demos\Software development\Software development\experts\scripts\TradeHedgeBUYALL.mq4;10:1;'WinUser32.mqh' - cannot open the program file
2;76;C:\Program Files\Cowboy IBFX Trader 4\Cowboy IBFX demos\Software development\Software development\experts\scripts\TradeHedgeBUYALL.mq4;11:1;'stdlib.mqh' - cannot open the program file

What can I do?

: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.
Post Reply

Return to “Coders Hangout”