MQL4 Programming 8
How to Create a Simple Toggle Button in MQL4
Recently I started using an indicator that had been written by another programmer and initially it was doing a pretty good job. However,eventually I started getting annoyed with one particular implementation...
...or rather lack of implementation.
The indicator itself was a pretty simple affair and in essence all it did was to draw a series of lines starting from a predefined point. I'd drop the indicator on the chart, drag the zero line and the rest of the lines would be redrawn automatically, relative to it's position.
The problem came when I wanted to change the orientation of the lines and make the zero line the top rather than the bottom. The way the original programmer had coded it meant that the user would have to go into the settings, scroll down the list, identify the correct setting and change it from true to false.
Now instead of drawing the lines from zero upwards, it would draw them from zero downwards.
What a long winded way to accomplish a simple task!
So I decided it would be much simpler - and cooler - to have a button on the chart that would toggle the settings state from true to false. That way I wouldn't have to mess around with settings and instead could change the value by the click of a button.
Sounds pretty sweet right?
Well here's how you can do it too... (more…)
Improved Input Settings in MQL4 – Part 2
In my last article about improved input settings in mql4 I told you about enumerations and how they allow you to utilize drop down menus in your EA's settings. That was certainly a great improvement to the way settings are handled in MQL4 but there's another feature that you should be using.
If you're familiar with the original style of MQL4 coding you've probably used 'extern' variables to facilitate input from users. Since build 600 of MetaTrader 4 there's a new kid on the block.
Input variables or settings can now be declared as either 'extern' or 'input' and the difference between the two is pretty straight forward. (more…)
How to Install MQL4 Experts Advisors, Indicators and Scripts
Build 600 of MetaTrader 4 was a huge leap forward and has offered a great deal of improvements and benefits to the MQL4 coder, but it comes at a price.
Many users are confused initially and have a hard time navigating around the new interface and finding exactly where to install their expert advisors, indicators and scripts.
The folder structure of previous versions of MT4 was much more intuitive and followed the familiar pattern of C:\Program Files\MT4 etc. With Build 600 that was all changed and the folder structure is slightly more complicated but if you know how to navigate it, it's almost just as simple. (more…)
Recent Comments