my coder want me to prove this is wrong, please help me.

 

Hello all,


How can I proof this code affects MA shift with picture? I told my coder this code is wrong, he want me to prove with picture before he will check on it.

input string     MAFILTER2        = "=====================";               //====== Dual MA Filter ======
input bool Use_Dual_MA_Filter = false;//Enable Dual MA Filter

input ENUM_TIMEFRAMES Dual_MA_Filter_TF_1 = PERIOD_H4;//TF 1
input int Dual_MA_Filter_Period_1 = 8;//Period 1
input int Dual_MA_Filter_Shift_1 = 0;//Shift 1
input ENUM_MA_METHOD Dual_MA_Filter_Method_1 = MODE_SMA;//Method 1
input ENUM_APPLIED_PRICE Dual_MA_Filter_Apply_1 = PRICE_CLOSE;//Apply to 1

input ENUM_TIMEFRAMES Dual_MA_Filter_TF_2 = PERIOD_H4;//TF 2
input int Dual_MA_Filter_Period_2 = 21;//Period 2
input int Dual_MA_Filter_Shift_2 = 0;//Shift 2
input ENUM_MA_METHOD Dual_MA_Filter_Method_2 = MODE_SMA;//Method 2
input ENUM_APPLIED_PRICE Dual_MA_Filter_Apply_2 = PRICE_CLOSE;//Apply to 2
    if (Use_Dual_MA_Filter)
    {
      Dual_MA_1_1 = MA(Dual_MA_Filter_Period_1, Dual_MA_Filter_Method_1, Dual_MA_Filter_Apply_1, Dual_MA_Filter_Apply_1, Bar_1, Dual_MA_Filter_TF_1);
      Dual_MA_1_2 = MA(Dual_MA_Filter_Period_1, Dual_MA_Filter_Method_1, Dual_MA_Filter_Apply_1, Dual_MA_Filter_Apply_1, Bar_2, Dual_MA_Filter_TF_1);
      
      Dual_MA_2_1 = MA(Dual_MA_Filter_Period_2, Dual_MA_Filter_Method_2, Dual_MA_Filter_Apply_2, Dual_MA_Filter_Apply_2, Bar_1, Dual_MA_Filter_TF_2);
      Dual_MA_2_2 = MA(Dual_MA_Filter_Period_2, Dual_MA_Filter_Method_2, Dual_MA_Filter_Apply_2, Dual_MA_Filter_Apply_2, Bar_2, Dual_MA_Filter_TF_2);
    }	
double MA(int ma_period = 0, ENUM_MA_METHOD method = MODE_SMA, int shift = 0, ENUM_APPLIED_PRICE apply = PRICE_CLOSE, int Position = 0, ENUM_TIMEFRAMES TF = PERIOD_CURRENT)
{
   int Handle;
   double Values[];
   
   Handle = iMA(Symbol(), TF, ma_period, shift, method, apply);
   
   CopyBuffer(Handle, 0, Position, 1, Values);
   
   return(Values[0]);
}

What I see is he is passing Apply into Shift and in the MA function, shift is a local variable which is 0.  No matter what Shift input will be, Shift is alway 0.

Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions
Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions
  • www.mql5.com
//| Expert initialization function                                   | //| Expert deinitialization function                                 | //| Expert tick function                                             | //| test1                                                            |...
 
Shifts are both zero.
 
Marco vd Heijden:
Shifts are both zero.

So, no matter what the values of the input of Shift I enter, Shift at MA function is alway 0, right?

Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions
Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions
  • www.mql5.com
//| Expert initialization function                                   | //| Expert deinitialization function                                 | //| Expert tick function                                             | //| test1                                                            |...
 
   Handle = iMA(Symbol(), TF, ma_period, shift, method, apply);
   CopyBuffer(Handle, 0, Position, 1, Values);

Perhaps you should read the manual, especially the examples.
   How To Ask Questions The Smart Way. 2004
      How To Interpret Answers.
         RTFM and STFW: How To Tell You've Seriously Screwed Up.

They all (including iCustom) return a handle (an int). You get that in OnInit. In OnTick (after the indicator has updated its buffers,) you use the handle, shift and count to get the data.
          Technical Indicators - Reference on algorithmic/automated trading language for MetaTrader 5
          Timeseries and Indicators Access / CopyBuffer - Reference on algorithmic/automated trading language for MetaTrader 5
          How to start with MQL5 - General - MQL5 programming forum - Page 3 #22 2020.03.08
          How to start with MQL5 - MetaTrader 5 - General - MQL5 programming forum - Page 7 #61 2020.07.05
          How to call indicators in MQL5 - MQL5 Articles 12 March 2010
 
William Roeder:

Perhaps you should read the manual, especially the examples.
   How To Ask Questions The Smart Way. 2004
      How To Interpret Answers.
         RTFM and STFW: How To Tell You've Seriously Screwed Up.

They all (including iCustom) return a handle (an int). You get that in OnInit. In OnTick (after the indicator has updated its buffers,) you use the handle, shift and count to get the data.
          Technical Indicators - Reference on algorithmic/automated trading language for MetaTrader 5
          Timeseries and Indicators Access / CopyBuffer - Reference on algorithmic/automated trading language for MetaTrader 5
          How to start with MQL5 - General - MQL5 programming forum - Page 3 #22 2020.03.08
          How to start with MQL5 - MetaTrader 5 - General - MQL5 programming forum - Page 7 #61 2020.07.05
          How to call indicators in MQL5 - MQL5 Articles 12 March 2010

It's obvious that this is a non-technical person trying to settle a dispute with his dev. How much time did you spend with that response?

 
nicholish en:

It's obvious that this is a non-technical person trying to settle a dispute with his dev. How much time did you spend with that response?

Yes, you are right, the dev said this:


provide proof that it is not working.


please don't talk in coding language. show me the wrong scenario using image and I check it.

I can not start reviewing the code whenever a customer thinks something is wrong. when you provide image of something wrong and then tell me how the correct scenario is, then I can fix it. otherwise the code is considered fully working.
 

The code shown in #1 is plain wrong, it's like you said, shift is always equal to the applied price (0 for PRICE_CLOSE) no matter what input was chosen.

It's very obvious for any developer. Just show them this thread.

 
William Roeder:

Perhaps you should read the manual, especially the examples.
   How To Ask Questions The Smart Way. 2004
      How To Interpret Answers.
         RTFM and STFW: How To Tell You've Seriously Screwed Up.

They all (including iCustom) return a handle (an int). You get that in OnInit. In OnTick (after the indicator has updated its buffers,) you use the handle, shift and count to get the data.
          Technical Indicators - Reference on algorithmic/automated trading language for MetaTrader 5
          Timeseries and Indicators Access / CopyBuffer - Reference on algorithmic/automated trading language for MetaTrader 5
          How to start with MQL5 - General - MQL5 programming forum - Page 3 #22 2020.03.08
          How to start with MQL5 - MetaTrader 5 - General - MQL5 programming forum - Page 7 #61 2020.07.05
          How to call indicators in MQL5 - MQL5 Articles 12 March 2010

Thank for your info, I will give this thread post link for my developer to read.

 
lippmaje:

The code shown in #1 is plain wrong, it's like you said, shift is always 0 no matter what input was chosen.

It's very obvious for any developer. Just show them this thread.

I had to give him these 2 pic then he worked on it. It is idloitic.

 
@nicholish en : It's obvious that this is a non-technical person trying to settle a dispute with his dev. How much time did you spend with that response?
  1. Yes it is.
  2. None.
  3. OP wanted "to prove this is wrong" to his developer. So I did, as did lippmaje. And now he has proof.
    Dilwyn Tng Zhuo Yu: Thank for your info, I will give this thread post link for my developer to read.
  4. What is your major malfunction?
 
William Roeder:
  1. What is your major malfunction?

 Shift did not produce differences in optimization steps. 

Reason: