Using a different time period price source

Moderator: admin

Using a different time period price source

Postby jhouchin » Thu Nov 17, 2011 12:58 am

Hello,

I am wanting to use a different time period source for some indicator calculations than is the source of the price on the chart.

For example my price chart is m15 but I want to do some calculations in my indicator on the m1 (1 minute) bar_stream regardless of the price chart the indicator is used on.

I am failing to understand how to access or create the m1 price bar_stream for use in internal calculations.

Any help greatly appreciated.

Jimmie
jhouchin
FXCodeBase: Confirmed User
 
Posts: 46
Joined: Fri Feb 25, 2011 1:38 pm
Location: Texas

Re: Using a different time period price source

Postby sunshine » Thu Nov 17, 2011 9:55 am

Theoretically, you can subscribe for one-minute history.
But I have never tried to do it in indicators.
I will check and let you know.
sunshine
 

Re: Using a different time period price source

Postby Victor.Tereschenko » Fri Nov 18, 2011 6:07 am

jhouchin wrote:Hello,

I am wanting to use a different time period source for some indicator calculations than is the source of the price on the chart.

For example my price chart is m15 but I want to do some calculations in my indicator on the m1 (1 minute) bar_stream regardless of the price chart the indicator is used on.

I am failing to understand how to access or create the m1 price bar_stream for use in internal calculations.

Any help greatly appreciated.

Jimmie

I've modified one of bigger time frame indicators to use m1 source always. Look at the attached sample.
Attachments
LesserTimeFrame.lua
(2.59 KiB) Downloaded 656 times
“There are only three sports: bullfighting, motor racing, and mountaineering; all the rest are merely games.” (c) Ernest Hemingway
Victor.Tereschenko
FXCodeBase: Confirmed User
 
Posts: 144
Joined: Fri Nov 19, 2010 8:55 am

Re: Using a different time period price source

Postby jhouchin » Fri Nov 18, 2011 10:01 am

Victor.Tereschenko wrote:I've modified one of bigger time frame indicators to use m1 source always. Look at the attached sample.


Hello Victor,

Thanks for the example. I had completely overlooked (forgotten) the core.host:execute("getHistory" ... ) function.

It looks like it will do what I need. It seems to be the preferred way to accomplish this task.

Thanks.

Jimmie
jhouchin
FXCodeBase: Confirmed User
 
Posts: 46
Joined: Fri Feb 25, 2011 1:38 pm
Location: Texas


Return to Indicator Development

Who is online

Users browsing this forum: No registered users and 47 guests