How to get the EA to buy when most of the moving average are up
-
Hello!
I have a indicator. Its called Trend Alex indicator. It basically looks at 3 time frames, M15, M60 & M240. It then looks at a 5 different moving averages. My goal is to buy when most of them are "up". There is a picture attached which shows it and also the indicator. How would I go about getting this to work in the EA? It does not seem to give off numbers in the data window, it only shows a red V or a blue inverted V. It also has a green sentence indicating if there is a buy or not. Is it even possible to get such a indicator to work? I don't think I can use the buffers...

-
@nscrilla
every indicator is different and it is all about identifying buffers. I'm not that good with adding custom indicators and as I understand, not all indicators are simple to work with in fxdreema.In any case, this shouldn't be a problem because the idea of your strategy can be simply created without the need of an indicator, and it is a simple one.
-
I see what your saying. Here is what I came up with.
https://fxdreema.com/shared/PACLkrnxd
The thing i need to figure out now is how to pass if several of the MAs are pointing up. For example, how would i allow them all to pass if 4/5 are true but 1/5 is not? The way it is set up now all of them have to pass but my strategy might be okay if 4/5 do. Any ideas?
-
Can this 1/5 of conditions be any of them or should they be a specific one?
-
Any of the conditions, the order of them wouldn't matter.
This is how i have it now. As you can see this is going to have many blocks since i am trying to emulate the indicators i cannot get to work correctly on fxdreema. Is there any way to shorten this?
-
As you said this distribution is working only when all conditions are true. What you can do is separating each group of them separatedly and then creating 5 int variables whose values art 0 or 1 only. Each separated grup will be linked to one of those variables so that when that specific group of conditions are met, its variable is moved from 0 to 1.
Then you create a new variable that will be the sum of all the previous ones. When the sum is at least 4, then the trade is open. That way it doesn't matter which conditions are true as far at least 4 of them are.
-
Okay I have been able to come very far. What i have done is broken the MACD conditions into 12 variables. They are either 0 or 1. Then i have a custom code that sums them. Then i have a condition that buys based on the number of them being met. This is appearing to work. However it will not optimize. For example, I can change the constant number from 1 - 12 and see different results. When its at 1, i should have the most trades since only 1 of the conditions needs to be met. Then if i have 12 I should have less trades since all 12 conditions need to be met. However i set up the constant so i can change this number from 1 - 12 in the EA. When i try to optimize from 1 - 12 i only see results for 10, 11 & 12. Also they do not meet the trade number that would be expected if i were just to put 10, 11 or 12 into the constant number. Therefore I am concluding that i have done something wrong

Also, is it better to modify the variable using a block? Or is it best to modify the condition's variable tab? As i have it now, the condition variable tab is modified and I am not using the blocks. Is this better? Is this two ways of achieving the same results?
https://fxdreema.com/shared/EttD0Fdid
Thanks so much!
-
If you are not used to work with variables, I recommend you to use the 'modify variables' block. There is no difference at all in efficiency for your EA when using one system or the other so don't worry about that.
On your project, why do you need so many variables. If I understand it correctly what you needed was to check 4 out of 5 conditions, not 11 out of 12.
-
Well i have so many variables in order to emulate the indicator above. The picture on the bottom left shows M15, M60 & M240 and then 5 MAs for each. They then either point up or down which gives them the Red or Blue arrow. In order for me to emulate the indicator i need to have 15 separate MA's for buying and 15 for selling. Then i can take a number for example, 10 or 11 of them to get "most" of them aligned. The original indicator in the first picture shows this. Since i cannot get the indicator to work in dreema I have to make my own.
-
I renumbered my blocks and seem to have my buy project working. Haven't made the sell function yet. However when i go to optimize it wont seem to run any optimizations. Any idea what might cause the optimization not to work? Is it not possible to optimize functions that use variables? What about other functions that are not variables? Getting to the end and not being able to optimize is a drag

Even if i disconnect all blocks except for no trade and buy now then try to optimize on the SL and the TP it will not optimize. I figured it might be something in a block but with none of them connected....
-
Is backtesting working fine, though? Is only optimization what doesn't work?
-
@l-andorrà Figured it out. It was not producing positive results so i had to uncheck skip useless results... lol. Crisis averted.
-
Good for you!
