arw_new, arw_setcolor, arw_settext  [SOLVED]

Questions about MultiCharts and user contributed studies.
Guest

Postby Guest » 02 Apr 2006

I've looked all over for documentation for this function and its properties/ reserved words. For example, how can you draw an up arrow instead of a down arrow? Are there other functions we can access that we don't have information about? There is some quirky behavior. For example, if you leave the text line out or you set the text field equal to "", it blots out all the price data. If you leave a space between the quotes, it works fine. Is there a way to displace the arrow from the bar a little further?

Thanks.

By the way, I sure hope the PL random termination is fixed soon. It is VERY frustrating.

GD

Guest

Postby Guest » 03 Apr 2006

Thanks very much! I think you have it reversed, though.

False means an up arrow.
True means a down arrow.

I hate to be nit-picky, but the newly implemented down arrows are now falling right in the middle of my bars. Is there a way to adjust the placement location? I didn't see a way in the attributes you provided.

Thanks again,

GD

User avatar
Stanley Miller
Posts: 556
Joined: 26 Jul 2005
Has thanked: 3 times

Postby Stanley Miller » 03 Apr 2006

Could you please provide me with the code which generates that result?

Guest

Postby Guest » 03 Apr 2006

Here is some sample code that shows the arrow behavior. I'd like to move the up arrows a little farther south under the lows and the down arrows a little farther north over the highs.

Thanks,

GD

Code: Select all

input: U_arrow_color(green),D_arrow_color(red);

var: id(0), Up_arrow(False), Down_arrow(False), arrowcolor(white), arrowdir(false);


Up_arrow = (Close > Close [1]);
Down_arrow = (Close < Close[1]) ;

if Up_arrow then begin
arrowcolor = U_arrow_color;
arrowdir = false;
end;
if Down_arrow then begin
arrowcolor = D_arrow_color;
arrowdir = true;
end;

if (Up_arrow or Down_arrow) then begin
id = arw_new(d,t,l,arrowdir);
arw_setcolor(id,arrowcolor);
arw_setstyle(id, 10);
arw_setsize(id, 3);
arw_settextbgcolor(id, white);
arw_settextcolor(id, black);
arw_settext(id, " ");
end;

User avatar
Stanley Miller
Posts: 556
Joined: 26 Jul 2005
Has thanked: 3 times

Postby Stanley Miller » 03 Apr 2006

Here is the updated code, please let me know if it works better

Code: Select all

input: U_arrow_color(green),D_arrow_color(red);

var: id(0), Up_arrow(False), Down_arrow(False);

Up_arrow = (Close > Close [1]);
Down_arrow = (Close < Close[1]) ;

if Up_arrow then begin
id = arw_new(d,t,l,false);
arw_setstyle(id, 10);
arw_setsize(id, 3);
arw_setcolor(id,U_arrow_color);
end;

if Down_arrow then begin
id = arw_new(d,t,h,true);
arw_setstyle(id, 10);
arw_setsize(id, 3);
arw_setcolor(id,D_arrow_color);
end;

Guest

Postby Guest » 03 Apr 2006

Dropping the text properties doesn't change anything.

GD

User avatar
Stanley Miller
Posts: 556
Joined: 26 Jul 2005
Has thanked: 3 times

  [SOLVED]

Postby Stanley Miller » 04 Apr 2006

Dropping the text properties doesn't change anything.

GD
What do you mean by doesn't change anything? Could you please post here a screenshot to illustrate your problems? Thanks.

GD
Posts: 20
Joined: 03 Apr 2006

Postby GD » 04 Apr 2006

I finally figured this out. See the attached pdf. The top figure, (GD_test) is correct.

The code generating the two indicators is given below.

Code: Select all

{GD_test}

input: U_arrow_color(green),D_arrow_color(red),strictness(0);

var: id(0), Up_arrow(False), Down_arrow(False);

Up_arrow = (TrueHigh > TrueHigh [1]);
Down_arrow = (TrueLow < TrueLow[1]) ;

if Up_arrow then begin
id = arw_new(d,t,l,false);
arw_setstyle(id, 10);
arw_setsize(id, 3);
arw_setcolor(id,U_arrow_color);
end;

if Down_arrow then begin
id = arw_new(d,t,h,true);
arw_setstyle(id, 10);
arw_setsize(id, 3);
arw_setcolor(id,D_arrow_color);
end;
-------------------------------

Code: Select all

{GD_test2}
input: U_arrow_color(green),D_arrow_color(red), strictness(0);

var: id(0), Up_arrow(False), Down_arrow(False);


Up_arrow = (TrueHigh > TrueHigh [1]);
Down_arrow = (TrueLow < TrueLow[1]) ;

if Up_arrow then begin
id = arw_new(d,t,l,false);
arw_setcolor(id,U_arrow_color);
arw_setstyle(id, 10);
arw_setsize(id, 3);
end;

if Down_arrow then begin
id = arw_new(d,t,l,true);
arw_setcolor(id,D_arrow_color);
arw_setstyle(id, 10);
arw_setsize(id, 3);
end;
-----------------------------------------

They are identical except for the order in which the arw_ attribute statements are listed. The first code set places the arrows correctly. I don't know why the second code order doesn't work.

GD
Attachments
Two_arrow_systems.pdf
(56.31 KiB) Downloaded 715 times

User avatar
Alex Kramer
Posts: 834
Joined: 23 Feb 2006

Postby Alex Kramer » 05 Apr 2006

Dear GD,
in the first case

if Down_arrow then begin
id = arw_new(d,t,h,true);

and in the second:

if Down_arrow then begin
id = arw_new(d,t,l,true);

This is why in the second case the arrow is centered on Low instead of High as it should. Anyway, thanks for making the information avaialble for the forum visitors.


Return to “MultiCharts”