![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
thanks bro,
if for downtrend , there will be two high points,
1st high point is greater than 2nd higher point ,
So need to substractas follow ,
right?
or need to be negative sign infront of mNumerator ?
The way I had it, for mNumerator, I assumed an uptrend line and did the math expecting a positive value (i.e., price2 - price1)
I tried reversing the logic in mNumerator, but it didn't work. I haven't delved into why that is.
I'm going to leave my code below. It works for both uptrends and downtrends. Default index to check is 0, relevant code is in the CalcValueByShift function.
The way I had it, for mNumerator, I assumed an uptrend line and did the math expecting a positive value (i.e., price2 - price1)
I tried reversing the logic in mNumerator, but it didn't work. I haven't delved into why that is.
I'm going to leave my code below. It works for both uptrends and downtrends. Default index to check is 0, relevant code is in the CalcValueByShift function.
thanks bro, this is 1st question and answer for trendline formula in mql4 without using objects.
good for new comers in community.
thanks bro, this is 1st question and answer for trendline formula in mql4 without using objects.
good for new comers in community.
No problem, hope you got everything sorted out and GL. :)