ARW_SetDirection

Questions about MultiCharts and user contributed studies.
User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

ARW_SetDirection

Postby TJ » 11 Jun 2009

The arw_new keyword is very useful.

shouldn't there also be an ARW_SetDirection option?

e.g.

ARW_SetDirection( ObjectID, ArrowDirection );

User avatar
RobotMan
Posts: 375
Joined: 12 Jul 2006
Location: Los Altos, California, USA
Has thanked: 31 times
Been thanked: 13 times
Contact:

Postby RobotMan » 11 Jun 2009

good call.

That would make sense if you are only using one arrow and updating it to a new location and need to change it's direction. As opposed to creating a new arrow and deleting the previous one.
Or, instead of ARW_SetDirection, add a new field to Arw_SetLocation(_s):
Arw_SetLocation (ObjectID, BarDate, BarTime, PriceValue, Direction)

If I am thinking along the same lines as you.

bowlesj3
Posts: 2180
Joined: 21 Jul 2007
Has thanked: 227 times
Been thanked: 429 times

Postby bowlesj3 » 11 Jun 2009

I want an option where if you change the direction of the arrow prices move in that direction :wink:

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Postby TJ » 11 Jun 2009

+1 vote

;-)

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Postby TJ » 11 Jun 2009

good call.

That would make sense if you are only using one arrow and updating it to a new location and need to change it's direction. As opposed to creating a new arrow and deleting the previous one.
Or, instead of ARW_SetDirection, add a new field to Arw_SetLocation(_s):
Arw_SetLocation (ObjectID, BarDate, BarTime, PriceValue, Direction)

If I am thinking along the same lines as you.

I could never get the delete to work... it always delete the wrong item.

Yes, I prefer to use arw_SetLocation.

That's a good idea to put the direction in arw_SetLocation.

bowlesj3
Posts: 2180
Joined: 21 Jul 2007
Has thanked: 227 times
Been thanked: 429 times

Postby bowlesj3 » 12 Jun 2009

I use arrows a lot. If you store the arrow ID when barstatus = 2 you should be able to normally rely on the delete to delete the correct arrow. However I gather there is a bug in the BarStatus which is likely random in nature so it may at times screw up and delete the wrong one. Having said that I do not constantly put new arrows out by program control. I have set arrows of a limited number that I manually manipulate after the program puts them out there. These are always numbered consistently and never change their ID day after day. It is all preplanned on a per chart basis. I do something similar with lines and every so often MC gets confused and starts deleting a line it should not. I know what study it is that is doing this delete so I simply shut it off and start it again and that seems to reanitialize things and it stops the problem. This problem occurs maybe once every 2 or 3 weeks if that. All and all if you store the ID of a line or arrow or text when BarStatus = 2 you can trust it up to this extent. I also can not say for sure if it is not some sort of bug in my code rather than an MC problem but the BarStatus bug may be the real cause.

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Postby TJ » 12 Jun 2009

thanks for the barstatus = 2 idea. I will give it a try.


I believe there is a bug somewhere between the drawing object ID and delete.
This is low priority for me so I am not going to investigate.

bowlesj3
Posts: 2180
Joined: 21 Jul 2007
Has thanked: 227 times
Been thanked: 429 times

Postby bowlesj3 » 12 Jun 2009

I guess I could have explained barstatus = 2 better. Here is some more detail.

MC with the _New commands deletes and redraws arrows,lines,text over and over until barstatus = 2. I have tested this many times with a very carefully placed set of print statements and there is no doubt about it (at least in MC 2.1.999.999 and I highly doubt they have changed it). If two studies on the same chart are both creating an arrow during the same bar and executing on every tick I think that is what is causing the problem since they may alternate the assignment some how especially if you have if statements that maybe skip a tick here or there in one of those two studies. So when you wait until barstatus = 2 you know that the constant delete and redraw has stopped and MC can not grab that ID number for another study.

I would have to go back and do a lot of debugging work to determine if my line getting deleted every 2 or so weeks is my problem and I couldn't be bothered. I just turn it off and on then all is well. Much easier.

bowlesj3
Posts: 2180
Joined: 21 Jul 2007
Has thanked: 227 times
Been thanked: 429 times

Postby bowlesj3 » 12 Jun 2009

This is one of the first tests I did to prove it was deleting and redrawing the text until barstatus = 2. I don't have time to study it at the moment. It might save some work for someone wanting to test this themselves.

Code: Select all

variables:
IntraBarPersist DateLoc(0),
IntraBarPersist TimeLoc(0),
IntraBarPersist CloseLoc(0),
IntraBarPersist MyCount(0),
IntraBarPersist TextID(0),
IntraBarPersist BarSize("");

if LastBarOnChart then
begin
if MyCount = 0 then
begin
TimeLoc = MinutesToTime(TimeToMinutes(Time) + 10);
if BarStatus < 2 then
begin
{
Here it puts out a new one on every tick so it gets
blanked out on the next tick
}
value1 = Text_New(Date,TimeLoc,Close,Numtostr(MyCount,0));
value2 = text_setstring(Value1,NumToStr(Value1,0));
end
else
begin
{
Here it puts out a new one on every tick again but since
it is the last tick it can stop putting out new ones
You will notice that it stops following the close for
a little while but it is still out front
}
TextID = Text_New(Date,TimeLoc,Close,Numtostr(MyCount,0));
value2 = text_setstring(TextID,NumToStr(TextID,0));
MyCount = MyCount + 1;
end;
end;
if MyCount > 0 then
begin
MyCount = MyCount + 1;
if MyCount = 20 then
begin
{
This command is to prove that it has held it by moving
it back at tick 20 while the next bar is still being built.
}
TimeLoc = MinutesToTime(TimeToMinutes(Time) - 10);
value1 = Text_SetLocation(TextID,Date,TimeLoc,Close);
end;
end;
end;

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Postby TJ » 14 Jun 2009

many thanks for the detailed information.
I will give it a test.

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: ARW_SetDirection

Postby TJ » 30 Mar 2011


User avatar
Stan Bokov
Posts: 963
Joined: 18 Dec 2009
Has thanked: 367 times
Been thanked: 302 times

Re: ARW_SetDirection

Postby Stan Bokov » 08 Apr 2011

Thanks. We will look at it.


Return to “MultiCharts”