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 7th September 2011, 16:44
Default Avatar
Senior Member
 
Join Date: Aug 2011
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Default get indicator values with out plotting

Hello

I am using iStochastic in a .mqh file in a class which is being used in a .mq5 file.
MQL5 Code:
 stoHandle = iStochastic(_symbol, _period, x, y, z, MODE_SMA, STO_CLOSECLOSE);

int copied=CopyBuffer(stoHandle, 0, 0, bar_count, stochBuffer);
How can I use the above indicator without having to have it present "plotted" on the MetaQoute chart?

It appears to only work if the plot is present.

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

That's strange... All my MT5 EAs that use indicators never add them to the plot and they work perfectly. Is copied = 0 always?
__________________
Please, read the Forum Rules and the Signature Rules to avoid termination of your account.
Reply With Quote
  #3 (permalink)  
Old 7th September 2011, 22:04
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 strange... All my MT5 EAs that use indicators never add them to the plot and they work perfectly. Is copied = 0 always?
copied = -1
What is your built number? mine is Version 5.00 built 496 running under Win7

Last edited by samjesse; 7th September 2011 at 22:21.
Reply With Quote
  #4 (permalink)  
Old 8th September 2011, 07:52
Enivid's Avatar
Administrator
 
Join Date: Nov 2008
Posts: 1,548
Thanks: 18
Thanked 20 Times in 16 Posts
Default

Same version but WinXP.

Where do you call CopyBuffer()? Inside OnCalculate() or OnTick()? If so, then does it return -1 on every tick?

CopyBuffer() may return -1 when the chart data isn't yet ready, e.g. on the first run after the indicator/EA is attached.
__________________
Please, read the Forum Rules and the Signature Rules to avoid termination of your account.
Reply With Quote
  #5 (permalink)  
Old 8th September 2011, 07:58
Default Avatar
Senior Member
 
Join Date: Aug 2011
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thx Enivid

I used the wizard to create an EA and left the other file which was created using the wizard as well but as an Indicator. Now the problem is no longer present "in the EA".
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
QQE Indicator Enivid MetaTrader Indicators 0 20th August 2010 09:10
SAR Spy [MT4 Indicator] x1nx0nx MetaTrader Indicators 0 28th December 2009 18:10
RSI Signal (Buy\Sell Indicator) - GREAT signal indicator MechXTrader MetaTrader Indicators 0 25th September 2009 08:34
MTF CCI Indicator MechXTrader MetaTrader Indicators 0 3rd July 2009 04:35
MTF RSI Indicator MechXTrader MetaTrader Indicators 1 2nd July 2009 21:47


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


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