Re: Various (Specialist) indicators for MT4
1501MACD Alert2_fixed
- These users thanked the author delp for the post (total 4):
- Akela, Ricstar_8, boytoy, Krunal Gajjar
sorry don't know....Ganesh wrote: Sat Apr 26, 2025 1:08 pm hi,kvak, kindly add to dispilay LOT SIZE TRADED to this attached indicatormn Show Profit Alerts - with PipValue.mq4
Updated version as pm request.
Hey! What is the yellow/dots on main chart can you please share?
In the original code, the calculation and handling of the median value were inadequate for different moving average (MA) methods. When a method other than exponential (EMA) was selected, situations could arise where the M_MA variable received a zero or negative value leaving indicator not drawing oscillatir at all. This caused problems because the value is used as a divisor, leading the indicator to "go dark."
Coded it for MT5 now too, but got few idea to make it better.........lets see........
Yes, you are right.ZigZag wrote: Sun May 18, 2025 10:22 pm In the original code, the calculation and handling of the median value were inadequate for different moving average (MA) methods. When a method other than exponential (EMA) was selected, situations could arise where the M_MA variable received a zero or negative value leaving indicator not drawing oscillatir at all. This caused problems because the value is used as a divisor, leading the indicator to "go dark."
I took rights fior my own hand and made few changes for it:
Added validation for the M_MA value:
Ensures that M_MA is a positive value before using it as a divisor
If M_MA is not positive, values from the previous bar are used instead
Modified handling of the median value:
Set the median value explicitly to 1.0 (previously just 1, which could cause inaccuracies)
Ensured that curta and longa are calculated only when M_MA is valid
Improved error handling:
Added logic to prevent division by zero
Ensured that the first bar has reasonable default values if values cannot be calculated
These changes make the indicator more stable across all MA methods, not just the exponential method.
This could be good candidate as MT5 version tool also.