Several conditions needs to be fullfiled to proceed with buy or sell
-
@fxdreema i have an idea that might work solve this problem, not sure how to code it.
So it would work like this.
Lets call it Candle Range.
So the idea is that u can customise the candle range. 3, 5, 7, etc.apply a max so that it doesnt take alot of ramIn addition to this u then have something that counts how many indicators are true within that range and set that. Eg, 3 indicators needs to be true within that candle range before a position gets executed
So the coding would have a short term memory stored in ram that counts the amount of indicators that are true within that range. And then resets back to zero.
-
Hello,
please can you help me to understand how to build EA where several conditions needs to be met one after another and than proceed with buy or sell order ?For example here: https://fxdreema.com/shared/zoZQW0fJb
I would like to wait until MACD signal line crosse above value 0.001, than cross below value 0.001 and than cross below value 0 in order to proceed with sell action. Somehow it`s not working...
Many thanks in advance.
-
Under "on Tick" everything happens in a single tick! If Conditions are connected this way, then all must be true at the same time and only then you will reach block 5.
Recently I worked on something that I called "on Hold" where things works the way you imagine, but the results were very slow and I dropped that work. In MQL4/MQL5 EAs are programmed in such a way that things happen within a single tick, then again on the next tick, then again on the next tick...
One workaround, is to define some variable and use it to remember the current step of the logic.
But some things are not needed. If MACD now goes above some level, this also means that just a moment ago it was below that level. And if MACD crosses some level below, this also means that it was above that level second ago. So why do you need to check 2 things when one of these 2 things is well known and it's true

This level 0.001 is so close to 0, so I don't get your idea

-
You right that 3 conditions are not necessary, but at least 2 are required if you want to fulfil idea that MACD needs to cross firstly certain value and than in second step the zero line.
Is there no way how to setup EA in such way that if condition no.1 was fullfilled (somewhere in the past) than if condition no.2 is fullfileed EA runs an action (buy/sell/etc) ?
I want to run BUY/SELL only if MACD crossed zero line only if it crossed before certain value i.e. 0.001.
PS: 0.001 is ok for example in 1Hour frame.
-
This is the idea: https://fxdreema.com/shared/cC2xjD8Kb
http://prntscr.com/9s9nc4There is one variable with values like 0, 1 or -1
1 => MACD was < -0.001 and we are ready to check if MACD > 0 and Buy
0 => Not ready to buy or sell
-1 => MACD was > 0.001 and we are ready to check if MACD < 0 and SellIt can be made with less blocks and connections, but I am presenting the idea.
Download .mq4 file and then import it into your projects.
There is also one block "Indicator moves within limits". This one is going back in the history and checks indicator values candle by candle. But I only got the idea that it can be probably used to do the same thing, I was not thinking about how to do it. The downside of looking back in the history on every tick is that the backtest becomes more slower.
-
Thank you very much. It`s wonderful how your logic is working...
-
Good day
I am also struggling with the similar, i dont know how to connect AND logic block.
2 conditions must be met in order to open a buy.
condition 1-price must cross above200 SMA (it is used to determine the direction of trend)
AND
condition 2- price must cross and close above my trendline (trend_line_name)object on chart, then open a buy trade.if price crosses below 200 SMA and condition 2, price cross and close above my trend line ,(do nothing)
please see the link https://fxdreema.com/shared/kkJtnpgYb
please help, i have been struggling for long time with this one
-
No AND blocks are necessary in fxDreema other that to make inexperienced users what is happening in the logic. Just by connecting one condition to the next one you are getting the exact same result with far less blocks.