Placing Marks (Numbers, Dots) on the Chart.

Moderator: admin

Placing Marks (Numbers, Dots) on the Chart.

Postby Tortoise » Mon Apr 12, 2010 8:24 am

Hi All. I'm new to Lua and indicator coding, but I have done some programming before.

I'm trying to code the DeMark TD Setup indicator described by Jason Perl in the book DeMark Indicators. The logic of it is very simple and I am not experiencing any problems there. I am experiencing problems with the display.

Can anyone please either tell me how, or direct me to a resource which explains how, to place discrete marks on the chart window? I would especially like to place numbers above or below the bars, but anything at all would be a step forward.

I noticed that the built-in indicator SAR places dots above and below the bars. It seems to use 'core.Dot' under the 'instance:addStream' method. It's just a little frustrating that 'core.Dot' is not mentioned at all in the list of 'core' functions in the Indicore SDK documentation. On the one hand it's great that the documentation is brief and to the point, but on the other hand I can't find how to do some seemingly simple things.

I have tried using the 'text_output:set(index, level, label)' method, with index being the bar number (e.g. 'source:size() - n'), level being a price just above or below the bar, and label being a literal string such as "1", but it hasn't put anything on a chart as yet. Again, the documentation tells me that this function exists but it does not give me any context regarding how and where Marketscope interacts with it.

I would greatly appreciate any help or suggestions.
Tortoise
FXCodeBase: Confirmed User
 
Posts: 7
Joined: Mon Apr 12, 2010 7:43 am

Re: Placing Marks (Numbers, Dots) on the Chart.

Postby Nikolay.Gekht » Mon Apr 12, 2010 12:34 pm

I moved the post the indicator development forum. I think this is better location for it.

Ok, let's go step by step:

1) core.Line, core.Dot and core.Bar are not the functions. This is the simple constants which defines the drawing style of the number series called "stream".

You can read about this here: http://www.fxcodebase.com/documents/ind ... tream.html

Let's me try to explain. By default (we do not discuss the host's function such as "drawLine"), the indicator does not draw anything. It just calculates a number series called stream, which has the same size as a source price, and which has the value corresponding to the source bar exactly in the same position of the stream.

So, when the indicator is applied (Prepare() function of the indicator), the indicator must declare all streams it wants to calculate (and show). This instance.addStream method is used. The core.Dot value is just a recommendation how to draw this stream on the chart. core.Dot means:
for a bar: take the number which is in the same position as the bar has, use this number as the price and draw a dot at this price level and in the bar position.

core.Bar recommends to draw the vertical bar from the zero level to the price level, and the core.Line recommends to draw a line from the previous bar to this bar.

You can read more about the basic concepts of streams here: http://www.fxcodebase.com/documents/ind ... terms.html

2) the text_output is a table which is returned by the instance.createTextOutput method. Text output is the special case of the stream, which is not a line, dots or bars, but is a text, placed near the specific bar, at the specified price level. Look here for the documentation of the function:
http://www.fxcodebase.com/documents/ind ... utput.html

You can also take a look at the fractal indicator which is also included into the latest version of the SDK, or in news indicator in the custom indicator section.
Nikolay.Gekht
FXCodeBase: Site Admin
 
Posts: 1235
Joined: Wed Dec 16, 2009 6:39 pm
Location: Cary, NC

Re: Placing Marks (Numbers, Dots) on the Chart.

Postby Tortoise » Mon Apr 12, 2010 7:02 pm

Wonderful! Thank you very much! I can now put numbers above the bars as desired.

Thanks for your help Nikolay - the pieces were all there but I didn't know how to put them together. It's people like you who make this sort of forum successful.
Tortoise
FXCodeBase: Confirmed User
 
Posts: 7
Joined: Mon Apr 12, 2010 7:43 am

Re: Placing Marks (Numbers, Dots) on the Chart.

Postby mitenp » Sun Jan 16, 2011 11:38 am

Hi,

The links in the post come up broken. Could you correct ?

Thanks
mitenp
 
Posts: 37
Joined: Sun Jan 16, 2011 11:37 am

Re: Placing Marks (Numbers, Dots) on the Chart.

Postby Timon55 » Sun Jan 16, 2011 1:39 pm

mitenp wrote:Hi,

The links in the post come up broken. Could you correct ?

Thanks


Simply replace "indicoreSDK" to "IndicoreSDK" in all broken links.

http://www.fxcodebase.com/documents/ind ... tream.html -> http://www.fxcodebase.com/documents/Ind ... tream.html
Timon55
FXCodeBase: Confirmed User
 
Posts: 43
Joined: Thu Jul 15, 2010 5:35 am
Location: Omsk


Return to Indicator Development

Who is online

Users browsing this forum: No registered users and 55 guests