Questions about indicator lua programming

All posts which do not fit into any other sections of the forum.

Moderator: admin

Questions about indicator lua programming

Postby xiupingge » Sat Nov 19, 2011 6:53 pm

in function Update(period), could some one tell me how to compare the the candle length with a constant?
I use source.close[period] - source.open[period] in if condition as below:
if source.high[period] - source.low[period] >30 then
...
else
...
it seems not work! always go to else, except only I replace 30 or any other number to 0

Another question, how to get the time of one specific candle, such as
mark all the candle bar at 0:00 oclock on hourly chart.

Any helps will be highly appreciated.
xiupingge
 
Posts: 24
Joined: Thu Jul 28, 2011 1:34 pm

Re: Questions about indicator lua programming

Postby Apprentice » Sun Nov 20, 2011 2:57 am

It 30 is the difference in Pips.
It should look like this
if source.high [period] - source.low [period]> 30 * Source: pipSize () then
...
else

If this is nunber, try to use 0,0030.

As for the date. Try This

Local date = core.dateToTable (source: date (period));
if date.year == 2000 then
...
end

But all of this with more detail provided in the Indicore SDK Help.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36495
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Questions about indicator lua programming

Postby xiupingge » Sun Nov 20, 2011 8:28 am

Hi, Apprentice
Thank you very much for your kind help.
It works fine! Let me try to read SDK for more details.
Hava a good day!
xiupingge
 
Posts: 24
Joined: Thu Jul 28, 2011 1:34 pm

Re: Questions about indicator lua programming

Postby sunshine » Mon Nov 21, 2011 12:47 am

Just in case, here are links to online documentation:
public method tick_stream:date
public method bar_stream:date
sunshine
 

Re: Questions about indicator lua programming

Postby jtatalov » Sun Dec 04, 2011 5:57 am

Can someone recommend a book(s) on programming in LUA and using Indicore?
jtatalov
 
Posts: 42
Joined: Sat Aug 06, 2011 3:28 am

Re: Questions about indicator lua programming

Postby sunshine » Mon Dec 05, 2011 6:27 am

If you have not read yet, I would recommend you to refer to this section on the site:
viewtopic.php?f=28&t=2026
sunshine
 


Return to General Discussions

Who is online

Users browsing this forum: No registered users and 36 guests