MACD crossover
-
HI all.
Does anyone know how you would specify a MACD crossover on a condition block?Thanks
-
@technodroid Here you have a MACD main/signal lines' crossover:

-
Ok so for a buy the main line crosses above the signal line and vice versa for sell?
-
Follow up questions: As you know, indicators cross and uncross several times during a candle. This can cause a problem when the end result is that there is no crossover. How would we create a condition that says "only execute when conditions are met for x number of tics in a row?"
-
@technodroid That's correct.
-
@4xfatigue You don't need to count ticks to confrim a crossing. Just select candle ID 1 as your reference crossing. That way the EA will not it is confirmed.
-
@l-andorrà Thanks for your help. I have one more question which will help me create a truly profitable ea. After testing and optimising I've noticed the losing trades were when the ADX line was decreasing. How would I set another condition for the line only going upwards? Would it be > object on chart, angle 45 as in 45 degrees?
-
@technodroid This is an easy way to do it. For a buy you can compare the indicator's value for candles 1 and 2 and then request for a specific distance in pips you can choose:

Obviously you need to do the inverse for a sell.
-
@l-andorrà Ok will try that thanks.
Will I link that up on the same line as condition blocks then to buy block? -
@technodroid Yes, this is just another condition block at all effects.
-
@l-andorrà This works. However, I was trying to think of a way for blocks to pass only when conditions are met for x number of ticks. Candle ID of 1 means a lot can happen before the trade is triggered. On the other hand, if the cross is confirmed for 5 ticks (or whatever) in a row, then it is confirmed early on without missing so many ticks in the rest of the candle. I feel there is a way by using looping blocks. I just haven't figured it out yet.
-
@4xfatigue Then you can use a counter variable, but that will increase complexity to a level that I'm not sure it's worth. Every tick will add +1 to the variable and if it reaches 5, the bloct tree can go on. However, you need to reinitialize it to 0 if proce moves in the opposite direction.