Hey,
I'm finding that I need to expand the functionality of my FxDreema EA's by using Static Variables to manage market / indicator events and conditions at the time they happen, and then later act on these events during other market conditions, without having to loop back through indicator array buffers to see if other indicator events happened in the recent past.
So, if I could use Static Variable, as they are defined for MQ4... permanent memory and don't get re-initialized when an EA function exits.... http://docs.mql4.com/basis/variables/static
Simple example.
. Current Price Bar causes the MACD to cross above zero.
(however.. the EA system must have confirmation from the CCI indicator & 3 Price Bars with higher lows before going Long the EURUSD)
So..
..... at some point later in the day..... the CCI reads greater than 50, confirming market is trending Up
..... and at some other point later in the day..... the market provides 3 Price Bars with higher lows, once again confirming market is trending Up
Now..., at this point the EA must loop back in time (indicator array buffers) to determine if the CCI > 50 and MACD > 0, and if so, open a Long position now on the current price bar....
I can see taking 1 of 4 approaches to code this....
- Use 2 MQ4 Static variables, one for MACD and another for CCI. As the market prices pass through the EA, I would use the static variables to boolean (TRUE/FALSE), when the indicators confirmed an up trend, in the context of prices movements in time (ie. during up/down trends, 3 higher lows, 3 lower highs, etc)
-or-
- Loop thru the indicator buffers, at the time when the 3 Price Bars with higher lows occurred.
(This is currently awkward using the fxdreema "LOOP" blocks, and result in many other custom blocks just to loop an indicator array buffer, clutters the drawing canvas with too many blocks, error prone, tedious, etc.....)
-or-
- Hand code a custom MQ4 indicator that would combine MACD & CCI & the Last 3 Price Bars to output a separate indicator array buffer that would show 1/0 for yes/no to open a long position based on MACD Xover 0, CCI>50, Low(1)>Low(2)>Low(3). Upload the indicator to FXDreema, setup the code blocks, etc. (not optimal, I don't want to have to create a custom indicator for every type of trading rule that I need in an EA)
-or-
- Hand code all Static variables and handling logic in Library Studio. (I could define the static variables in a custom block in library studio. But I can't access the variables outside of the custom library studio code block, so all code logic to use the static variables would have to be placed in the custom library code block. This would be tedious, defeats the purpose of using FxDreema, slows down my development, error prone, etc)
So.. Approach #1 is what I would prefer.....and would be the most efficient, agile, and easiest to code and maintain, now and in the future....
Do you have plans to introduce Static variables into the FxDreema interface build of EA's, or am I missing something here.....
Please let me know...
Thanks
101 