Help needed using a custom indicator in a trading signal module

 

So far none of the documentation, samples, or forum questions answer how to use a custom indicator in a wizard generated trading signal. Any information on how to perform that magic would be appreciated. I assume it will require some type of use of CiCustom but I don't see any samples of that.

Looking at the MQL5 Wizard: How to Create a Module of Trading Signals sample it uses standard indicators not custom. 

How to call indicators in MQL5 covers calling an indicator directly in an expert advisor without the use of a trading signal which seems to go against the OO approach of the rest of MQL5. 

Custom Indicators in MQL5 for Newbies goes over creation of a custom indicator but does not use CiCustom in anyway and there are no samples of that used in a trading signal.

I have tried to use iCustom with a custom indicator and then pass that handle to the indicators.Add method, but it is expecting a pointer to a CObject. I'm sure there is something simple I am missing but I am struggling to tie everything together and use a custom indicator in a trading signal. Help please!

 

I've just made an example of using signals based on custom indicator data.

I took SignalSAR.mqh which is included in standard delivery and made some modifications to use custom indicator ParabolicSAR which is also included in standard delivery.

You can compare attached file and SignalSAR.mqh. It might help you to make your own signal based on custom indicator data.

Step on New Rails: Custom Indicators in MQL5
  • 2009.11.23
  • Андрей
  • www.mql5.com
I will not list all of the new possibilities and features of the new terminal and language. They are numerous, and some novelties are worth the discussion in a separate article. Also there is no code here, written with object-oriented programming, it is a too serous topic to be simply mentioned in a context as additional advantages for developers. In this article we will consider the indicators, their structure, drawing, types and their programming details, as compared to MQL4. I hope that this article will be useful both for beginners and experienced developers, maybe some of them will find something new.
Files:
 
alexvd:

I've just made an example of using signals based on custom indicator data.

I took SignalSAR.mqh which is included in standard delivery and made some modifications to use custom indicator ParabolicSAR which is also included in standard delivery.

You can compare attached file and SignalSAR.mqh. It might help you to make your own signal based on custom indicator data.

Your example did indeed show me how to use a custom indicator in a signal.

I am curious though, there seems to be some conflicting information. In the CustomSar Signal you created you are using LongCondition and ShortCondition with no overrides for the CheckOpenLong or CheckOpenShort which according to the documentation for Trading Signals by default return false. So what I don't understand is how if those methods haven't been overriden the signal class can work with just the Condition methods. Any references or explanation would be very helpful. 

 
I figured it out. The logic in CheckOpenLong and CheckOpenShort aren't as simple as described in How to Create a Module of Trading Signals. Both base algorithms on CExpertSignal check first for a Direction, which by default if used is the delta between LongCondition and ShortCondition. I think the trading signals article could be updated to reflect that, @alexvd thanks for the help so far.
 
TravisSilvers:
I think the trading signals article could be updated to reflect that.

We will definitely update this article or (and) write a new one.

Thank you for good question. 

 
alexvd:

We will definitely update this article or (and) write a new one.

Thank you for good question. 

Hi Travis and Alex,

Travis, thanks for asking the original Trade Signal question and thanks for Alex's helpful reply.

Alex, when you do the next article on Trade Signals, if possible, please include another example using a different iCustom indicator. That way we have two good examples to compare and work with.

I'm just a novice MT5 coder and I have tried to compare the 1st built-in Trade Signal (without iCustom) with the 2nd Trade Signal example provided by Alex that uses the iCustom indicator.

I am finding it hard to match the code differences (at my novice level) between the built-in trade signal and the example iCustom trade Signal, to see how and where to add my own iCustom indicators.

It would be extremely helpful for me and other new learners to actually see and compare 2 different iCustom Trade Signals with each other. That would help us to compare and understand the iCustom Trade Signal structure better

Thanks to you both for working on this Trade Signal question.
Robert
Documentation on MQL5: Technical Indicators / iCustom
  • www.mql5.com
Technical Indicators / iCustom - Documentation on MQL5