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 15th October 2011, 11:14
Default Avatar
Senior Member
 
Join Date: Aug 2011
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Default CopyBuffer

Hi

I need to copy the latest 300 values of the iStochastics into an stochBuffer
Is the following correct?

MQL5 Code:
   stoHandle = iStochastic(_symbol, _period, 14, 3, 3, MODE_SMA, STO_LOWHIGH);
   CopyBuffer(stoHandle, 0, 0, 300, stochBuffer);
Reply With Quote
  #2 (permalink)  
Old 15th October 2011, 13:20
Enivid's Avatar
Administrator
 
Join Date: Nov 2008
Posts: 1,545
Thanks: 18
Thanked 20 Times in 16 Posts
Default

No, it will copy the first 300 bars (the oldest) in the chart.
__________________
Please, read the Forum Rules and the Signature Rules to avoid termination of your account.
Reply With Quote
  #3 (permalink)  
Old 15th October 2011, 17:52
Default Avatar
Senior Member
 
Join Date: Aug 2011
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Is there a way to copy the latest 300 values of the iStochastic indicator in a code running in a CLASS/INCLUDE file where rates_total is out of scope to do:
MQL5 Code:
CopyBuffer(stoHandle, 0, rates_total-300, 300, stochBuffer);

or. how can I get the ArraySize(iStochastic); since iStochastic returns an int?

Last edited by samjesse; 15th October 2011 at 18:30.
Reply With Quote
  #4 (permalink)  
Old 15th October 2011, 18:31
Enivid's Avatar
Administrator
 
Join Date: Nov 2008
Posts: 1,545
Thanks: 18
Thanked 20 Times in 16 Posts
Default

Set array stochBuffer as series and then copy as before (0, 300). It will then contain the latest data.
__________________
Please, read the Forum Rules and the Signature Rules to avoid termination of your account.
Reply With Quote
  #5 (permalink)  
Old 15th October 2011, 18:33
Enivid's Avatar
Administrator
 
Join Date: Nov 2008
Posts: 1,545
Thanks: 18
Thanked 20 Times in 16 Posts
Default

Wait, I've just checked the help files. It doesn't matter if you set the array as series or not. It will always copy the latest bars. So they answer to the OP is yes. Disregard my previous posts.
__________________
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 10:56.


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