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 May 16, 2024 2:35 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Problem with indicator signals that can't be exploited
PostPosted: Thu Aug 19, 2010 8:44 am 
Offline

Joined: Thu Aug 19, 2010 8:01 am
Posts: 19
The greatest difficulty I'm having at the moment is with Custom Indicators that work fine in the MT4 terminal but whose signals can't be called properly.
For example the well-known Magic Trend (enclosed) displays two lines:blue when the market is trending upwards, and red when it is trending downwards. On any Time Unit the Trend Magic signal (mode 0) is positive in upward markets while the corresponding Value 2 signal (mode 1) is nil (no value is indicated ...). The Trend Magic signal (mode 0) is nil and the Value 2 signal is positive (mode 1) in downward markets.
When the colour changes both signals appear as positive and equal in the MT4 terminal.
However none of the following code lines works properly:
if Mode (0,1) < Mode(0,0) then BUY
if Mode (1,1) > Mode (1,0) then SELL
if Mode (1,0) = Mode (0,0) && Mode (1,1) < 0 then CLOSELONG
if Mode (1,0) = Mode (0,0) && Mode (0,1) < 0 then CLOSESELL
I've tried to retrieve the values of both signals by adding the following lines in the SENDMAIL order of the .mq4 file:
mailstring = StringConcatenate(mailstring, "MagicTrendUp: ", iCustom(Symbol(),0,"trend-magic", 50, 5,0,0), "\n");
mailstring = StringConcatenate(mailstring, "MagicTrendDown: ", iCustom(Symbol(),0,"trend-magic", 50, 5,1,0), "\n");
The resulting e-mail alerts on my mobile do not correspond at all with the values displayed in the MT4 charts and the values of the signals left blank in the MT4 terminal are not "0" but "2147483647".
What do I have to make of all this? How can one exploit such an indicator to make an EA?
Thanks a lot in advance for any light your could shed on the matter.
Regards.


Attachments:
Alert Magic Trend TP0 TS0.mq4 [53.48 KiB]
Downloaded 908 times
trend-magic.mq4 [2.42 KiB]
Downloaded 931 times
Top
 Profile  
 
 Post subject: Re: Problem with indicator signals that can't be exploited
PostPosted: Thu Aug 19, 2010 11:36 am 
Offline

Joined: Tue Dec 22, 2009 12:22 am
Posts: 1761
You are on the right track.
In the screen you see one line that changes colors. In MT4 a line that changes colors means there are two lines. One is plotted while the other ones is not. Lines are hidden when their values are null (no value).
For this indicator, when you see a blue line, it means the red one has no value and vice-versa. Also, the line plots next to the price action, so the indicator values are more likely to be around the price.
The indicator has two signals that correspond to two modes, mode 0 and mode 1
Remember that when mode 0 has a value, mode 1 does not (and vice-versa) so your trading condition might be something like
If mode 0 has a signal then action
The indicator values move between a value close to the price and 2147483647
What is 2147483647?
2147483647 is the way metatrader defines no value (or null)
If mode 0 has a signal then action can we rewritten as If mode 0 < 2147483647 then action (If mode 0 < 10000 then action will work as well)
In short, your conditions should be
If mode 0 < 2147483647 then action (it means it's showing a line next to the price action)
If mode 1 < 2147483647 then action (it means it's showing a line next to the price action)


Top
 Profile  
 
 Post subject: Re: Problem with indicator signals that can't be exploited
PostPosted: Sat Aug 21, 2010 11:08 am 
Offline

Joined: Thu Aug 19, 2010 8:01 am
Posts: 19
Hi Molanis!

Thanks a lot for your clear explanations that shed some light on my EA quizz.
However when the line displayed changes colour mode 0 and mode 1 show the same value and I can't figure out how to catch the candle where this happens.
Your suggestion (if mode 0 < 10000 then action; if mode 1 < 10000) works fine but it triggers a BUY or SELL trade 2 candles later on average and the result in the backtests is definitely negative!
I've tried the following: if mode 0, shift 0 < 10000 and mode 1, shift0 < 10000, but it doesn't work at all. It sets off no trade!
I have tried all sorts of combinations with shift 1, shift 2, shift 3 etc... but to no avail.
So if you have any idea how to solve this riddle I'm prepared to consider it.
Thanks in advance.
Regards.


Top
 Profile  
 
 Post subject: Re: Problem with indicator signals that can't be exploited
PostPosted: Sun Aug 22, 2010 8:39 pm 
Offline

Joined: Tue Dec 22, 2009 12:22 am
Posts: 1761
Please post you strategy file .mol file to take a look


Top
 Profile  
 
 Post subject: Re: Problem with indicator signals that can't be exploited
PostPosted: Fri Nov 25, 2011 10:06 am 
Offline

Joined: Fri Nov 18, 2011 9:31 pm
Posts: 31
It sure would have been nice to see this thread through to its final conclusion. I have the same problem that I'll need to figure out on my own.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

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