molanis.com/forum - Tools for MetaTrader : The place to ask about the best expert advisor builder, expert advisor downloads, and expert advisor programming

AFTER YOU REGISTER SEND US AN EMAIL TO ACTIVATE YOUR ACCOUNT - Before posting:-1- Please read the user guide -2- Try the examples -3- Search in the forum
It is currently Thu Mar 28, 2024 3:58 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 11 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Using / importing custom indicators into Strategy Builder
PostPosted: Fri Oct 29, 2010 9:36 am 
Offline

Joined: Tue Dec 22, 2009 12:22 am
Posts: 1761
To start please review this page first http://www.molanis.com/products/expert- ... esign-mql5 Even though is intended for our MT5 product, the importing process / windows / options are the same.

Have you seen our EA example pages at http://www.molanis.com/products/molanis ... rs-for-mt4?

Some MQL Review (to put things into context)

The idea of Molanis products is to avoid writing/learning MQL code. However, we explain a bit here to put things into context (and because some people like coding).

Custom Indicators must be located in the indicators directory (C:\Program Files\MetaTrader 4\experts\indicators for standard installations of MT4). When an EA is executed, it looks for the compiled indicators (.ex4 file) in the indicators directory. To move your EA to another computer or a vps, you need to copy the ea and all indicators.

If you look at the code of an EA you could find something like this:
iCustom("EURUSD", PERIOD_M1, "SampleMolanis",14,1,0)

iCustom is the MQL command that calls a custom indicator and return its value. Your job is to take that value and use it in a trading condition for example "RSI must be higher than 80".

MetaQuotes iCustom official documentation includes the following:

double iCustom( string symbol, int timeframe, string name, ..., int mode, int shift)
Calculates the specified custom indicator and returns its value. The custom indicator must be compiled (*.EX4 file) and be in the terminal_directory\experts\indicators directory.
Parameters:
symbol - Symbol the data of which should be used to calculate indicator. NULL means current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration <help://constants_timeframes> values. 0 means the current chart timeframe.
name - Custom indicator compiled program name.
... - Parameters set (if necessary). The passed parameters and their order must correspond with the declaration order and the type of extern variables of the custom indicator.
mode - Line index. Can be from 0 to 7 and must correspond with the index used by one of SetIndexBuffer <help://customind_SetIndexBuffer> functions.
shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).
Sample:
double val=iCustom(NULL, 0, "SampleInd",13,1,0);

Thus from iCustom("EURUSD", PERIOD_M1, "SampleMolanis",14,1,0) we can obtain:

Symbol="EURUSD"
Timeframe=PERIOD_M1
Name="SampleMolanis"
Parameters=14
Mode=1
Shift=0

Pay attention to the "..." option (Parameters). Custom indicators have parameters; probably you use them but are not aware. Widely used examples of parameters are the period for an MA and the K and D periods for stochastic. Parameters are all inputs that change the value of the indicators. Parameters are those variables that you play with to get the best set up for your custom indicator. In this case the only parameter is 14. For a second imagine another custom indicator with two parameters. It could be something like this:
iCustom("EURUSD", PERIOD_M1, "SecondSampleMolanis",8,1,1,0)
In that case
Parameters=8,1
The above is just to illustrate the case for indicators with more than 1 parameter. Let's go back to iCustom("EURUSD", PERIOD_M1, "SampleMolanis",14,1,0) and dig into some points.

Shift is which bar the calculation is being performed upon. Bars are numbered 0, 1, 2, 3, 4, 5, 6, 7... as you go back in time on the chart. Changing the shift option is similar to moving the indicator line into the future or the past.
If you want the value of the indicator but for the previous bar you use a shift of 1. To obtain the value for the current bar, 0 should be used. For example to get the direction of the trend you could use:
MA now shift=0 (current bar) > MA one bar ago shift=1 (previous bar)
If the above trading condition is true, it means trend is up!

In plain English, use:
shift = 0 to get the indicator's value of the current bar (still forming)
shift = 1 value on the previous bar
shift = 2 value in a bar before the previous bar

Mode is a line index that ranges from 0 to 7. MT4 allows up to 8 indicator lines (signals) per custom indicator. Mode is used to identify a specific line/signal of the available indicator lines (signals).
Visualize this: Your indicator has 8 lines/signals (or arrows) with different colors: Each line gives you an output; each line has a value. With mode you select the line (signal) that you need for your EA (just one out of eight). Most of the time, indicators have only one line/signal so mode=0 should be used.

The tricky part is this one: Because MT4's index goes from 0 to 7, mode takes values from 0 to 7.
So the first signal has a mode=0 (and not 1)

In plain English:
If your indicator has three indicator lines/signals and you want to get the value for the first line, you use mode=0, the value for the second line/signal is obtained with mode=1, and mode=2 will get the value for the third signal. (Later in this series we will explain how to identify the first, second, third... etc line)

To recap, iCustom("EURUSD", PERIOD_M1, "SampleMolanis",14,1,0) gives you:
-the indicator value of the custom indicator SampleMolanis (this means there is an indicator in the indicator directory called SampleMolanis.mq4 or SampleMolanis.ex4)
-with a period (Parameter) of 14
-for the pair EURUSD
- from a 1 minute chart (PERIOD_M1)
-value obtained from the second signal (mode=1)
-from the current bar (shift=0)

Do not worry, the Strategy Builder will help you to integrate custom indicators into your ea, just remember the reasons behind iCustom and the integration process.

Importing your custom indicator to Molanis Strategy Builder

You can add any well written custom indicator to you expert advisor with the Import Custom Indicator feature. Under a TA block, select Custom Indicator - iCustom.

To use the import feature you need the .mq4 file (indicators code). The import feature does not work on .ex4 files (compiled indicators).

The import custom indicator feature reads the indicator code and based on standard rules of coding gets the number of modes (signals) and the indicator parameters. This feature cannot select the mode or shift for you. It's your job to know the right signal and parameters for your EA

More on using custom indicators

How to find indicator inputs (MA example) viewtopic.php?f=3&t=14&start=0
and viewtopic.php?f=2&t=58&start=0&hilit=custom
MT4 indicators quick guide http://www.molanis.com/support/metatrad ... ence-guide
More about shift viewtopic.php?f=6&t=13&start=0&hilit=shift
Getting true or false from slope indicator viewtopic.php?f=3&t=109&start=0&hilit=custom+indicator
Signals from Fx_Fish indicator viewtopic.php?f=2&t=93&start=0&hilit=custom
Signals from lines than change colors viewtopic.php?f=11&t=92&start=0&hilit=custom
Signals from donchian indicator viewtopic.php?f=2&t=71&start=0&hilit=custom
Signals from asc trend 2 viewtopic.php?f=3&t=70&start=0&hilit=custom
Signals for tren indicator viewtopic.php?f=9&t=288&start=0
Signals for hull indicator viewtopic.php?f=6&t=326
Signals for another hull indicator viewtopic.php?f=6&t=330
Signals for MA cross viewtopic.php?f=2&t=341&start=0
Signals for MACD with color histogram viewtopic.php?f=3&t=353&p=1340&hilit=macd#p1340
Error when importing a custom indicator viewtopic.php?f=2&t=392
Signals for a trendline indicator viewtopic.php?f=2&t=996


Questions on custom indicators created with the technical indicator builder
viewtopic.php?f=9&t=96&hilit=custom
viewtopic.php?f=11&t=90&p=347&hilit=custom#p347
Technical indicator Builder Examples viewtopic.php?f=9&t=47&start=0&hilit=custom

Differences between the Pro and Standard version viewtopic.php?f=6&t=447&p=1648#p1648


Last edited by molanisfx on Tue Aug 16, 2011 1:36 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Using / importing custom indicators into Strategy Builder
PostPosted: Sun Aug 14, 2011 4:55 pm 
Offline

Joined: Sun Aug 14, 2011 4:50 pm
Posts: 1
I have recently installed Molanis on my computer using Windows 7. I had a problem with the security settings, but got that resolved. However, when I log into the Strategy Builder, to import a custom indicator, it is not showing up on the drop-down window. These indicators are indicators I have build and used with the Metatrader editor from my Metatrader system.

Does anyone know how to use indicators built from the Metatrader editor? I contacted Molanis, and their only advice was to post in the forum. GREAT CUSTOMER SERVICE, HUH?

Thanks in advance if you have solved this problem before.


Top
 Profile  
 
 Post subject: Re: Using / importing custom indicators into Strategy Builder
PostPosted: Sun Aug 14, 2011 7:50 pm 
Offline

Joined: Tue Dec 22, 2009 12:22 am
Posts: 1761
Thanks for posting your issue. ALL NON INSTALLATION / NON LICENSE RELATED ISSUES ARE HANDLED IN THE FORUMS NOT BY EMAIL. THIS IS WHY WE ENCOURAGE PEOPLE TO USE THE FORUMS.

All the links above are examples on how to import indicators. You can download and open those indicators with the MetaTrader editor.

Custom indicators in mt4 are under C:\Program Files\MetaTrader 4\experts\indicators (this is the default location - your broker can have a different location.) - there are two file types .mq4 or indicator's code and .ex4 or compiled indicator.
If you want to import indicators into the Strategy Builder, they must be located and compiled in C:\Program Files\MetaTrader 4\experts\indicators The import button in the TA icon looks for the indicator's code or .mq4 file, then it reads the code and gives you the import parameters (again, this is the default location - if you do not know which location/directory you are using check the MetaTrader Setup in the Strategy Builder). If you do not have the .mq4 file it won't show there.

You can still use indicators when you do not have the .mq4 file - it's more difficult because you need to know in advance the parameters and modes and have to enter them manually under Custom fields.


Top
 Profile  
 
 Post subject: Re: Using / importing custom indicators into Strategy Builder
PostPosted: Fri Aug 26, 2011 4:10 am 
Offline

Joined: Fri Aug 26, 2011 2:28 am
Posts: 4
Hi,

I have utilized the iCustom to import custom indicator.
Custom indicator already has email alerts and sound alert when indicator parameters are met.

Calling the custom indicator (buffers) doesn`t seem to work as such, no trades placed,
(backtested 30 days no orders, 90% modelling, no script errors/warnings in compiling),
my question would be more along the lines of, how to utilize whats already there?.

After import via iCustom, code to reflect on alert(audio/email buy/sell) execute buy/sell order

Or, on buy alert/email (close sell order if order exists) and execute buy order.
on sell alert/email (close buy order if order exists) and execute sell order.

Any assist muchly appreciated.

Thank you


Top
 Profile  
 
 Post subject: Re: Using / importing custom indicators into Strategy Builder
PostPosted: Fri Aug 26, 2011 8:07 am 
Offline

Joined: Tue Dec 22, 2009 12:22 am
Posts: 1761
In a new thread please post your strategy file .mol file and your custom indicator. We cannot tell you why is not working if we have not seen the indicator. What most people don't realize is that custom indicators can have several signals so you need to change the mode (from 0 to 7) to get the one you want.


Top
 Profile  
 
 Post subject: Re: Using / importing custom indicators into Strategy Builder
PostPosted: Thu May 08, 2014 9:48 am 
Offline

Joined: Thu Nov 14, 2013 12:25 am
Posts: 2
Hello
Can someone here help me?
Like the post above I have tried everything but can not get this custom indicator to trigger a trade. I have uploaded the indicators. They seem to work together.

FI


Attachments:
SBRX4T1.mq4 [1.4 KiB]
Downloaded 6281 times
SBSR1.mq4 [2.64 KiB]
Downloaded 6295 times
Top
 Profile  
 
 Post subject: Re: Using / importing custom indicators into Strategy Builder
PostPosted: Thu May 08, 2014 12:49 pm 
Offline
Site Admin

Joined: Fri Oct 16, 2009 3:40 pm
Posts: 451
start a new thread and attach the .mol file or strategy file and the indicators along with an explanation of the strategy. You have to tell us what signals do you want to use . i.e I want to buy when red line > 25 or something like that


Top
 Profile  
 
 Post subject: Re: Using / importing custom indicators into Strategy Builder
PostPosted: Thu May 08, 2014 1:11 pm 
Offline

Joined: Thu Nov 14, 2013 12:25 am
Posts: 2
admin wrote:
start a new thread and attach the .mol file or strategy file and the indicators along with an explanation of the strategy. You have to tell us what signals do you want to use . i.e I want to buy when red line > 25 or something like that


I don't know what the mol file is or where to get it as I am new to this. I would just like this indictaor to trigger when there is a new bow either red for sell and blue for buy.


Top
 Profile  
 
 Post subject: Re: Using / importing custom indicators into Strategy Builder
PostPosted: Fri May 09, 2014 1:04 pm 
Offline

Joined: Tue Dec 22, 2009 12:22 am
Posts: 1761
When you save files using the strategy builder it uses a .mol extension (like word use .doc, molanis uses .mol)
You need an strategy, you import the custom indicators into the strategy builder and use them
As I said, start a new thread. Post the strategy file, the indicators and a description of the ea. We cannot help if you do not do that. We did not create those indicators so we do not know how to use them - you need to tell us all signals and how the ea should work. Mind you most of the indicators are well written so they send signals to eas. Those you can import and use. The rest will not work unless you recode the indicator. This is due to bad programming practices or no need to communicate to eas - this is a desicion made by the author of the indicator.


Top
 Profile  
 
 Post subject: Re: Using / importing custom indicators into Strategy Builder
PostPosted: Thu May 29, 2014 3:13 pm 
Offline

Joined: Thu May 01, 2014 10:31 am
Posts: 10
custom indicator added help please.

mode 0 and mode 1

mode 0<mode1 buy. can not be


Attachments:
Balon.mq4 [6.72 KiB]
Downloaded 6007 times
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by Molanis © 2009