Best practices - Running multiple scenarios and multiple custom indicators in 1 EA (Event driven?)

 

Hi there,

 

Its mostly a theoretical question (but example code is always welcome).

 

The real question is: how to correctly code the 'frame' of an EA that tests multiple scenarios from multiple custom indicators?


The way I'm (busy) building an EA, is not very much focused on 1 strategy, but is gonna try to 'test' multiple strategies and 'picks' the most appropriate one. 

So I have created a few custom indicators, that are all returning an array of 'status data'..

For example I have the following indicators:

  • Crossing moving average indicator, that gives a signal when the average is crossed and also the current position in percentage moved from MA.
  • Bollinger Bands indicator, that returns the 'room' between the bands and gives a signal when the bands starts 'squeezing' 
  • Multi timeframe 'direction/trend' indicator (is a certain timeframe moving toward up or down). That returns current directions and gives a signal if a timeframe direction changes.
  • ADX indicator, for checking 'small-scale' movement and picking best buy/sell points.

I could write one HUGE scenario, but I think it can be done much better..Because if lets say, all timeframes are going down (down trend) You could have a special scenario to handle lots of down movement.. But if there is no current trend, a different scenario would fit best.

 

So I feel like its best to make multiple scenarios(still in 1 EA).. First all custom indicator data is collected and then each scenario uses that data to calculate can then returns a 'score' and the best one is picked.

 

But how can I layout the code in the best 'overview' way?

 

Should I create a Class for each scenario and give them a manual 'tick' with data? And just split them into multiple files and #include them?

And what about event-driven development? Created classes that listen to certain indicator events and go there own way (that would be awesome) 

Any thoughts are much welcome!

 

Thanks! 

 
 

I think have what you are looking for. This "host" supports

- multiple strategies parallel, same account, same symbol without influencing eachother

- multiple pools of orders that do not affect eachother 

- it provides a "slot-stack" where different indicators can be loaded and traded parallel ... without influencing eachother

What it does not at the moment, is weighting signals. But everything is possible in the end. To code an indicator for this host, you need the include its API. In fact, you need to add 5 lines of code to turn such an indicator into a signal provider for the host.

If you are interested, drop me a PN. This product is gonna be released in 2016 and is live since 2 months on >10 accounts. 

Doerk 

Reason: