Crossover help
-
Hi,
This is my first post and let me start by saying a huge thanks to fxDreema for creating such an incredible tool. I'm planning on subscribing just as soon as I can get my head round some of the basic functions which I'm struggling with at the moment. Specifically, crossovers! This is what I have so far, I thought I'd try and get the basics down before adding on the bells and whistles - https://fxdreema.com/shared/5ggzmeFT
The bare bones of the EA would be opening a sell trade when MACD signal line crosses above three RSI lines (Periods 4, 9 & 14) between the present candle (0) and the previous (1) and a buy when the MACD signal line crosses below these with the same rules. At the moment I've only tried to create the conditions for the opening of sell trades. If you check the above link you'll see that I have 3 consecutive condition blocks (one for each MACD/RSI crossover) followed by the sell condition (ignore the TP/SL settings, I'm just trying to get it to open trades at the moment before I add any further conditions, etc).
Any help would be absolutely great.
Thanks!
-
In case I wasn't clear enough with my description, this is what I'm hoping to capture with this EA. See orange circles - http://prntscr.com/at1mjb The cleaner the cross and steeper the angle of the crossover the better.
-
I believe I explained this somewhere, maybe on e-mail. The problem is that MACD and RSI have different natures, you can't cross their values. The problem is not even that MACD has values like -0.004736 or 0.0031848 or anything around 0 and RSI has values between 0 and 100. The problem is that RSI has values between 0 and 100 and MACD has values between... who knows, there is no lower and upper limit. So you can't actually align those two indicators.
Yes, if you have indicator that has values between -50 and +50, you can "shift" those values to match RSI, which means that -50 will be like 0 and +50 will be like 100. But again, MACD has totally weird values.
-
Someone wanted to compare 2 indicators before. The first of them have values between 0 and 100. The second has values between -1 and +1. And I found a way to compare those two indicators - the idea is to modify the values of one of them to match the values of the other.
What you have is this (first indicator vs second indicator):
0 => -1
50 => 0
100 => 1You want to modify the values on the left to look like the values on the right. So 0 will be turned to -1, 50 will be turned to 0, 100 will be turned to 1 and every value in between will be turned to something between -1 and 1.
Let's say the first indicator has value X, then this is the formula:
(X-50)/50If X is 0, the result of this will be (0-50)/50, which is -1
If X is 5, the result will be (5-50)/50, which is -0.9
If X is 10, the result will be (10-50)/50, which is -0.8
If X is 25, the result will be (25-50)/50, which is -0.5
If X is 50, the result will be (50-50)/50, which is 0
If X is 75, the result will be (25-50)/50, which is 0.5
If X is 100, the result will be (100-50)/50, which is 1What is 50 in this formula? The middle of values of the first indicator, whose values must be modified.
And I used this simple formula in Adjust
-
- / 50
In this case X will be the indicator as it is selected in Condition. In other words - 50) / 50 will be appended to something that is like (X, but not exactly.
- / 50
Here is something to play with:
https://fxdreema.com/shared/PEkKiXpde -
-
Thank you for such a thorough reply. Now that you've explained it it makes perfect sense. Now the hard part is going to be figuring out if there's a way to match the values of the rsi and MACD. I read somewhere that there is a way to stop the MACD from being unbounded by setting a firm minimum and maximum which I think would probably help in creating an overall formula to match the values but I'm not sure how it would affect the accuracy. Either that or using WindowPriceMax and Min... is there a way to incorporate these into the adjust parameters?
I read a thread https://forum.mql4.com/52883 in which the OP seems to trying to achieve a similar goal, there were a few suggestions thrown in but none that seem to have solved the problem fully. However, OP did point out that there must be some mechanism within MT4 which scales these indicators together (even if it is just the visual representation). Anyway, I'm already way out of my depth here so I'll plod on with it manually while I'm developing the idea and trying to work out if it's doable.
Thanks for that example as well, incorporated the idea (with adjustment (X-50)/500, just picked a random chart and the min/max values of the macd were roughly 0.1 & -0.1) into what I already had and now I've managed to get some trades opening! Even if they are all losers

Thanks again!
-
Just noticed the next thread down in the forum about input parameters for the adjust!