Problem with opening trade when current candle crosses below MA
-
Hi guys,
I'm having a problem that doesn't seem to get resolved so I hope this new topic helps.
Like my subject says I'm having problems with a trade opening upon a candle MA cross on the current candle.My aim is the following:
I need my EA to open a trade when the current price is above/below an MA while another indicator also gives a signal. This works when both events happen on the same candle. But I also want my EA to open a trade when my indicator gave a signal on yesterday's candle but price only crossed above/below the MA today.
To make it visible I have a picture below of how it should work. So the indicator cross happened on candle 1 but price was still above MA so no trade. On candle 0 price drops below MA and on the indicator the green line is still below the red line so a trade has to open. (When this would happen 2 candles later no trade should be opened so only if MA cross happen max 1 candle after indicator cross)

I tried a lot of thing combining ID1 and ID0 but nothing works. Below I have a share of what I already have tried for this:
https://fxdreema.com/shared/q7TU2IDwbFYI: My EA is programmed so that it checks only every day at 23:40 PM and this is essential for my system.
I hope someone can help me with this because to me it seems a pretty straight forward condition but I can't seem to get it to work.
Thanks already!
Cheers
-
How do you troubleshoot this? A method:
- break your structure into smaller pieces, as small as possible
- test the logical passes piece by piece
- use visual testing and some visual object to check: "comment"-block or "draw vertical line" are my favourites
- if you get the visual confirmation from one piece of your project, modify the visual pointing to some other piece, and repeat
-> at some point you must find what block / combination of blocks makes the error
-
@roar Thanks for the tip!
I went through my blocks and apparently it was my time filter that seemed to cause the problem. I have tried different things but the strange thing is that I only seem to get it to work when I use different kinds of time filter for different rows. For the normal cross the "once a day" works best (if I change that I see strange things happen) but when the cross happened on candle ID1 it only works when i use the "time filter" block.
Isn't that strange? I just want all blocks to run once from the last 20 minutes of the candle so I would think I could use the same time block for everything?
I'm just trying to understand the logic here.
Thanks in advance
-
@caesarcrypto I don't understand the structure here. Why there are 2 logic flows doing buy trades? Why not combine them to one? You are using same indicators in both flows?
-
@caesarcrypto Ah, for the two slightly different entry conditions. Anyway, I would use a more conjoined structure, so there is more hierarchy (and less risk of some weird misunderstanding in logic flow)
https://fxdreema.com/shared/rgZ96qppc
I can't test this because I don't have those fancy custom indicators. Have you tried replacing your custom indicators with some standard ones, just to check the logic? Does the same problem appear?
-
@roar Thanks again for the effort. I notice the ea runs much smoothers with your logic!
I have done what you supposed and used the logic you sent me and adjusted the indicators to standard ones:
- didi has been changed to the MACD and I have tweaked the settings so the MACD gives a signal on the same candle as the didi did.
- I removed the WAE because it wasn't in play for this issue
- I switched the average to the standard Linear Weighted MA also with settings so candles cross at the same place as my EA
Unfortunately this hasn't solved the issue. This is the ea with the standard indi's: https://fxdreema.com/shared/ua3G60bzb
As you can see below it still doesn't make the trade while the MACD makes a cross on candle ID1 and price crosses MA on ID0:

I haven't got time to change the indicators in this one: https://fxdreema.com/shared/8Kndpuzib
In that one it did work like I sent in my previous post. -
@caesarcrypto
I changed the logic once more, apparently the ELSE-output from cross conditions don't work as expected, better avoid using that.https://fxdreema.com/shared/jqvCgqYT
This build provides that secondary sell signal on eurusd 2013.08.29, although I think it is lagging 1 bar compared to your intended logic...

-
@roar Yes indeed and it also doesn't take the trade on 2017.02.10 when it should make a sell trade..
And could the time filter be the problem as it seems odd to me that by using 2 different time filters the ea does take the trade, as I have shown in my previous posts?

-
Hi everyone,
I've also sent an email to the admin about this problem since I can't get it solved and it is vital to my EA.
Is it normal that it takes several days before the admin answers, perhaps on vacation I don't know? I don't want to spam but it has been more than 5 days now since I sent an email.Cheers
-
I can confirm he doesn't answer as quickly as we would like, but he always does.