Accessto DOM for indicator

Questions about MultiCharts and user contributed studies.
aczk
Posts: 71
Joined: 08 Feb 2012
Has thanked: 8 times
Been thanked: 1 time

Accessto DOM for indicator

Postby aczk » 30 May 2013

Hi

I am trying to access the DOM values and simply plot a marker on the chart if there is a certain size displayed anywhere in the DOM.
My efforts so far:

Code: Select all

input: BigSize(20), Offset(5);

if dom_isconnected = true then begin

if dom_asksize(1)[1] > BigSize then plot1(Low-Offset,"Ask1");
if dom_asksize(2)[1] > BigSize then plot1(Low-Offset,"Ask2");
if dom_asksize(3)[1] > BigSize then plot1(Low-Offset,"Ask3");
if dom_asksize(4)[1] > BigSize then plot1(Low-Offset,"Ask4");
if dom_asksize(5)[1] > BigSize then plot1(Low-Offset,"Ask5");

end;
This plotted dots under the bars, for a second but now only gives me an error message (STD exception). Wonder if anyone has created something like this!!?

Thanks

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Accessto DOM for indicator

Postby Henry MultiСharts » 30 May 2013

Hello aczk,

Have you checked the prebuilt indicator code --- Market Depth on Chart --- ?

aczk
Posts: 71
Joined: 08 Feb 2012
Has thanked: 8 times
Been thanked: 1 time

Re: Accessto DOM for indicator

Postby aczk » 31 May 2013

Yes & the post about the new DOM functions, but I can't get it to work. Is there an example somewhere which specifically uses the "dom_asksize" function ?

Thanks for any feedback

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Accessto DOM for indicator

Postby Henry MultiСharts » 03 Jun 2013

Here is the proper code:

Code: Select all

input: Length(5), BigSize(20), Offset(5);

if not LastBarOnChart_s then #return;

repeat
if not dom_isconnected then
break;

var: X(0), N(0);
X = Dom_AsksCount;
N = IFF(X > Length, Length, X);

for value1 = 0 to N-1 begin

if dom_asksize(value1) > BigSize then
begin
plot1(Low-Offset,"Ask");
plot2("Ask" + NumToStr(value1 + 1, 0) );
end;
end;

until(False);


Return to “MultiCharts”