Get specific candle values

Moderator: admin

Get specific candle values

Postby d10gen3 » Sun Jan 30, 2011 3:34 pm

1. Can someone help me with the code to get a specific candle info (low, high, open close) assuming that i have loaded a set with this:
Code: Select all
gSource = ExtSubscribe(2, nil, instance.parameters.TF, instance.parameters.Type == "Bid", "close");

What i would like to do is, if it's 15:27 and i'm in the "m15" chart, i would like to get the information of the 14:45 to 15:00 candle and the 15:00 to 15:15 candle (that means candles -1 and -2 assuming that current candle is 0)

2. I see some people use different functions to load the information of the chart. Can someone explain me the difference between this 2 approaches:
Code: Select all
a.   gSource = core.host:execute("getHistory", id, instance.bid:instrument(), instance.parameters.TF, 0, 0, instance.parameters.Type == "Bid");
b.   gSource = ExtSubscribe(2, nil, instance.parameters.TF, instance.parameters.Type == "Bid", "close");

Why some strategies use one or the other?

3. (Last one) it would be nice if the forum would move to the front page the current active topics. For example if someone posts a question about one of the indicators, it would be instantly moved t the first page.
d10gen3
 
Posts: 11
Joined: Wed Jan 26, 2011 8:18 pm

Re: Get specific candle values

Postby d10gen3 » Thu Feb 03, 2011 6:19 pm

Will someone answer to this thread? I can't believe no one can give me a little help in this silly question.
At least tell me you don't want to help or you don't understand or you don't know, but it's really discouraging when you try to learn something and no one answers to your questions.
I don't think my question was too hard, but if it was i'll make it simpler:

I have a source data with 300 candle values.
I want to know the exact value of candle number 152 (open, close, high and low)

Anyone?????
d10gen3
 
Posts: 11
Joined: Wed Jan 26, 2011 8:18 pm

Re: Get specific candle values

Postby Timon55 » Fri Feb 04, 2011 8:55 am

You can read about accessing to the bar values at this link:
http://www.fxcodebase.com/documents/Ind ... bar_stream

Example:
Code: Select all
local close152 = source.close[152]
local open152 = source.open[152]
local high152 = source.high[152]
local low152 = source.low[152]
Timon55
FXCodeBase: Confirmed User
 
Posts: 43
Joined: Thu Jul 15, 2010 5:35 am
Location: Omsk

Re: Get specific candle values

Postby d10gen3 » Fri Feb 04, 2011 9:46 am

Thanks Timon, I really appreciate this.
I finally finished my first indicator, thanks to your help. I don't know if the formula is correct but at least i'm getting the graphic painted as i wanted.
It's just a volatility index and of course the values i'm getting are between 0.00001 and 0.00007, but it looks good. I can post it if you want, so you can tel me if it's correct.
d10gen3
 
Posts: 11
Joined: Wed Jan 26, 2011 8:18 pm


Return to Indicator Development

Who is online

Users browsing this forum: No registered users and 56 guests