(1)Technique for converting MQL4 to Forextester dll

Suppose you're familiar with MQL4 and C(or C++) (or other progrmming language.)

The main big difference of MQL4 and forextester indicator

(1)external variable( MQL4:#extern Forextester:RegOption() )
(2)Don't need to use IndicatorCounted()

I'll explain in detail.

(1)external variable

For the indicator setting,we set the external variable.

extern variable#extern int v; RegOption("v", ot_Integer, &v);

(2)Don't need to use IndicatorCounted()

In MQL4, most of the code count for the indicator counted(IndicatorCounted()),but in forextester indicator programming,we don't need to care the number of indicator counted.
In MQL4 start() function, the indicator program runs from index=1 and 0 ,but in forextester indicator program Calculate(ine index) is called from Bars()-1 to 0 . And so we don't need to care about indicator counted.

Below is the sample code for forextester( SampleIndicator)

EXPORT void __stdcall Calculate(int index)
  double v;
  if( index + sma >= Bars() ) return;
  for( int i=0;i   SMA[index]=v/sma;

For Debugging

For debugging purpose,in MQL4 we use Print(). In forextester indicator api,we can use Print() ,but the parameter must be char *(Or PCHAR)
So, we have to change the string format to char* by sprintf() function.

char buf[30];
sprintf( buf,"index = %d", index); // int index