Indicators: Rex

 

Rex:

The indicator of probable market reversal based on the true bar value (True Value of Bar).


Author: Scriptor

 

The second switch statement seems off, as it's the same as the first.

   switch(InpMethod)
     {
      case MODE_EMA  :  if(ExponentialMAOnBuffer(rates_total,prev_calculated,0,period_rex,BufferTVB,BufferRex)==0return 0;               break;
      case MODE_SMMA :  if(SmoothedMAOnBuffer(rates_total,prev_calculated,0,period_rex,BufferTVB,BufferRex)==0return 0;                  break;
      case MODE_LWMA :  if(LinearWeightedMAOnBuffer(rates_total,prev_calculated,0,period_rex,BufferTVB,BufferRex,weight_sum)==0return 0break;
      //---MODE_SMA
      default        :  if(SimpleMAOnBuffer(rates_total,prev_calculated,0,period_rex,BufferTVB,BufferRex)==0return 0;                    break;
     }
   switch(InpMethod)
     {
      case MODE_EMA  :  if(ExponentialMAOnBuffer(rates_total,prev_calculated,period_rex,period_sig,BufferRex,BufferSignal)==0return 0;               break;
      case MODE_SMMA :  if(SmoothedMAOnBuffer(rates_total,prev_calculated,period_rex,period_sig,BufferRex,BufferSignal)==0return 0;                  break;
      case MODE_LWMA :  if(LinearWeightedMAOnBuffer(rates_total,prev_calculated,period_rex,period_sig,BufferRex,BufferSignal,weight_sum)==0return 0break;
      //---MODE_SMA
      default        :  if(SimpleMAOnBuffer(rates_total,prev_calculated,period_rex,period_sig,BufferRex,BufferSignal)==0return 0;                    break;
     }


should be changed to

   switch(InpMethod)
     {
      case MODE_EMA  :  if(ExponentialMAOnBuffer(rates_total,prev_calculated,0,period_rex,BufferTVB,BufferRex)==0return 0;               break;
      case MODE_SMMA :  if(SmoothedMAOnBuffer(rates_total,prev_calculated,0,period_rex,BufferTVB,BufferRex)==0return 0;                  break;
      case MODE_LWMA :  if(LinearWeightedMAOnBuffer(rates_total,prev_calculated,0,period_rex,BufferTVB,BufferRex,weight_sum)==0return 0break;
      //---MODE_SMA
      default        :  if(SimpleMAOnBuffer(rates_total,prev_calculated,0,period_rex,BufferTVB,BufferRex)==0return 0;                    break;
     }
   switch(InpMethodSig)
     {
      case MODE_EMA  :  if(ExponentialMAOnBuffer(rates_total,prev_calculated,period_rex,period_sig,BufferRex,BufferSignal)==0return 0;               break;
      case MODE_SMMA :  if(SmoothedMAOnBuffer(rates_total,prev_calculated,period_rex,period_sig,BufferRex,BufferSignal)==0return 0;                  break;
      case MODE_LWMA :  if(LinearWeightedMAOnBuffer(rates_total,prev_calculated,period_rex,period_sig,BufferRex,BufferSignal,weight_sum)==0return 0break;
      //---MODE_SMA
      default        :  if(SimpleMAOnBuffer(rates_total,prev_calculated,period_rex,period_sig,BufferRex,BufferSignal)==0return 0;                    break;
     }
 
I attached the modified version based on the @Leif's report above, I also added a zero level line in the code. Note that you have to click "Go to discussion" to see the attached file.
Files:
Rex.mq5  11 kb
 

declaration of 'weight_sum' hides global variable MovingAverages.mqh 222 155

Warning when compiling.

 

Hi Scriptor, thanks for the free indicators, I am unable to write code but I've been using a website called FXDreema to try to create a bot, I'd like to use the rex indicator to try but it doesn't show the buffers when I load, would it be possible to do this?


Thanks

Reason: