System Messages

This forum is for members of the Apiary Investment Fund. To learn more about how to get involved,
sign up now for a 14 day free trial or fill out the form below and preview the training right now!

MetaTrader4 - Expert Advisors, Indicators and Scripts

Back to Forums

MetaTrader4 - Expert Advisors, Indicators and Scripts

Hi all,

This post is for those of you who wish to try out an Expert Advisor, Indicator or Script but aren't too sure where to start.

First, some background information. These are "add ons" that you can use within Metatrader4 (MT4). They are created by writing a set of rules and commands using Metatrader Query Language (MQL) which is quite similar to modern day computer languages (e.g. C++, Java). The code you write (Source Code) is stored in a file with a suffix of MQ4.

Once the code has been written it is "processed" into a format that the computer/MT4 can understand better. This is called compiling and generates a file with the suffix of EX4.

So, a simple file called MyIndicator.MQ4 would also have a MyIndicator.EX4 file.

To use the code within MT4, all you need is the EX4 file, however you will not be able to edit or look at the original source code without the MQ4 file.

(NOTE! When you get spam email from trading sites saying, "I've got this great money making scheme for only $99.97 - if you hurry", you'll almost certainly only ever get the EX4 file. Oh - and it'll probably make more money for the seller than you!)

So - what are the differences between the types of file...

Expert Advisors (EA's)

These are programs that are designed to automate the trading process by identifying where to enter trades, how many lots to buy/sell, where to place stops/targets and how it will trail any position to maximise potential profit. They generally update every time a new tick arrives.

Sounds great doesn't it.

The problem is, when a human looks at a chart, there is frequently a large amount of subjective data that the human can make sense of easily. e.g. a Human might say, enter when the fast MA crosses the slow MA and the RSI is NEAR 50. But what does NEAR actually mean? The EA likes to work with absolutes, and some of the things we lack in trading are absolutes.

Consequently, putting all the rules that you use for entering/managing a trade into an EA is not always straight forward, often produces unexpected results, and can easily lead to "curve fitting" e.g. optimising the output of the EA to return as high a profit as possible but only for a specific set of circumstances.


These allow you to create variations of existing indicators or completely new ones based on whatever set of rules you wish and to display them on the charts or below in the data windows. Indicators cover such things as moving averages, histograms, plotting text above/below bars and changing bar colours based on the coded rules. These are adjusted every time a new tick arrives but depending on the nature of the data being processed may need a certain number of bars to have been posted (e.g. a 10 period MA will need at least the previous 10 bars to provide a value).


Scripts are "one hit" pieces of code - usually. The idea is that you drop a script on a chart, it does it's work and that's it. This can be altered however (e.g. the DOM is initiated via a script, but it doesn't disappear.


So - I've got these file things, where do I put them?

I'll approach this from the perspective of code that has been attached to a post in the forum, but the principal works the same if you get an Indicator/EA/Script from some other source.

So we have something to test with I've attached an indicator I have made changes to based on the MACD (For Info - it brings it into line with other packages such as TradeStation but can also display the same as the MT4 versoin).

The three types of file (Experts, Indicators, Scripts) all have their own place to "live" within the MT4 directory structure. To begin with, where does MT4 live

For those of you that have not yet installed the very latest version of MT4, you will find MT4 here... (probably - there will always be an exception :-)

(for XP, 32 bit Windows) C:\Program Files\MT4 Quant powered by Divisa Capital

(for Windows 7 64 bit) C:\Program Files (x86)\MT4 Quant powered by Divisa Capital

If you have the very latest version you will find the install directory... I'll use this as the default for the rest of this post.

C:\MT4 Quant powered by Divisa Capital


If you have an Expert Advisor (EA) you will need to place the files here...

C:\MT4 Quant powered by Divisa Capital\experts

If you have an Indicator it needs to go here...

C:\MT4 Quant powered by Divisa Capital\experts\indicators

If you have a Script it needs to go here...

C:\MT4 Quant powered by Divisa Capital\experts\scripts


For our example files we need to put them into the indicators directory.

To do this, right click on the dcm_MACD_Col.ex4 file. You will have a small pop up menu appear. One of the options will be "Save Link As" (Firefox) or "Save Target As" (Internet Explorer) (something similar for Chrome and other browsers).

Choose this option and it will present you with a dialog that allows you to navigate to the directory as specified above (i.e. ...experts\indicators).

Click on Save and the file will be saved in the correct location. Now do the exactly the same with the dcm_MACD_Col.mq4 file.


Ok - so I've Saved the file - how do I find it in MT4?

If you have MT4 already open, you will need to close it and restart it.

When restarted you should see the indicator listed under the Custom Indicators section of the Navigator Window. From there it's just a case of dragging and dropping it onto a chart.

Expert Advisors will appear under.... Expert Advisors

Scripts will appear under Scripts


Possible Problems #@!!$%!!!

Sorry - sometimes things just don't work as you expect. Possible problems are...

I'm seeing weird characters on the screen (or - I can see the code of the indicator). You most likely left clicked instead of right clicked on the file. go back one page on your browser and try again.

I can't save the file due to some permission restriction. Most likely you have Windows User Access Control (UAC) turned on or are using a machine where you do not have administrator priviliges. If you get this - put a post in the forum and myself or some other bee will help.

I can't see the (EA/Indicator/Script) - be careful where you save the file. Most likely you've put it in the Experts directory.

Any other problems - put a post in the forum.


Hope this helps - David

dcm_MACD_Col.ex45.02 KB
dcm_MACD_Col.mq44.06 KB
Mon, 04/09/2012 - 5:39pm
matt lydon

Great Job! I've printed it & it's part of my core reference material. Thanks ever so much.
If you listen very carefully, you'll hear the appreciative applause from we non-cybernauts among the hive members.


Thanks Matt, you're welcome.


Modified version of the Zig Zag with visible parameters and options to allow alerts on 3 levels of pivots.

Let me know if there are errors... or fix them your self with the great knowledge passed on in the webinar of April 12th :-)

3_Level_ZZ_Alerts.ex4 9.8 KB
3_Level_ZZ_Alerts.mq4 8.96 KB

I tried downloading the 3_level_zz_alerts.ex4 and .mq4. The first downloaded ok the second only option is save to downloads and it saves aas a .txt file. Is this compatible with MT4? I have only used mq4 for other applications or indicators. PLease advise.


Chad corrected and provided the universal pivots

Universal Pivot_1.mq4 10.9 KB

Larry, The download procedure is detailed in the first post under the paragraph
"So - I've got these file things, where do I put them?"

Using this method you have control where you can save the file. The default location may well be (but not certain to be) your "download" directory.

If the file somehow gets changed to a ".txt" file, then rename the file so it removes the ".txt" and ensure it ends with .mq4".


MaxNonLag - Hull Moving Average based in radians

MAXNonLagMA.mq4 6.95 KB
MAXNonLagMA.ex4 7.95 KB

an indicator -- OSCAR - used by London Open Session Traders

description - works like a stochastic oscillator and corrected for recent values

external parameters
lookback set to 8
moving average set to 5 (linear weighted MA)

two buffers hold maximum and minimum values in look-back. Using Data view you can evaluate those extremes.


Thanks for all the wonderful work being done here. I started watching Oscar. When I change the color settings,or line style, it resets to default when I look at a different time frame. However, if I change my input settings, those changes remain. Any suggestions on how I can keep my color selection settings?

Matthew Smith

Rexras - in the navigator, right click "modify" and it will open the meta editor. If you scroll down you will see the settings for colors and line styles. Change them to your liking and then click the "compile" button. Restart your MT4 and your settings should work correctly.


rexras - Try this version.

John - for reference I commented out the following lines.
Starting at line 41
// SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2, indicator_color1);
SetIndexBuffer(0, Buffer1);
// SetIndexStyle(1, DRAW_LINE, STYLE_DOT, 0, indicator_color2);
SetIndexBuffer(1, Buffer2);

Oscar.mq4 2.61 KB
Oscar.ex4 3.43 KB

Matt - that is one way, but the change I made allows the settings to be made via the indicators properties window without having to recompile the code.


Thanks very much guys. I'll try to fix it now. I'm grateful!


I am still in need of help please. The only Oscar.mq4 file I can fine in my MetaEditor is a text file. I did successfully download the above Oscar.ex4 file, along with the above mq4 file in my indicators file, but I don't seem to have the actual code file,only a text file of the code. Thanks again for the help.


The way to download the files is detailed above under my sub heading of
"So - I've got these file things, where do I put them?"

To summarise, RIGHT click on each file and choose the "Save As Link" (or similar - see above) and navigate to the "indicator" subdirectory.

Also check the section "Possible Problems #@!!$%!!!" above.

Also, check the post I made 9 posts above this.

Matthew Smith

Good work Pops! Looks like i've been doing it the hard way :)


I added label information to the code so that the data window makes some sense.
I also commented out some useless pieces of the code that are not needed, or do not make sense (why do you need a "checksum" in the label name?)

Oscar.ex4 3.02 KB
Oscar.mq4 2.77 KB

Thank you for cleaning up my mess. Iremoved the links to the errant code above to preclude its circulation.

Checksum back then was a method to track change via a VCS and is no longer needed.


VCS? Sorry I don't know that one.


Version Control System I would guess.


That was my guess, but I wanted to be sure.


How do I input the Oscar indicator on the MT4 Platform because it not there?


hlynette3d - Start with the first post in this thread.

For it to appear in the MT4 Custom Indicator folder you first have to download it from the link above (either mine or for a "tidy code" version use Chad's).

If you can't see it then you've either downloaded to the wrong place or not downloaded at all.


the sessions indicator placed on the Hour bar will allow at a glance view of high and low of each session.

Sessions.ex4 5.87 KB
Sessions.mq4 3.32 KB

Just re-posting John's "Testrun" EA so it doesn't get lost.
Useful for trying things out at the weekend when there's no live feed.

testrun.ex4 3.23 KB
testrun.mq4 2.19 KB

Stochastic Momentum index -- use with OSCAR and Max Non Lag on M15 for 30-40 pip scalps

SMI.mq4 3.18 KB
SMI.ex4 4.14 KB

The attached indicator is the Vegas Tunnel referred to simply as "tunnel."

tunnel.mq4 1.47 KB
tunnel.ex4 2.21 KB

I am looking for an EA or script, that when applied to the chart it shows the various world sessions in different colours on the chart & also shows the overlapping times as well. A few years ago I was with Forex Joe & they used charts like that. Do we have them?


Hi Kimberley, I Googled "MT4 World Sessions" and found quite a few possible links.
This one might work for you.
(Note - I did not write this).

Sessions_2.ex4 8.52 KB
Sessions_2.mq4 7.81 KB

Is there a recording on the use of the SMI,Oscar, and Max Non lag for scalping on M15? Thanks


Here's a little indicator that might help keep you out of trouble with the disabling mechanism.

I trade on 3 different machines depending on where I am but I've noticed that the automatic disabling mechanism sometimes fails to kick in on some of my machines.
Now I realsise that this should not be relied on to keep you out of failed trades and that you should accept responsibility of your trades, but I though it would be good to have a "pre-warning" mechanism that is controlled at your end of the trade.

The attached indicator allows you to set the percentage of your equity that you are willing to be put at risk.

So, if the disabling mechansim shuts down your account at a 5% loss, you may wish to set this indicator to alert you when you reach 3.5% - before you get disabled.

The alert can be set to trigger once per bar or every tick - very annoying (which is the point of the indicator really - to annoy you into doing what's right and exiting the trade!)

The indicator "should" store the start of day balance so that it calculates from a fixed daily amount (may need a bit more testing but I think it works as planned).

To use it, place the indicator on a single chart of any currency pair, preferably 1 minute period.

dcm_EquityWarning.ex4 3.2 KB
dcm_EquityWarning.mq4 2.89 KB

Not too bad - had to amend the hours a little to be right for the moment & the colours & it is missing Australia! So not sure how to add another session at all.


If you want to be really picky it's technically missing more than just Australia.
Try this version. I've just spent a few hours rewriting it and sorting out some bugs in it as well.

You can now choose to show the following.

The times are based on GMT so should be aligned with Divisa. You may wish to adjust the times to merge some of the zones (e.g. Asia could be Tokyo start and Singapore end).
Can't do much with the colours as they are going to be specific to your chart background colour.

FX_Sessions.ex4 13.9 KB
FX_Sessions.mq4 7.7 KB

Thanks, can you only get the prices to show for the most recent 24 hr period? With the colours, on the indicator they are input as numbers but when I change them they just choose the name of the colour? Is that normal? Also the Australian session whilst it starts at 22:00 it continues for along time till the following day at 7am so there are two Australian sessions lapping over! I have attached the screen shots - Australia in blue in the first shot & no Australia in the second shot? So was something in the programming not quite right? Problem attaching file so will try again.


ok this time - my default is docx not doc.

AussieBlue.doc 495 KB

Hi Kimberley,
sorry about that, thought I'd resolved the issue with periods that cross midnight (e.g. from 22:00 to 07:00) but which thought they were the same day.
This also led to problems at weekends as well.

Both "appear" to be fixed but as the market isn't open yet there may be an unknown issue yet to be found.

I've added price display for all the displayed periods.

Re the colours, that is normal. There are 256 shades each of red, blue and green which gives 16.7 million colours. Not all of them have names. If you use yellow (R=255,G=255,B=0) and change the blue component by 1 it will show as 255,255,1. As the colours are customised colours they are seen as numbers not names.

EDIT - updated after the Sunday open.

FX_Sessions.ex4 15.7 KB
FX_Sessions.mq4 8.23 KB

Thanks David.


Hi David,

Thanks for all your above posts, they really are helpful.
Is there a way to create a mq4 file when you have the ex4 file?
Hope you are keeping well.
Many thanks


Hi David,

Thanks for all your above posts, they really are helpful.
Is there a way to create a mq4 file when you have the ex4 file?
Hope you are keeping well.
Many thanks


Hi Christine,

There is a piece of software knocking about that can convert ex4 files back to mq4 although technically it's a bit of a grey area legally.

I can convert some files although, some fail part way. I believe John also said somewhere he has this ability.

Post the ex4 and we'll see what can be done.


Thanks David.
Here is the file

IBFX - Waves.ex4 31.61 KB

Try this.

IBFX - Waves~.mq4 32.68 KB

Thanks David.
It seems to be working. The only thing is that a pop up window appears with a message alert constantly ringing with the mention 'for IBFX users'.
Is there a licence issue? Or would we have to go through Divisa to get that done for us....???


hmm - you said convert it - not hack it :-)

Leave it with me and I'll have a look.


That didn't take long...

IBFX - Waves~.mq4 32.68 KB

Thanks so much David.
This one seems to be working perfectly. Not sure if it is accurate. But it does seem to follow and number the pivots at the top of the zig zag lines.
Exactly what I needed to confirm my doubts on the wave count.

It will be much easier from now.......

To Everyone, the above file is the Elliot wave count indicator.
Enjoy it!


Just bumping as the LOST indicators are in this thread


Hi. I read a newsletter today that extolled the value of the "Hull Moving average". He said that it's found in some platforms, including MT4. However, it's not in the Divisa MT4. Has anyone seen it elsewhere? I would like to transfer it into my Divisa MT4. --- Rich


I created a version that can be found here

It can display two lines at once or just one by changing the "Dual_Lines" parameter.

Alternatively, further up in this post is the MAXNonLagMA which is a variation.


My computer doesn't recognize the file type "ex4". Do you have an easy fix for that? ---- Rich


What are you trying to do?
There's no reason your computer should recognise ex4. It's a compiled piece of code and is of no relelvance to any normal Windows program other than Metatrader4, and within the correct MT4 directory it will be recognised and work.

If you have left clicked on an ex4 file then you need to start at the top of this thread and specifically read the section "So - I've got these file things, where do I put them?"


I click on your link. MaxNonLagMA(3).ex4 appears at the bottom of my window. I click on it and a pop up window appears: "Windows does not recognize this file type, which program do you want to use to open it?


Rich, that's not really telling me what you're doing.

But the fact it has (3) at the end implies you've tried this 3 times.

The details of how to save this to the correct location are detailed above.

At the risk of repeat however...

1. RIGHT CLICK on the MaxNonLagMA.ex4 file and choose "Save Link As" if on FireFox or "Save Target As" if on Internet Explorer.

2. Review the picture below. At the top you should navigate to where the indicators should be save to. The file name and file type are at the bottom. The file type is of no concern and should be left as is - MT4 knows what an .ex4 is and that's all that matters.

3. LEFT CLICK on the Save button.

4. Job done. Launch MT4 and find the MaxNonLagMa under Custom Indicators.


Thank you. I'm not the brightest bulb in the box. ---- Rich


this question is for prodigalops

how to ask that ????



we all know the platform meta trader use with the apiary account give us a penality if we lose too much money on a single trade or a combination of trade

this allows us to get out the house think things through and restart later with a fresh start

now trading with apiary funds give us only a % of the profit we made


could you make a script that would do the samething when i trade my own money with another mt4 platform ?

and also i could choose the pourcentage i willing to lose in a single day


i know a stop lost does roughly the samething but it does not have the same impact for someone like me who does not know just when to quit



There's an indicator I wrote further up this thread - dcm_EquityWarning.

Have a look at that and see if it fit's your needs.


How does one set two moving averages (simple)?


In the Navigator window, open up the Indicators folder and drag and drop the Moving Average indicator onto your chart.

In the parameter window that displays set the required period and choose Simple from the drop down options for the MA method.

You may also want to have it calculated on a price other than the close.

Do all the above again for the second moving average (but change the period and colour of course)


hé hé hé hé !!!!!!

prodigalpops !!!

what is this new anoing sound that comes out metatrader 4 when you lose 12 pips on a trade ???????

and how do you get rid of it ??????? and dont tell me close the position please !!

and my 2 cents this anoing bib would be alot more usefull to me when the proform pivot reach a new high or a new low



Here's and advert from my sponsor :-)

Getting odd noises from your machine from the "dcm_EquityWarning"?
Wondering how to silence them?

Then you need new "Semilot"!
Currently using 2 lots - "Semilot" it to 1 lot
Currently using 1 lot - "Semilot" it to 0.5 lot

"Semilot" - the new way to remove those annoying bells from MT4.

And there's more!!!

Do you need help in working out the correct lot size for your risk?

Then you need new "MultiTarget" - check it out here.

And don't miss the fantastic ring-a-ding-ding "3_Level_ZZ_Alerts" pivots. indcator! Find it on this page (post #3).

Don't delay - get them today!!!

(Any resemblance to an existing product is purely coincidental)



ok the sound finally shut up after a good 30 minutes i am more calm now

sorry i did not understand much of what i am suppose to do

but here what i am thinking to do

i did identify that sound with win amps it is call alert2

what if i was to delete it ????

i suspect the mt4 plaform would want to send the sound but since the file would be deleted it will send me a error message in a window

and this i can live with a visual warning

if this can be done safely i will do that


"Semilot" - the new way to remove those annoying bells from MT4.

are you telling me all mt4 plaform have that annoing bong sound ??????

i though it was only from aipary


now let go back to your solution

i am using 1 full lot with a nearly 20,000.00 usd virtual account
before i was using 2 lot and i was geting too many time into trouble waters

i am still getting in trouble waters with 1 lot but rarely
but the profit generated justify the few times i get in trouble

now if i use 2 manual trade of .5 lot roughly at the same entry point will that at least delay the alarm ?

if this does about the same thing as your script i will do that instead

that is a solution that i can understand easy with no need of a phd in networking combine with a master degre in computer and a bac in programming language

thank you for your very quick response


Firstly "Semilot" is my idea of humour, but the principle is valid. If you are breaching your loss limits you are trading a lot size that is too large for your risk.

BUT - I need to know something here.

1. Were you using my script (dcm_EquityWarning) when you were getting the annoying alert sounds?
2. If not then have you recently applied an update to your MT4 from Apiary?

If 1. is true, then that's the whole point of the script. The parameters of the script are set to the equity percentage that (if lost) will trigger the alert. The alert should sound onece per bar. It will not stop unless you exit the trade or remove the indicator (which would rather obviate the point of the indicator!).
My script works on the total loss - not any individial trade so it would not matter if you had 1 lot or 2 0.5 lots.

If 2. - then I have no idea. Perhaps it's another undocumented feature released by Apiary. They seem to riding roughshod at the moment and it seems to be annoying a fair few people.
Deleting the wave file is likley to cause more trouble than not losing more than the proscribed equity percentage.


no yesterday i downoaled the new updated version of mt4 for the apiary acount the update window appear yesterday on my desktop

i did dowloaded it

now i have a live acount with another mt4 platform with i use to trade my personal money with another broker

that plaform did not ask me to upgrade


now with the video teaching they told us never lose more than 2 % of the acount in a single day

exerience with aipary fund let me experience the very hard way how they deal with a person that breach that rule

in the first month my account was disable about 15 times in the first month o trading alone

the second month was little better

but it would appear that in quebec (canada) we are not using the same formula to count pourcentage

2 % of 20,000.00 usd = $400.00 in quebec when i went to school sure i am speaking about a time that the less than 40 years old could not possibly known

but that sound started beeping when i was losing about 120.00 usd far from the 2 % being preach to us newbie

if this can not be fix in any other way then shut off the speaker from my computer i will have to say good bye

and apiary can call me when a solution can be found

011 450 750 2535

after all apiary does not have monopoly on the mt4 platform




I fully sympathise with your dilemma.
I agree - 2% of 20000 is not 120 (it's 0.6%).

Is this happening with both of your MT4 platforms or just the Apiary platform?

I imagine that what is happening is that this is intended to be a warning that triggers when approaching the loss limit - although it seems to be set rather low.

As I have yet to see this (infamous) upgrade I cannot comment on what is actually happening.

I would suggest that you do a fresh download of the Apiary software from and avoid any updates until Apiary can report that all such issues have been resolved.


Prodigalpops on curenex dom on 10000$ account net profit was Pips. I have now a prefunded account 2500$ and net profit is in $. I want to change net profit on Pips. Thank you.


Sorry Tim,
I don't know how this could have changed. The DoM is not an Apiary script - it's provided by Divisa.
It should behave no differently just becasue the amount in your account has changed,
The only place I know of where the net profit display can be changed is in the usual Trade tab where it is a right click menu option, but this does not affect the DoM.
Mine still shows in pips as per picture attached,


Seems the indicator I referenced in the first post has gone missing - and as I can't seem to edit that post or this topic, here it is again.

dcm_MACD_Col.ex4 5.02 KB
dcm_MACD_Col.mq4 4.06 KB

Hello. I just have a quick question for Prodigalpops. By the way, thanks for the tremendous things you do for the web site and traders. I need whatever help I can get!

I downloaded a .Mq4 file for an indicator from the web and there was no .Ex4 file. How can I get the .EX4 file from the .Mq4 file? How would I compile the .Mq4 file to get the .Ex4 file for MT4 to use?

I have the web site address if you want. It has 12 pages of .Mq4 files for different indicators you can download. I found one I liked and downloaded it, but don't know how to compile it to make a .Ex4 file for MT4 to use.

Let me know what you find out and I'll give you the web address. Thanks again.


Hi tored07,

Firstly, you need to check that you have installed the MQ4 file into the correct subdirectory (/experts/indicators) and that you can see it listed in the Custom Indicators folder of the Navigator (all this is at the top of this thread and I'm sure you've already done this).
As an example I have deleted the EX4 for one of my test indicators (dcm_Volatility), but I can still see the Indicator listed as the picture shows. This is the MQ4 file that is visible and nothing will happen if I drag it on to a chart.
Next select the file and press the "Enter" key. This will launch the MetaEditor. You should see something like the next picture. If it looks wildly different, look at the "BUT" comment below.
Click the Compile button (or press F7) and check the bottom window which should say there ae 0 errors and 0 warnings. (You can have warnings, but there must not be any errors).
Close the Editor and return to MT4. You should now be able to drag and drop the indicator onto a chart.
Job Done.
BUT... There is a possbility that the file downloaded incorrectly. Most often this means the file downloaded as HTML and you'll likely see many lines starting with "


Thanks so much for your help. I downloaded the file just like you said into the ...../experts/indicators folder, as an Mq4 file, and then booted MT4 up and found the indicator, I just downloaded, in the list of Custom Indicators, in MT4, and did everything you said to compile the file.

After that, I closed out MetaEditor and then went to the indicator in the list, in MT4, and dragged and dropped it onto a chart and it works fine except there's only one color, that you can choose whatever color you want, for the whole indicator. That's why I downloaded it in the first place was the 2 colors on the indicator showing on the web that I thought was going to be in the one I downloaded and installed in MT4. The colors on the web for the indicator showed Grreen was above the 0 line and Red was below the zero line. After I downloaded it and compiled it, there's just one color field to select a color from, instead of 2, in the Properties pop up window. I checked the folder where I downloaded and then compiled the file and the file shows 2 files as Mq4 & Ex4, like normal. Any suggestions as to what could be wrong, why it's not showing the 2 colors?

Here's the web address of the site where I downloaded the indicator from - . There's 12 pages with 30 indicators listed per page, so be prepared to sit for awhile if you go through the pages! They're all Mq4 files and it seems like they should work after you download and then compile the file.

Thanks again and looking forward to hearing from you.


You don't say which one you downloaded and I am not going to wade through them all.
You could check the "Colors" tab of the indicator's properties, this might control other colours that are displayed.
Or post the indicator here and I'll have a look.


OK, I'm sorry, it's the OsMA indicator that I downloaded. Attached is the Mq4 file I downloaded. I tried to change the color on the indicator's properties tab, but the indicator just stays whatever color you select. I thought maybe if I change it to different colors and see, but it just stays that one color I select.

Let me know what you find out. Thanks again for all your help.

OsMA.mq4 2.51 KB

tored07 - you might want to look at my dcm_MACD_Col indicator which is above your first post about this problem.
With other trading platforms, their MACD indicators display the histogram as the difference between the MACD line and Signal line. MT4 does not do this and the MACD histogram is the MACD itself.
However, the OsMA indicator is effectively the MACD and signal line difference.
My indicator above allows you to show both "versions" as well as some colour alternatives. The only real difference 9in order to keep my MT4 and Tradestation MACD's in line, is that the signal line for both is calculates using an Exponential moving average (OsMA uses Simple). This equates to a minor difference.
BTW - the indicator you've attached is the MT4 OsMA, so if you really did download this from the website you posted, it is no different to the one that comes with MT4 and this only has the one colour.


Thanks again. I'm so sorry for your troubles. I looked in the .../experts/indicator folder on my hard drive and I looked and a Mq4 file shows, on my hard drive, the same name as the web file - which is - +OsMA Color 1S.mq4 and it also shows an Ex4 file with the same name also, on my hard drive. I must have compiled it and didn't know or remember it. I then opened up MT4 and looked in the Custom Indicator list and lo and behold it was there. I must have overlooked it or not seen it or whatever before. I dragged and dropped it onto my chart and presto, it works, just like on the web. You can pick the color and line size and style on 2 fields above the zero line and 2 fields below it. I don't know what I did before, whining about the colors on a default OsMA indicator and didn't even know it was a default OsMA. I must be working too hard or something! Sorry again for your hassle!

I saw in your post above about your MACD, how exactly does your MACD indicator differ from MT4's default and MT4's default OsMA? Does it show both indicators on one indicator?

Thanks again so much for your help.


Compare the attached pictures...
One compares the default MACD provided by Tradestation with my coloured version of MACD. The lines and histogram are the same, the colours obviously not.
The other compares the default MACD and OsMA from MT4 with my version of MACD. My version can create both of MT4's default indicators.
The bottom indicator is the equivalent of the Tradestation MT4 (which in most other trading platforms is also what you would see).
The blue line on the bottom indicator is the same as the histogram in the MT4 MACD indicator. The yellow line in my charts is the equivalent of the red line in the MT4 MACD indicator.

tsMACDcompare.PNG mt4MACDcompare.PNG

That looks nice. The dcm-MACD indicator sure has quite a few colors on it but also looks like it can do a few things. I'm trying to keep my charts simple and easy to read while being able to see divergence at the same time. It's hard, but so far, I think I have what I need. Now I just have to keep plugging and translate that into reality. Thanks again so much for your help. It does make a difference!

By the way, how do you separate your lines in the post, to make a new paragraph? I do that when I type in what to post and then when I hit the Save button to post it, it all jumbles together when it posts on the web site. Is there a way to do it so your paragraphs are separated by a blank space?

Thanks again for your help and see you around the sight.


I just use a period ".", but any small character would work.
It's a real pain that basic formatting has been removed.


Bungee / Stack as described by Neil Bradford of FXTradersedge and John Thomas

stack.mq4 2.73 KB
stack.ex4 2.67 KB

So that's why there's no way to separate paragraphs when you post here on the web, no formatting. I'll remember that from now on. Thanks again for your help.


Here's an indicator that does its best at displaying Renko bricks on a normal candlestick chart. Review the comparison picture to see what it does.
As Renko bricks can be formed within a single candlestick I have implemented alternating colours.
You can show filled bricks if you wish, but it can hide the candlesticks a bit too much.

Edit - modified the code as brick generation in a single candle was failing. Also, the parameters have changed a little.

dcm_Renko_Boxes.ex4 6.05 KB
dcm_Renko_Boxes.mq4 5.68 KB

Hi everyone,

I need help for an Ichimoku cloud alert that alerts you every time a span crossover happen. (sound and text alert)
I will appreciate a lot your help.

Thank you



Which span and crossover of what?
There is Chinkou Span, Senkou Span A and Senkou Span B (and other excluded lines)

I presume you mean a Senkou Span A cross of Senkou Span B but to assume just makes an "ass" of "u" and "me" :-)

I'm out for most of the day so will look out for a directive later.


Hi Prodigalpops,

Idea was for an alert every time the cloud changes color, so is the crossover of Senkou Span A and Senkou Span B.

Thank you.


Guessed as much, try this.
Save the files into the "indicators" sub directory.

Ichimok_ooh!.ex4 6.52 KB
Ichimok_ooh!.mq4 5.51 KB

Thank you Prodigalpops.


where do i find the WMS Indicator?


And what exactly is the WMS indicator?

do you mean a WMA=Weighted Moving Average in which case just add a moving average and change the MA Method parameter to Linear Weighted.

cooper impress are so good here with what you do...Thanks David.


Hi guys,

Is anyone using this Gann indicator.
It looks good and gives more profitable trades than loosing ones.
I am using it on 15min chart Eurusd using 48 parameter. It needs good money management strategy too.

You can try it in other time frames and other pairs using other parameters.
Test it and share your thoughts and results.

Prodigalpops, this indicator gives sound alerts.
Can you please modify it in order to get e-mail alerts too.

Thank you and enjoy trading.

Gann2-1.ex4 4.18 KB

Ertim, if you have the source code (mq4) file it can be altered but I'm not going to touch an ex4 file.


No, I don't have the mq4 file David.


I've done some digging re the "Gann" indicator above.
I never like to use something unless I know what it's doing, just a "trust" thing with me really.

From what I can tell, this is nothing more than MA cross variation. It seems to be a 48 SMA High Shift of 1 and a 48 SMA Low Shift of 1.
The dots switch when the price has closed outside of the dots e.g. if price close below the blue dots the red dots appear. The next switch would then need to be above the red dots.

Not a particularly difficult indicator to duplicate with MA's (try overlaying them on the Gann indicator and see how they match the dots).


hi David,

I tried to use an EA on my MT4 platform but is not working.
I drag it on a chart and the smiley face appears in the corner but the EA doesn't open any trade.
Is there anything I am missing?


Have you tried running it through the Strategy Tester to see if it it will enter any trades (all you can currently do as the market is shut at the moment of course).
Other than that, check the parameters. most likely they are set so that they currently preclude trade entry.
e.g. a lot size of 0 wouldn't work too well.

If this is one of those EA's that promises to double your account every month or the like, it could well be a scam.

Post it here if you like and I'll see if there's anything obvious.


Please see the EA attached.
I am not sure if I am doing the right config. on the platform. (Tools---Options---EA)
Can you please send a screen shot with the right config.

Thank you.

forex_swissbot.ex4 17.89 KB


I've had a look at the requirements for this.

Internally it uses the following indicators...
- Gann2-1
- THV3 Trix v4.01 Div

Of these only the Gann2-1 indicator is provided as part of the download. Consequently I tested it as provided.

Judging by the code it is using Gann on a daily time frame and referencing a moving average cross of smoothed moving averages of the EURUSD on the 1 hour chart. It does not take large numbers of trades so probably why you're not seeing any.

I've run it through the Strategy Tester with the default settings and attempted to derive similar results as per the website for the 15m EURUSD. I've looked at results from 1st August 2010 to 25th August 2011 and from 1st August 2011 to 24th August 2012. Details are attached.

My view... I've just spent an hour reviewing this and to be honest it would have been better spent reading a trading book or reviewing some of the recorded discussions.

There's generally a reason something is free, and I think this typifies that thinking. It "may" have worked at some time in the past, but when those webpage screen shots were taken are not shown.
The results from the back tests, although never a 100% reliable method, are all we have to go on unless you fancy running this for a month or two against another demo account. They are not particulalry good.

You could probably spend time trying out different parameters but life is too short. If a strategy is worth that sort of effort it has to provide better initial results than those currently being seen.

Delete it from your machine.
If you really are convinved the Gann2-1 indicator is worth some time, work out your own strategy around it; you will understand it better and the process of thinking through how it works will make you a better trader.

StrategyTester-swissbot.xls 66.5 KB

Is there any indicator (alert) for MA crossover with the shift option.
Also I need to know if there is any way to see the value of the MAs in the background. All I see is pair, time frame and values of the current candle.

Thank you


Wonderful thing Google...
I've attached a version that allows the shift to be set as well.

This will show arrows where the MA's you choose cross. To see the MA's put them on separately.
To see the values use Ctrl-D to show the data window

Edit - Removed attachments as available lower down


Hi David,

Thank you for your fast reply.
I tried to google for this alert in some websites but I didn't find a good one.
Even with this one I have a problem. When I try (-1) shift in one of the MAs I get arrows in every candle.
Is it a code problem or I am doing something wrong.

thank you


If I have time I'll have a look.

What parameters are you setting so I have something to refer to. Also, post a screen shot of what you see so I know I'm seeing the same effect.

Revised version attached. The shift wasn't affecting the slow period correctly, and only partially adjusting the short period.

MA Crossover Alert.ex4 10.22 KB
MA Crossover Alert.mq4 8.29 KB

It is the same MA 34 but the shifts are +-3.
It gives an arrow and alert for every candle. (ex. 15 red arrows and when the direction change 13 green arrows.)
I will post a screen shot when I will be home.

Thank you


Try the new version first. see screen shot.
34 EMA +3 and 34 EMA -3


Hi David,

Yes the new version is ok, but I will need Simple MA not EMA.
At first I thought it was indicator problem than I realized that I had SMA-s in the chart and indicator was based on EMA-s.
Can you modify the MA crossover indicator?

Thank you very much for your help.


You can change the FastMA_Mode and SlowMA_Mode parameters to 0 and this gives the SMA


You can modify the code in the MQ4 file so it's as below
extern int FastMA_Mode = 0; //0=sma, 1=ema, 2=smma, 3=lwma, 4=lsma
extern int FastMA_Period = 5;
extern int FastPriceMode = 0;//0=close, 1=open, 2=high, 3=low, 4=median(high+low)/2, 5=typical(high+low+close)/3, 6=weighted(high+low+close+close)/4
extern int FastShift=0;
extern int SlowMA_Mode = 0; //0=sma, 1=ema, 2=smma, 3=lwma, 4=lsma
extern int SlowMA_Period = 20;
extern int SlowPriceMode = 0;//0=close, 1=open, 2=high, 3=low, 4=median(high+low)/2, 5=typical(high+low+close)/3, 6=weighted(high+low+close+close)/4
extern int SlowShift=0;


Download the following

MA Crossover Alert.ex4 10.22 KB
MA Crossover Alert.mq4 8.29 KB

Thank you David,

Appreciate your help.
I changed MA mode to 0 and now the signal looks ok but it is giving arrows on every candle again.
Even the updated MA crossover gives arrows on every candle.

I would like to learn how to modify the code, but I have no idea how to do it now.

Thanks again for your help


Hi Ertim,
See you what you mean about posting every bar. I ran it in the Strategy Tester.
I'll look into a fix for it when I have time, probably later today.
Whoever wrote this originally did not do a good job.


Hi Ertim,

I hate fixing other peoples code - there's always too much "baggage", so here's my version which should work for you.

MACross.ex4 6.76 KB
MACross.mq4 4.95 KB


Thank you very much for your excellent work.


No problem, I'll send you the bill in due course :-)


Here's an indicator for Floor Trader Pivots.
(I just amended it to add the first two midlines)

Floor_Pivots_Daily.ex4 6.61 KB
Floor_Pivots_Daily.mq4 6.29 KB

Hi David,

The MACross indicator give the signal after two candles and the shift that I use is -1 and 2. Shouldn't it give the signal after 1 candle.
Also will it be possible to specify the currency on the alert window.

thank you



See attached picture.

The crossover isn't confirmed until the close of the candle indicated. Because of the negative shift, the current candle has no knowledge of one of the moving averages so you will always be late in getting the signal as the only data to compare against the two moving averages will be one bar before the current forming candle.
I think your chasing ghosts trying to use this as a signal.

Anyway - modified version that shows the pair more clearly (the old version did but not in the rows, only the heading).

MACross.ex4 6.69 KB
MACross.mq4 4.97 KB

I am a newbie and deleted all the instructors default chart settings. How can i get them back.


If you mean you deleted all the templates, then your best option is to reinstall the software from here



Does anyone have a MACD histogram alert, that alerts on every candle close.(0 line cross, signal line cross, histogram bars going up or down)
I want to use it with renko bars and need an alert every time this bars will be closed.

Thank you.


Hey everyone, just a heads up - there is a new version of apiary metatrader rolling out soon. v2.0.7 with new RENKO ea, HMA indicator, undock chart feature, and several bug fixes.

Thanks Everyone!


Hi David,

I tried to use this MACD EA in offline charts but it is not working.
EAs don't work on offline charts or is something wrong with this EA.
I have used it before ,but not in offline charts.

Thank you

macd_ea.mq4 5.81 KB

Offline charts don't receive tick data unless there is some form of program that is creating the offline chart (e.g. as is done for Renko charts).


I was trying to use it with Renko charts but it didn't work with them.


Can't think why it would not work. Are you sure that..
1. The online 1 minute "feeder" chart that runs the Renko EA is still active (i.e. has not been closed)
2. Expert Advisors are enabled.


Yes David, the online 1 min feeder is running and EAs are enabled.(Enable EAs, Allow live trading, Allow DLL imports, Allow external expert imports)
I have that smiley face in the chart and don't know why is smiling when not working.


Ok, found your problem... probably.

The EA requires 100 bars. If you look on the Experts Tab I suspect you'll see a message something like macd_ea EURUSD,M3: bars less than 100.

You have two options if this is the case.
1. Ensure you have more historic data on the 1 minute chart to fill 100 bars.
2. Change line 31 so it says something less than 100 e.g. "if ( Bars < 10 )"

If it's not this then no idea.


Hello, has anyone else had trouble with the MT4 service feed speed? I am only getting between 0 and 2kb from the MT4 server. My charts freeze up and/or it is very slow. I am having trouble getting in and out of trades because of this. This problem did not begin until about 2 weeks ago. Up to that point I had not had any issues. I downloaded the updates, but that did not help either. I have checked all of my computer settings and security settings. My internet connection is really good and computer speed with other programs is fine. Any ideas on how to fix?


How many charts do you have on your MT4 desktop and how many indicators?
You could try creating a new profile with a single empty chart (i.e. price only, no indicators) and see if that shows a difference.


There were only 6 charts, 2 of which were Renko charts. I tried taking it down to just one chart and it still exhibited the same condition. I have a Macd, RSI and 3 MA's. Even when taking it to just the candles a with one chart and no indicators the feed is low. Thanks for your suggestions.

matt lydon

The dual profit target trade entry is giving me some difficulty.
I'm using the Multi target EA & related scripts you wrote. This appear to work fine BUT
a) when I attempt to enter a SECOND trade, same currency pair, the EA thinks I'm modifying the previous trade order & activates an annoying
error message, ( about incorrect SL) which I can only resolve by deleting the order(s).
my "work around" is to enter two distinct trades, the first with Profit Target 1, the second, with Profit target 2, other input data is duplicated.
b) when I need to make changes, using the right Click option I can modify the trades, but Can I CHANGE any trade from a "take profit @ x.xxxx"
to a buy or sell limit trade order @ x.xxxx ?
Or am I trying to do something with the wrong "tools" or am I making some procedural errors?
As always, your sage advice is greatly appreciated


Matt, I thought I answered most of these in my email. If you didn't get it let me know. Basically, it's multi target not multi trade.

matt lydon

Essentially, yes, you did I was hoping other Forum members/readers may have an alternative solution or a work around recommendation/solution.. What I didn't realize at the outset was that I do have a multi-trade requirement, i.e. more than one a day (could be as many as 10-15 trades) per day & often, the same pair but also, completely different pairs. The multiple profit targets are an intrinsic part of this strategy, as are modifications & adjustments to the profit targets.
ALL trades are STOP orders, all Profit targets trades are LIMIT orders. Scaling exits are the inherent part of this strategy that substantially affects the relative profitability.
I may need some sort of Trade Manager softare/app that "sits" on top of ,or on the side of MT4, that facilitates same.
In the meantime, I'll ugly my way through, but it is just that.... ugly. Grown men weeping & gnashing their teeth at their keyboard skills inadequacies.


Hi Prodigalpops,

Can you please help how can I install this indicator in MT4 platform. I need it for the email alerts but I found only this in forums.
It is not in .ex4 file and I can't install it to metatrader. Below is the link for it.

Thank you,




For future reference...
Click on the download button (see picture)

Choose to open the file in Notepad (use the Browase button to find the Notepad.exe application).

In Notepad, save the file with an appropraite name that ends with ".MQ4" into the Indicators directory of your MT4 install directory (or experts if it's an EA of course).

Then in MT4 - select the indicator, press Enter to launch the code editor, press F7 and then close the code editor - job done.

wAlert.ex4 10.64 KB
wAlert.mq4 13.55 KB

Thank you Prodigalpops.
Appreciate your help.

Matts Back

Need help coding an EA. I have 0 experience coding. I think I have found a technique to Identify good entries in a market using the MACD (with out signal line) and HMA possibly pivots. I have been back testing just buy manual analysis. I have found it to win 52% of the time with an average 3:1 pip gain, That was just checking over a one day period. I would like to test it over a longer period and then automate it. Any Help?


Thought this might be of use to some of you.

CloseALLnow!! is pretty self explanatory.

It's a script that will close ALL open or pending positions on ALL charts.

It's for those times when all it's all going wrong very rapidly and you just want to go home and cry :-)

It is best used with a Hot Key (e.g. "Alt Q") and it doesn't matter which chart you drop it on or have selected at the time you run it.
It will loop through all positions and make a close or delete request as appropriate.

CloseALLnow!!.ex4 1.68 KB
CloseALLnow!!.mq4 1.59 KB

Hi Everyone,
Does anyone know the reason why the plateform will freeze for 3 to 5 minutes when you switch from two demo accounts on the MT4.
After 5 minutes the freezed account gets released without any intervention. Just have to wait.
So If you want to backtest and trade at the same time, it is impossible due to the delay occurring while switching accounts.
Is there a solution to this?
Many Thanks


jEccouraging to see many helping each other!


Thanks Andrew for your post at the end of Jeff's session.
But i am not sure i have saved it in the right folder.
The folder i thought may be the correct one declined me the permission to save it. So I had to save it somewhere else.

Saving the EA from the start:
OS: (c)
program files (x86)
Apiary Fund Metatrader
The EA has been saved

And I have saved it everywhere I could. So I may have some interferences......
Lets wait and see! The fun part!!!!


Christine - not sure what you were trying to save there, but if it's an Expert Advisor it has to go in Experts as it will not work if you put it in the Scripts folder.
Scripts are for "one off" do something and complete actions (like closing a trade)
Experts are for actions that need to react to tick data (not necessarily but frequently for trade entry)
Indicators are pretty self explanatory.


Thanks David to come to my rescue.
I have attached a screenshot of the Expert Folder.
Where shall I save this EA?
Jeff gave us the script of an EA today, we will be working with in the next few days so I have to install it on the plateform.
There are two scripts as you know , mq4 and ex4.
Where shall I save them (see attachment)?

How to Save an EA.PNG

In that directory - Experts


Under what:
file or
include or
indicator or
library or
log or
presets or
samples or
script or
Or Shall I create 10th file ?


No, actually in the Experts directory.

i have my MT4 installed in a different location but that doesn't change that an Expert Advisor goes in the Experts subdirectory.

However... not sure how you took that screenshot, but you should see other EA's in there. Compare to mine...

It's all explained in the first post of this thread.
Search for "So - I've got these file things, where do I put them?"


Thanks David.
I have found the folder where to store the EA script.
But when saved they are not appearing on the correct format.
Both files mq4 and ex4 seem to be on a text document format and consequently do not appear on the plateform.
There are the two files in the middle of the screenshot called IBFX Stoch Crossover.
I will ask Jeff on Friday.
Thanks for your time.
Other bees might be in the same situation....

EA IBFX Stoc Crossover.PNG

Sounds like the files you have received or downloaded have been treated as text files (probably end with .txt.
As you don't show the actual file extensions (an option in your Windows folder setup) I cannot be 100% certain, but suspect however you got these files is the root cause of your problem.

Get Jeff to create a thread and attach them to a post - should solve a lot of unecessary headaches and probably should have been TESTED before throwing it out in the wild.

Neil G


I'm hoping that Prodigalpops [or someone else] can help me with an MT4 EA that I downloaded. What it is supposed to do is allow the user to change S/L and T/P for a trade by simply moving the horizontal lines it puts on top of the MT4 lines [S/L & T/P] and it will work for multiple trades.

Any assistance would be greatly appreciated.


OrderManager.mq4 6.64 KB

And what goes wrong with it?
I have very little spare time at present (a some of you may have noticed by my evident absence over the last month or so) so you'd be better off contacting the original author of this code.

Neil G

I will try and find the author but to answer your question. "Sad face" when "Expert Advisors" button is pushed. Although it does show lines for the current trades, nothing happens when you move them.

Thanks for taking a look.


Neil G

My mistake. Seems to work fine when I "Allow live trading".

Matts Back

anyone know of a simple drag drop alert for when a bud/ask line crosses a price?


You can just create an alert via the alerts tab to do that.

matt lydon

Thanks Prodigalpops /aka Dave, missed your omnipresence but knew it was because you're busy.