• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • User/Email: Password:
  • 9:37pm
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 9:37pm
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

How to get 2-dimension array to file and than get back it [MQL4] 14 replies

Two Dimensional Array vs One Dimensional Array 13 replies

MQL4 Language Most Recent Version is it updated beyond the tutorial on the mql4 websi 6 replies

Calculate Stochastic Formula on a array (non indicator buffer array) 2 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe
Tags: MQL4 Array - Problem
Cancel

MQL4 Array - Problem

  • Post #1
  • Quote
  • First Post: Sep 18, 2016 6:44am Sep 18, 2016 6:44am
  •  rogerha
  • | Joined Aug 2006 | Status: Member | 268 Posts
I am sure somebody can probably sort this in a heartbeat, but I seem to be stuck on an array issue. I have a global variable configured like this:

double gdaRSI[];

I am trying to populate that array like this (in int start(){}):

iCountedBars=IndicatorCounted();
if(iCountedBars < 0) return (-1);
if(iCountedBars>0) iCountedBars--;
iNewBars=MathMin(Bars-iCountedBars, Bars-1);

for(i=iNewBars-1; i>=0; i--) {
gdaRSI[i] = iRSI(NULL,0,13,PRICE_CLOSE,i);
Print("From Func: "+i+" "+gdaRSI[i]);
}

but the array doesn't appear to populate, in the journal I just see 157 entries of zero. I have tested the iRSI(NULL,0,13,PRICE_CLOSE,i); part of it and it's fine.

Any ideas anybody ? I have spent 5 hours trying to figure this out which makes me think its something stupid.

Thanks in advance.
  • Post #2
  • Quote
  • Sep 18, 2016 8:31am Sep 18, 2016 8:31am
  •  Gumrai
  • Joined Oct 2012 | Status: Member | 1,959 Posts
I don't see where you size the array.
If it is an indicator, why not simply use a buffer?
Please Do Not PM Me With Coding Enquiries
 
 
  • Post #3
  • Quote
  • Last Post: Sep 18, 2016 8:33am Sep 18, 2016 8:33am
  •  rogerha
  • | Joined Aug 2006 | Status: Member | 268 Posts
Thanks Gumrai, oddly, I have cut and paste all of the existing code into an entirely new file, complied it, and it works !

Might look at your sizing suggestion, I am using the data in the array to do further calculations, not aware of how to use buffers to do that.

Many Thanks for your response.
 
 
  • Platform Tech
  • /
  • MQL4 Array - Problem
  • Reply to Thread
0 traders viewing now
Top of Page
  • Facebook
  • Twitter
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • Twitter

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2023