Forex Forum - EarnForex
Serving Traders Since 2005
 

Go Back   Forex Forum - EarnForex > MetaTrader > MetaTrader 5

MetaTrader 5 MT5 is already out of its beta stage, but the development is ongoing. Some brokers already offer real accounts and the interest of traders is growing. You can discuss anything related to MetaTrader 5 in this forum.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 4th September 2011, 07:03
Default Avatar
Senior Member
 
Join Date: Aug 2011
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Default MetaEditor Debuger

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
Reply With Quote
  #2 (permalink)  
Old 4th September 2011, 07:11
Enivid's Avatar
Administrator
 
Join Date: Nov 2008
Posts: 1,548
Thanks: 18
Thanked 20 Times in 16 Posts
Default

That's not normal, but maybe in your code it's not entirely clear, which timeframe to open?
__________________
Please, read the Forum Rules and the Signature Rules to avoid termination of your account.
Reply With Quote
  #3 (permalink)  
Old 4th September 2011, 07:24
Default Avatar
Senior Member
 
Join Date: Aug 2011
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Default

#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,stochB uffer);
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[i]));
}

//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
Reply With Quote
  #4 (permalink)  
Old 4th September 2011, 07:25
Default Avatar
Senior Member
 
Join Date: Aug 2011
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Does this board support code format?
Reply With Quote
  #5 (permalink)  
Old 4th September 2011, 08:33
Default Avatar
Senior Member
 
Join Date: Aug 2011
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Enivid View Post
That's not normal, but maybe in your code it's not entirely clear, which timeframe to open?
Could you show an example?

thx
Reply With Quote
  #6 (permalink)  
Old 5th September 2011, 08:51
Enivid's Avatar
Administrator
 
Join Date: Nov 2008
Posts: 1,548
Thanks: 18
Thanked 20 Times in 16 Posts
Default

Quote:
Originally Posted by samjesse View Post
Does this board support code format?
Yes, it does. Use [highlight="MQL5"] or [highlight="MQL5"] BB tags.

Quote:
Originally Posted by samjesse View Post
Could you show an example?

thx
My mistake. You need to set the debugging currency pair and timeframe via Tools->Options->Debugging.
__________________
Please, read the Forum Rules and the Signature Rules to avoid termination of your account.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 11:21.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Inactive Reminders By Icora Web Design

SEO by vBSEO 3.3.2