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

How to use MSB to recognize custom indicator true / false
http://www.molanis.com/forum/viewtopic.php?f=3&t=109
Page 1 of 1

Author:  Xaejtrader [ Tue Sep 07, 2010 3:44 pm ]
Post subject:  How to use MSB to recognize custom indicator true / false

Ok so lets say we have an indicator that outputs 2 variables which can be understood by MSB TA custom indicator import.

When loaded, it notifies you that there are 2 outputs. For examples sake lets say those outputs are 0 and 1:

double Buytrend[];
double Selltrend[];

SetIndexBuffer(0, Buytrend);
SetIndexBuffer(1, Selltrend);


ok so with that said, what can MSB do with this info in a TA block? Can conditionals be formed using the software and what would be the theory behind creating and EA based off these buffers?

Lets say our theoretical custom indicator is using arrows. An Up Arrow for the Buytrend and Down Arrow for Selltrend. So how would you use the MSB TA block to Buy on the Buytrend or Sell on the Selltrend? Will 0 = 0 work? Will 0 different 1 etc etc.

Author:  molanisfx [ Tue Sep 07, 2010 7:56 pm ]
Post subject:  Re: How to use MSB to recognize custom indicator true / false

The import feature in a TA gives you the parameters to use the custom indicator, something that follows this format:
"indicator name", value variable 1, value variable 2 ...
It tells you the number of modes (signals in the indicator). Then you can use the indicator to create trading conditions.
Whatever you use in the comparison depends on the indicator. There is no rule. It depends on the indicator and the signal, and in the indicator code.
Typically for an indicator with arrows: An arrow means signal, no arrow means no signal. For MT4 no signals means a huge number, so you can use a condition like indicator < 100 then .. which is equivalent to signal. But it really depends on the indicator. Some coder assign a value of 1 to signal and 0 to no signal, so you use if indicator = 1 then...
If you post your indicator here (.mq4 file), we may be able to help you to get the right signals.

Author:  Xaejtrader [ Tue Sep 07, 2010 10:19 pm ]
Post subject:  Re: How to use MSB to recognize custom indicator true / false

Thanks for the speedy response. This was all just theory as I have not entered the project yet and thus have no indy to post. I understand what you're saying though and this should turn out to be a good thread if others want to post their indy's and have further questions.


Edit: Ok I found a great one for an example. Theres already an EA for this but how would we use an indy like this in MSB? I tried a few ideas based on what you posted, however MSB doesn't seem to recognize the difference between > 0 =to 0 different than 0 etc. for any of the modes.

this indy is for educational purposes and posted on the http://codebase.mql4.com/source/6111

Attachments:
slope.mq4 [3.52 KiB]
Downloaded 801 times

Author:  molanisfx [ Wed Sep 08, 2010 9:54 am ]
Post subject:  Re: How to use MSB to recognize custom indicator true / false

First look at how the indicator paints, you see a line that changes color. In MT4 you do this using 2 lines, so one line is painted (signal) while the other one is not painted (no signal)
What we usually do is to print the signals value. In that indicator we added this:
Print( " utrend=",Uptrend[x], " dtrend=",Dntrend[x]);
Ans got this: - moment where the signals change
10:43:15 slope EURUSD,M1: utrend=2147483647 dtrend=1.2258
10:43:15 slope EURUSD,M1: utrend=1.2258 dtrend=2147483647

The big number is the way MT4 defines empty or no signal in this case. 2147483647 = EMPTY_VALUE or no signal
So utrend=2147483647 dtrend=1.2258 means there is a downtrend and
utrend=1.2258 dtrend=2147483647 means there is an uptrend.

The modes are defined by
SetIndexBuffer(0, Uptrend);
SetIndexBuffer(1, Dntrend);
Uptrend is mode 0, Dntrend is mode 1
Try creating a strategy and in a TA compare the signals. ind < 1000 means signal since ind is always around the price and when there is no signal it goes to 2147483647

Author:  Xaejtrader [ Thu Sep 09, 2010 12:35 am ]
Post subject:  Re: How to use MSB to recognize custom indicator true / false

Thanks much. Customer for life.

Author:  pipseer [ Mon May 02, 2011 11:34 am ]
Post subject:  Re: How to use MSB to recognize custom indicator true / false

New user, haven't even downloaded it yet, just checking to see if it'll do what I need done.

Like everyone (I think), I must have several hundred custom indicators. Was wondering if I would be able to use them with MSB. From the above Q/A, seems like I should be able to do that. I just need to clear up a couple things tho', so please confirm or correct my thinking...

In order for MSB to be able to use a custom indicator, I need to make sure that whatever variable I want to test in MSB is made available to it through the call you mention above in the previous posts. What if I only have the .ex4 and not the .mq4 for a particular custom indicator? I'm guessing that the the only way to get the data would be if it shows up in the Data Window, at which point I could pick the variable name off the list and use it in MSB. In the case where a "perfect" data variable is not showing, I'm guessing I'd have to calculate it somehow from the data that are made available. So, would MSB allow me to use data values (which I've identified from the Data Window list) and create mathematical fomulas to derive the "perfect" value I need?

Does it have some means of performing mathematical calculations?

Thanks!

D

Author:  pipseer [ Mon May 02, 2011 12:44 pm ]
Post subject:  Re: How to use MSB to recognize custom indicator true / false

Subsequent to my post above, I've downloaded MSB and it seems there's no way to extract data other than what is acutally external to the custom indicator. If the data are showing up in the Data Window (which most do), then shouldn't I be able to tell MSB to grab that data and operate on it?

Still, the question of actually entering calculations into a TA form remains. I didn't find this functionality in the documentation nor inthe rule option dropdowns. Am I missing something?

Thanks,

D

Author:  molanisfx [ Mon May 02, 2011 12:58 pm ]
Post subject:  Re: How to use MSB to recognize custom indicator true / false

See viewtopic.php?f=3&t=162
You can get the signals from a .ex4 if you know the signals (modes). If you don't contact the person who wrote the indicator.
Technically you can only obtain signals from indicators when the signals are exposed to the eas otherwise you need to change the indicator's code. The builder gets the signals that are defined in the indicator.

Author:  pipseer [ Mon May 02, 2011 3:55 pm ]
Post subject:  Re: How to use MSB to recognize custom indicator true / false

Thank YOU for the quick reply. That's a great resource. Will scour it for more insights!

molanisfx wrote:
See viewtopic.php?f=3&t=162
You can get the signals from a .ex4 if you know the signals (modes). If you don't contact the person who wrote the indicator.
Technically you can only obtain signals from indicators when the signals are exposed to the eas otherwise you need to change the indicator's code. The builder gets the signals that are defined in the indicator.

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/