Page 18 of 25

Re: No Nonsense Forex - Indicators

Posted: Sun Feb 26, 2023 10:55 am
by mrtools
Centaur wrote: Sat Feb 25, 2023 6:04 pm Cong Adaptive Moving Average (CAMA)

https://in.tradingview.com/script/hOCmX ... g-Average/

Code: Select all

//+------------------------------------------------------------------+
//| Cong Adaptive Moving Average (CAMA)                              |
//+------------------------------------------------------------------+
int maCongAdaptive(const int rates_total,
                   const int prev_calculated,
                   const int value_length, // min val: 1; default val: 10
                   const double &source_price[],
                   const double &source_high[],
                   const double &source_low[],
                   const double &source_close[],
                   double &temp_true_range[],
                   double &result_value[],
                   double &result_color[])
  {
//--- bar index start
   int bar_index;
   if(prev_calculated == 0)
      bar_index = 0;
   else
      bar_index = prev_calculated - 1;
//--- main loop
   for(int i = bar_index; i < rates_total && !_StopFlag; i++)
     {
      temp_true_range[i] = i < 1 ? source_high[i] - source_low[i] : fmax(source_high[i] - source_low[i], fmax(fabs(source_high[i] - source_close[i - 1]), fabs(source_low[i] - source_close[i - 1])));
      if(i < value_length)
        {
         result_value[i] = source_price[i];
         result_color[i] = EMPTY_VALUE;
        }
      else
        {
         double denom = 0.0, hh = -DBL_MAX, ll = DBL_MAX;
         for(int k = 0; k < value_length; k++)
           {
            denom += temp_true_range[i - k];
            hh = source_high[i - k] > hh ? source_high[i - k] : hh;
            ll = source_low[i - k] < ll ? source_low[i - k] : ll;
           }
         double num = hh - ll;
         double alpha = num / denom;
         result_value[i] = alpha == 1.0 ? alpha * source_price[i] : alpha * source_price[i] + (1.0 - alpha) * result_value[i - 1];
         result_color[i] = StringToDouble(DoubleToString(result_value[i], _Digits)) > StringToDouble(DoubleToString(result_value[i - 1], _Digits)) ? 0.0 : StringToDouble(DoubleToString(result_value[i], _Digits)) < StringToDouble(DoubleToString(result_value[i - 1], _Digits)) ? 1.0 : result_color[i - 1];
        }
     }
   return(rates_total);
  }
Nice job!

Re: No Nonsense Forex - Indicators

Posted: Tue Feb 28, 2023 5:57 am
by Centaur
Supertrend Averages

Request from @pfxi for a Supertrend Averages with arrows, please let me know if other average types are required.

Changes made:
1.) True Range Calculation = ​max [(high − low), abs(high − previous close​), abs(low – previous close)]
2.) Average True Range Calculation = first ATR value is the SMA(TR, n) then becomes [(Prior ATR x(n-1)) + Current TR]/n

Re: No Nonsense Forex - Indicators

Posted: Wed Mar 01, 2023 5:40 pm
by tradd
Centaur wrote: Tue Feb 28, 2023 5:57 am Supertrend Averages

Request from @pfxi for a Supertrend Averages with arrows, please let me know if other average types are required.

Changes made:
1.) True Range Calculation = ​max [(high − low), abs(high − previous close​), abs(low – previous close)]
2.) Average True Range Calculation = first ATR value is the SMA(TR, n) then becomes [(Prior ATR x(n-1)) + Current TR]/n
Image

Image

Image
Hello Centaur,

G Channel trend average could be. By the way, G channels indicator sometimes doesn't appear. After changing channel lenght, indicator appears.

Re: No Nonsense Forex - Indicators

Posted: Wed Mar 01, 2023 7:46 pm
by Centaur
tradd wrote: Wed Mar 01, 2023 5:40 pm Hello Centaur,

G Channel trend average could be. By the way, G channels indicator sometimes doesn't appear. After changing channel lenght, indicator appears.
@tradd apologies for this, I've noticed this as well. Will fix and yes I agree a G-Channel Averages will be interesting. Will make work of it.

Re: No Nonsense Forex - Indicators

Posted: Thu Mar 02, 2023 7:34 pm
by Centaur
Centaur wrote: Wed Mar 01, 2023 7:46 pm @tradd apologies for this, I've noticed this as well. Will fix and yes I agree a G-Channel Averages will be interesting. Will make work of it.
Just an open question to the community: (1) would averages applied to the price as a price filter be more effective? (2) Or alternatively averages applied to the final indicator output be more effective? (3) Or thirdly averages applied to both 1 and 2? And if 3 is chosen would one need to control both ends separately, as an input?

Please keep in mind with the addition of every average lag is introduced.

Re: No Nonsense Forex - Indicators

Posted: Thu Mar 02, 2023 7:42 pm
by Centaur
Moving average filter applied to price with a lookback period of 1 before calculating an indicator in mql4

I've converted numerous of mql4 indicators to mql5, and I always pickup that the coder filters price with a standard simple moving average with a lookback period of 1.

Why would one do this, is a SMA with a lookback period of 1 not price itself? The only possible reason I can think of is to prevent any unforeseen price anomalies with metatrader, are these anomalies possible in metatrader?

Re: No Nonsense Forex - Indicators

Posted: Fri Mar 03, 2023 9:04 am
by kvak
Centaur wrote: Thu Mar 02, 2023 7:42 pm Moving average filter applied to price with a lookback period of 1 before calculating an indicator in mql4

I've converted numerous of mql4 indicators to mql5, and I always pickup that the coder filters price with a standard simple moving average with a lookback period of 1.

Why would one do this, is a SMA with a lookback period of 1 not price itself? The only possible reason I can think of is to prevent any unforeseen price anomalies with metatrader, are these anomalies possible in metatrader?
Hello.
I read a post somewhere, but I can't find it anymore.....I think it was from Mr. Mladen. How easily handle prices.... Yes, simply 1 period ma of price is price.....

Code: Select all

input ENUM_APPLIED_PRICE MAPrice     = PRICE_CLOSE;     // Ma price to use

Code: Select all

iMA(NULL,0,1,0,MODE_SMA,MAPrice,i)

Re: No Nonsense Forex - Indicators

Posted: Fri Mar 03, 2023 10:33 am
by kvak
Centaur wrote: Thu Mar 02, 2023 7:34 pm Just an open question to the community: (1) would averages applied to the price as a price filter be more effective? (2) Or alternatively averages applied to the final indicator output be more effective? (3) Or thirdly averages applied to both 1 and 2? And if 3 is chosen would one need to control both ends separately, as an input?

Please keep in mind with the addition of every average lag is introduced.
It's hard to say what would be effective, it depends what you want, low lag outputs, but nervous, or smoothed, but lagged.....

Re: No Nonsense Forex - Indicators

Posted: Tue Mar 14, 2023 10:07 pm
by Centaur
Braid Filter
This indicator was first introduced in 2006 in the Stocks and Commodities Magazine by a gentleman named Robert Hill also known as “Mr.Pips”. The “braid” is formed by intersections of lines based on different moving averages. The difference between the two is then plotted as a histogram. Filter line is based on a percentage of the ATR value.

Re: No Nonsense Forex - Indicators

Posted: Sat Mar 18, 2023 10:55 am
by Centaur