investflow / mqlidea

MQL4 plugin for Intellij Idea
http://investflow.ru/mqlidea
GNU General Public License v3.0
52 stars 20 forks source link

Documentation #2

Closed verbatino closed 7 years ago

verbatino commented 7 years ago

Can you make some documentation how to compile and run EA from intellij?

mfursov commented 7 years ago

I will add initial version of the documentation during the next 2-3 days. If you need a hint right now: try adding new Run configuration and select 'MQL4 Build' option. Please not, if you use Windows install your terminal into folder you can can edit (not Program Files). (I use Linux only, so may need some help with additional testing on Windows.)

verbatino commented 7 years ago

I'm using classic windows installation (in Program Files), but of course i can install another copy of MT in other destination. The problem is that when i select MQL4 Build in run configuration there is no MQL SDK... Can you help?

mfursov commented 7 years ago

Click to the button right to the empty SDK list and select MT folder. You can do the same action from global Settings menu (Languages & Frameworks -> MQL4)

verbatino commented 7 years ago

Actually, i've tried to do so before you said that... I've selected directory with a fresh install of MT4 - for tests - on my Dekstop. Unfortunatly it returns an error: "The selected directory is not a valid home for MQL4 SDK". image

In global settings i've got only this: image

mfursov commented 7 years ago

Sorry, I missed the menu name: Use: File -> Project Structure -> SDKs -> Add New -> MQL4 SDK

The same option should be available from Run -> Edit Configurations -> + MQL4 Build -> Browse (...) button for SDK row.

You should select the installation folder of MT in both cases

The SDK is considered valid today if:

    @Override
    public boolean isValidSdkHome(@NotNull String path) {
        log.debug("Validating sdk path: " + path);
        if (!new File(path, "metaeditor.exe").exists()) {
            log.debug("metaeditor.exe not found!");
            return false;
        }
        if (!new File(path, "terminal.exe").exists()) {
            log.debug("terminal.exe not found!");
            return false;
        }
        if (!new File(path, "MQL4/Include").exists()) {
            log.debug("MQL4/Include not found!");
            return false;
        }
        return true;
    }
verbatino commented 7 years ago

Yeah, i've tried adding SDK in project settings earlier... Effect is the same as in previous post. But the code you've posted helped to find the problem. The third "if" statement has a bug... "MQL\Include" is not located in standard MT4 install location. It's in data folder located in 'X':\Users\'XXX'\AppData\Roaming\MetaQuotes\Terminal\'XXXXXXXXXXXXXXX'

mfursov commented 7 years ago

Thank you. I will update code and simplify this check.

I test plugin on Linux and on very old Windows XP I have. I really appreciate any help for newer Windows versions.

verbatino commented 7 years ago

If I would be able to help... i will :) Another thing is creating a project in IntelliJ with MQL based module. Probably it would help to standardize the SDK, build and run configuration....

mfursov commented 7 years ago

Finally I got my Windows7 in Virtual Box and was able to fix some issues with Metatrader files location. Could you please try the attached version of the plugin?

mqlidea.zip

verbatino commented 7 years ago

Well... it compiles... but doesn't run the terminal and doesn't tell where is the output directory (where is compiled app placed). Additionally, built-int functions in MQL4 are not recognized (look at screenshot - for example MarketInfo() function) and i can't make strictly mql project with mql based module :( image

mfursov commented 7 years ago

Hi, output directory is your build dir. Usually it is MQL4/Experts dir in your terminal folder.

About built-in functions: do you mean warnings in the screenshot? I see that compilation was finished without errors.

verbatino commented 7 years ago

Nope. After compile the build directory does not contain the ex4 file....neither mql4/expert... About built-in functions i mean that there is no recognistion in editor. In termial you can see only warnings for non-appropriate usage of functions.

mfursov commented 7 years ago

Normally you should select your MQL4/Experts folder as output folder. In this case your compiled file will automatically be available for Metatrader.

As for built-in function - yes, today plugin contains parser/highlighter only. It does not build AST nor analyse data types.

verbatino commented 7 years ago

Well, after my tests i can definitely say that there is no ex4 file after compile... MQL/Experts,build dir, project dir, windows user app dir... nowhere. Editor doesn't highlight built-in functions as can you see on screenshot in previous post.

mfursov commented 7 years ago

Michał, lets check the problems one by one.

The first problem is that 'built-in' function are not highlighted. But on your screenshot I see that MarketInfo function is in italic - it means it was recognized as built-in function.

Could you post new screenshot to demonstrate the problem?

verbatino commented 7 years ago

Oups... I'm a fucking tragic tester:) Didn't noticed italic style... Changed IDE look&feel to a more appropriate style and now its perfect:

obraz

I've found whats wrong about compilation. When you compile from IntelliJ the output is set to SDK dir which is MT location:

obraz

mfursov commented 7 years ago

About styles: the plugin does not change colors itself. I try to reuse default styles from IDE. The code is here: https://github.com/investflow/mqlidea/blob/master/src/ru/investflow/mql/editor/MQL4SyntaxHighlighter.java

As for the result artifact location: could you check 1) Using MT SDK that is installed to default location (Program Files folder) 2) Specify full path to you c:/users/.. Application Data./... MQL4/Experts folder?

mfursov commented 7 years ago

I added initial chunk of docs to Readme & Wiki. Closing this issue now.

verbatino commented 7 years ago

I've changed MT SDK to standard location (Program Files folder). It compiles properly but doesn't run the terminal... It places ex4 file in selected build dir folder.

mfursov commented 7 years ago

Why would you expect build process to start a terminal?