Indicators question

 
Hi
on some indicators like when you backtest them the results are not the same on the chart as when you compare the same indicator on a live chart the same time period.
Meaning that crosses are different etc (depending on the indicator style). This means that the indicator is not working correctly, is that right?
 
Indicators are only as good as the data that they do their math on. The indicator will only be the same if the data in history is identical which will not be true if it's not the same exact server being used for the backtest as the live testing.
 
athanfx: on some indicators like when you backtest them the results are not the same on the chart as when you compare the same indicator on a live chart the same time period.
Meaning that crosses are different etc (depending on the indicator style). This means that the indicator is not working correctly, is that right?
  1. Backtesting is for EAs not indicators.
  2. If they look at other pairs and assume iTime(otherpair,x) == Time[x] they're completely broken (must use iBarShift.)
  3. If they use marketInfo(MODE_ASK) instead of Ask they're broken
  4. If they don't properly use IndicatorCounted()
  5. If they do something with local time.
  6. If they repaint it will be like live - looks good after the fact but can't be used for trading. Examples ZigZag, COG.
 
WHRoeder:
  1. Backtesting is for EAs not indicators.
  2. If they look at other pairs and assume iTime(otherpair,x) == Time[x] they're completely broken (must use iBarShift.)
  3. If they use marketInfo(MODE_ASK) instead of Ask they're broken
  4. If they don't properly use IndicatorCounted()
  5. If they do something with local time.
  6. If they repaint it will be like live - looks good after the fact but can't be used for trading. Examples ZigZag, COG.


7. If they use Bid or Ask they will not work in the ST, Bid can be replaced with Close[0] . . . there is viable alternative for Ask.
 
WHRoeder:
  1. Backtesting is for EAs not indicators.
  2. If they look at other pairs and assume iTime(otherpair,x) == Time[x] they're completely broken (must use iBarShift.)
  3. If they use marketInfo(MODE_ASK) instead of Ask they're broken
  4. If they don't properly use IndicatorCounted()
  5. If they do something with local time.
  6. If they repaint it will be like live - looks good after the fact but can't be used for trading. Examples ZigZag, COG.

RaptorUK:

7. If they use Bid or Ask they will not work in the ST, Bid can be replaced with Close[0] . . . there is viable alternative for Ask.


Thanks for all the answers.

So just to understand this, i use an indicator in a simple EA so to call it from ST and display it using the code bellow. Then i place the same indicator on a live chart and i compare the indicators on these two charts to check if they look exactly the same.
Using the ST wont it show up if there is a problem of any of the above 1-7 statements?

In general there are quite a number of indicators (some of them in the Code Base) that when i use the above way testing them (using the code bellow) do not look the same. But so far i wasnt aware of the 1-7 statements...

By the way here is the code i use to test indicators:

#include <stderror.mqh>
#include <stdlib.mqh>

#property indicator_level1 0
#property indicator_separate_window

#property indicator_buffers 1
#property indicator_color1 Green

double BufLong[];

extern int history=300;


int init()
{
   string s="";   
   IndicatorBuffers(2);

   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,BufLong);
   SetLevelValue (0, 0.0000);       // The horizontal line level is set   

   return(0);
  }

int start()
{
      int counted_bars = IndicatorCounted();
    int candles=Bars-counted_bars; // Index of the first uncounted
    if (candles<0) return (0);   

    if (candles>history-1)                 // If too many bars ..
    {
       candles=history-1;                       // ..calculate specified amount
    }
     

    i=0; 

  
    while  (i<=candles)
    {
        
        BufLong[i]=  iCustom(Symbol(),Period(), "SilverTrend", 400,7,1.6,50.6,false,  0 , i); //adx;//i_Regr_i(1, 2, 120, 0, i);   

        i++;
         
    }  // while 
   
  
  return (0);
}


The strange with the above code is that no matter what type of indicator i ll call through iCustom, it will display as normal on the chart nomatter that i only got one buffer (BufLong[]).

 
athanfx:


Thanks for all the answers.

So just to understand this, i use an indicator in a simple EA so to call it from ST and display it using the code bellow. Then i place the same indicator on a live chart and i compare the indicators on these two charts to check if they look exactly the same.
Using the ST wont it show up if there is a problem of any of the above 1-7 statements?

Yes problems will show up in the Strategy tester but only if you know what to look for and that you should be looking . . . this may help you some more: https://www.mql5.com/en/forum/143310/page2#753353
 
RaptorUK:
Yes problems will show up in the Strategy tester but only if you know what to look for and that you should be looking . . . this may help you some more: https://www.mql5.com/en/forum/143310/page2#753353


thanks, yes it does!

But as far as i understood there is no way to be 100% sure that an indicator you create it works correctly when you try it out to ST ( I m always talking about an indicator not EA).

 
athanfx:


thanks, yes it does!

But as far as i understood there is no way to be 100% sure that an indicator you create it works correctly when you try it out to ST ( I m always talking about an indicator not EA).

If you can test 100% of your Indicator in the Strategy Tester bearing in mind the limitations that the Strategy Tester has when an Indicator is placed on a Strategy Tester chart then there is no issue . . . even if you can't test your Indicator 100% you can maybe partially test it in the ST and then complete testing in a Live/Demo environment.