MetaEditor Debuger

samjesse

Active Trader
Aug 30, 2011
118
0
27
Hi

When running the debugger in MT5. The screen shows my MetaQoute Demo interface and opens up a chart in M1 period regardless of what PERIOD the code is using.

Is that normal or a bug?

thx
 

samjesse

Active Trader
Aug 30, 2011
118
0
27
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_plots 1


#property indicator_type1 DRAW_LINE
#property indicator_color1 Gray
#property indicator_style1 STYLE_DOT
#property indicator_width1 1

//--- indicator
double ExtMapBuffer1[];
double stochBuffer[]; //--- Stochastic buffer
int stoHandle; //--- variable for storing the handle of the iStochastic indicator

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{

SetIndexBuffer(0, ExtMapBuffer1, INDICATOR_DATA); //--- indicator buffers mapping
PlotIndexSetInteger(0, PLOT_ARROW, 172); //--- indicator plot windingsstyle
ArraySetAsSeries(ExtMapBuffer1, true); //--- ordered 0 latest, n oldest
ArraySetAsSeries(stochBuffer, true);
stoHandle = iStochastic(NULL, PERIOD_H4, 14, 3, 3, MODE_SMA, STO_CLOSECLOSE); //--- create indicator handle
//---
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
//---


//--- Get Stochastic indicator data in an array stochBuffer []
int copied=CopyBuffer(stoHandle,0,0,rates_total,stochBuffer);
if(copied<=0)
{
Print("Unable to copy the values of the indicator. Error = ",
GetLastError(),", copied =",copied);
return(0);
}

//--- print out the indicator values
for(int i = 0; i < 5; i++)
{
Alert("Stoh values : " + string(i) + " " + string(stochBuffer));
}

//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
 

Enivid

Administrator
Staff member
Nov 30, 2008
18,605
1,366
144
Odesa
www.earnforex.com
Does this board support code format?

Yes, it does. Use
MQL5:
 or [code=mql5]   BB tags.
 
[quote="samjesse, post: 21480"]Could you show an example?
 
thx[/QUOTE]
 
My mistake. You need to set the debugging currency pair and timeframe via Tools->Options->Debugging.
 
Last edited: