Draw TL_New (rookie question).Could we set a given TL number

Questions about MultiCharts and user contributed studies.
arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

Draw TL_New (rookie question).Could we set a given TL number

Postby arjfca » 17 Mar 2012

Hello

Is it possible to preset a a trendline number

I want to set to
98 a trendline of the last day high
99 a trendline to the last day low

Martin

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

Re: Draw TL_New (rookie question).Could we set a given TL nu

Postby TJ » 17 Mar 2012

Hello

Is it possible to preset a a trendline number

I want to set to
98 a trendline of the last day high
99 a trendline to the last day low

Martin
don't understand what you mean.

You can re-locate a trendline anywhere. Why preset?

arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

Re: Draw TL_New (rookie question).Could we set a given TL nu

Postby arjfca » 17 Mar 2012

don't understand what you mean.

You can re-locate a trendline anywhere. Why preset?
My idea was to use a fix number to make sure that I won't play with these number another time. But I do understand now that it is not a necessity. As mentioned, that was a rookie question :)

Martin

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

Re: Draw TL_New (rookie question).Could we set a given TL nu

Postby bowlesj3 » 18 Mar 2012

I do it by putting the study at the top of the list of studies in the chart using the alpha order technique (A_whatever) and using a set of low numbers starting with 1. MC starts assigning the numbers for the chart (sub-charts included) starting at 1 and working up. Once it is assinged for the MC session it can not be used again. So you need to assign it on the first bar of the chart. In some studies I have a starting trend line number since I never know if I want to assign a new set of fixed numbers at the bottom again. I did it because I wanted other studies to go after these numbers. Later I started using GVs to record a starting series of numbers so I could know the last number in the series. Regarding arrows I know the arrow is in the RSI since the number is less than 100 in its value where as in the price area it is well above that.There are lots of tricks one can use once one knows all the commands in the group of commands for arrows or text or trend lines. Color is handy for a trick and I hope they some day allow us to put pre- formatted (arrows,TLs and text) on a tool bar to make it so we can drop them on the chart fast and make use of these tricks more extensively.

When you have the study running on every tick and assign a drawing ID number after currentbar=1 (and you have studies deleting this same drawing type) you have to be careful because the EL code keeps deleting the drawing over and over on each new tick up until barstatus=2. Only when barstatus=2 is reached is the ID number locked for sure. There is no way to stop this. For this reason you should not use intrabarpersist for the ID number of a drawing ever because you want the temporary ID number the EL code created set back to zero when the next mid bar tick comes in to match the fact that the drawing is removed from the chart. So I have some code that waits for the barstatus=2 before I actually store the ID for later potential deletion of the drawing. This is okay if you have a lot of random drawings going out. However if you know what will be going out it is better to assign them on currentbar=1 and hide them when not in use. It saves all this work. Not being aware of this removal of new drawings up until bartstatus=2 can cause new programmers to create a lot of problem code (LOL, I was one of them).


tick1
Study1 ID_A gets 1 (an IF statement cause the EL code to no run TL_new again - the ID is stored in a GV)
study2 ID_B gets 2
study3 ID_C gets 3

tick2
all drawings are erased and all IDs are set to zero since there is no intrabarpersist.
study2 ID_B gets 1
study3 ID_C gets 2

tick3 (last tick for the bar and these assignments are locked)
study2 ID_B gets 1
study3 ID_C gets 2

So later Study1 wants to delete the drawing. The drawing has already vanished and not been put out there again. Not only that the study1 code thinks it needs to remove ID value 1. So it goes and delete the drawing from the other study2. It will drive the programmer crazy trying to figure out what is going on since they automatically assume that this automatic deletion until the end of the bar is not occurring.

Anyone brand new to MC should study this link and run the tests. Oddly enough it may even be more important if they have experience as a programmer since EL is a bit strange in the way it works.
viewtopic.php?f=5&t=6871&hilit=intrabarpersist

sptrader
Posts: 742
Joined: 09 Apr 2010
Location: Texas
Has thanked: 483 times
Been thanked: 274 times
Contact:

Re: Draw TL_New (rookie question).Could we set a given TL nu

Postby sptrader » 18 Mar 2012

I often add several studies, that each contain several different trendlines, sometimes they interfere with each other (changing colors etc)... It seems to me, being able to Number each trendline would eliminate the confusion and conflicts between trendlines, mentioned above by Bowles. The GV method might help in keeping them sorted, but being able to assign a number to them, would eliminate the need for GV's, visual order, etc. to keep them sorted.
I'm fairly new to drawing trendlines but numbering them, seems like a logical solution, to prevent conflicts.

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

Re: Draw TL_New (rookie question).Could we set a given TL nu

Postby TJ » 18 Mar 2012

I used to have trendlines interfering with others (changing colors, deleting the wrong lines, etc).
I thought it was a bug in MultiCharts,
but after carefully tracking my codes, I have determined that it was coding error that caused the color changes. After fixing the codes, I have not had an interference since.

sptrader
Posts: 742
Joined: 09 Apr 2010
Location: Texas
Has thanked: 483 times
Been thanked: 274 times
Contact:

Re: Draw TL_New (rookie question).Could we set a given TL nu

Postby sptrader » 18 Mar 2012

I used to have trendlines interfering with others (changing colors, deleting the wrong lines, etc).
I thought it was a bug in MultiCharts,
but after carefully tracking my codes, I have determined that it was coding error that caused the color changes. After fixing the codes, I have not had an interference since.
***********************************************************************
I think the easiest way to solve this is to show 2 simple trend-line studies, the ONLY difference is that one is plotting at the last high and the other is plotting at the last low. The one plotting the last high is yellow , the last low is green.. When BOTH are applied on the same chart, they interfere with each other, changing colors.. If you could explain what must be different for them to work independently, that would solve my problem.. I thought separate studies would automatically be independent.

//Study #1

Code: Select all

Vars:TL.M1(-1);

once
begin

tL.M1 = tL_new(d, t, 0, d, t, 0);
tl_setextleft(tL.M1,true);

end;

tl_setend(tl.M1, d, t, H);
tl_setbegin(tl.M1, d, t,H);
Value1=TL_SetColor(1,yellow);
// here is study #2-

Code: Select all

Vars:TL.M1(-1);

once
begin

tL.M1 = tL_new(d, t, 0, d, t, 0);
tl_setextleft(tL.M1,true);

end;

tl_setend(tl.M1, d, t, L);
tl_setbegin(tl.M1, d, t,L);
Value1=TL_SetColor(1,green);

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

Re: Draw TL_New (rookie question).Could we set a given TL nu

Postby TJ » 18 Mar 2012

I used to have trendlines interfering with others (changing colors, deleting the wrong lines, etc).
I thought it was a bug in MultiCharts,
but after carefully tracking my codes, I have determined that it was coding error that caused the color changes. After fixing the codes, I have not had an interference since.
***********************************************************************
I think the easiest way to solve this is to show 2 simple trend-line studies, the ONLY difference is that one is plotting at the last high and the other is plotting at the last low. The one plotting the last high is yellow , the last low is green.. When BOTH are applied on the same chart, they interfere with each other, changing colors.. If you could explain what must be different for them to work independently, that would solve my problem.. I thought separate studies would automatically be independent.

//Study #1

Code: Select all

Vars:TL.M1(-1);

once
begin

tL.M1 = tL_new(d, t, 0, d, t, 0);
tl_setextleft(tL.M1,true);

end;

tl_setend(tl.M1, d, t, H);
tl_setbegin(tl.M1, d, t,H);
Value1=TL_SetColor(1,yellow);
// here is study #2-

Code: Select all

Vars:TL.M1(-1);

once
begin

tL.M1 = tL_new(d, t, 0, d, t, 0);
tl_setextleft(tL.M1,true);

end;

tl_setend(tl.M1, d, t, L);
tl_setbegin(tl.M1, d, t,L);
Value1=TL_SetColor(1,green);
The correct code should be:
(see last line)

Code: Select all

Vars:TL.M1(-1);

once
begin

tL.M1 = tL_new(d, t, 0, d, t, 0);
tl_setextleft(tL.M1,true);

end;

tl_setend(tl.M1, d, t, H);
tl_setbegin(tl.M1, d, t,H);

TL_SetColor( tL.M1 , yellow);

sptrader
Posts: 742
Joined: 09 Apr 2010
Location: Texas
Has thanked: 483 times
Been thanked: 274 times
Contact:

Re: Draw TL_New (rookie question).Could we set a given TL nu

Postby sptrader » 18 Mar 2012

That's it !!!- thanks TJ, your a genius at coding.. I can see the difference now and it makes sense, (now I have to change about 20 different studies, but well worth it)-

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

Re: Draw TL_New (rookie question).Could we set a given TL nu

Postby bowlesj3 » 18 Mar 2012

It does not matter whether you pre-assign low trend line numbers as I have done or if MC was changed to allow you to assign a higher range with a gap at the front (for example starting from 500 to 600). Either way you would need to have these studies run first and pre-place those lines out there so MC knows in advance to skip over them when it does its assigning. Yes MC could be programmed to have a table you fill out in advance somewhere telling it to skip over in advance but this is a lot more cumbersome than just doing what I do (put your studies at the front and pre-assign all possible trend lines in advance starting from 1 and working up). So you can do it but you just have to start from 1 and work up. So lets say you have 3 studies you want to do a preassign on.
Study1 (1 to 50)
Study2 (51 to 102)
Study3 (103 to 150).
Just make sure they are in alpha order such that they are executed first on the chart and make sure all the lines are placed on Currentbar=1 but hidden then use the functions I wrote in this link below to move them rather than delete and add them over and over again (saves MC work actually).
viewtopic.php?f=5&t=7748&hilit=movetrendline
NOTE: this function almost never fails to do a proper move (I have seen it do a nutty move about 3 times at most and it is a heck of a lot better than reading the manual and trying to figure it out).

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

Re: Draw TL_New (rookie question).Could we set a given TL nu

Postby bowlesj3 » 18 Mar 2012

One note: I do not want to promote the use of trend lines in the true sense of the word and send someone completely new down what I consider a waist of time path. I use to use them and dumped them after 6 years of struggling with them (way too slow for day trading and very inaccurate/subjective I find). I replaced them with RSI trend lines (actually levels) and bollinger band trend lines. I have to figure out where the trend line is with every single trend (not hard most times). I use lines a huge amount of time but they are not used as trend lines. If someone can get true trend lines to work for them that is great. I did not feel comfortable with them (never could trust them).
Last edited by bowlesj3 on 18 Mar 2012, edited 4 times in total.

sptrader
Posts: 742
Joined: 09 Apr 2010
Location: Texas
Has thanked: 483 times
Been thanked: 274 times
Contact:

Re: Draw TL_New (rookie question).Could we set a given TL nu

Postby sptrader » 18 Mar 2012

I'm not using the Trendlines for "trend", just to set levels for Hi or Lo of day, expected ranges etc..

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

Re: Draw TL_New (rookie question).Could we set a given TL nu

Postby bowlesj3 » 18 Mar 2012

I'm not using the Trendlines for "trend", just to set levels for Hi or Lo of day, expected ranges etc..
Yes, lines have lots of uses outside of the trend line. I use a lot of horizontal lines on the RSI for expected ranges (I call them bounces or boundaries). I use lines to track one wave's forward progression relative to the prior like wave's forward progression (a clone line is used). I am tempted to start reusing what I call the arrow head which uses lines as well (it is my invention since I have never read about it). The key is remembering an arrowhead is symmetrical. The left side of the arrow head is set to track the up 1/2 or down 1/2 of a wave. When a wave 1/2 moves up fast then comes down slow (slower than the right side of the imagined arrow head) this is a bullish indicator. If it comes down faster than the right side of the imagined arrow head this is a bearish indicator. A downward pointing arrow head measures the upward movement of the current wave 1/2 against the most recent down move of that wave. With the down arrow head the left arrow head is set exactly to the down move and the prices moving up against the right side of the arrow head is the measure of either upward strength of weakness. Like most indicators by itself it is dangerous but it can be a decision tipper with certain situations. A double arrow head signal is an excellent signal at the end of a parent wave: (medium down, fast up, slow down). With both the clone line technique and the arrow head technique the program tracks price bars relative to the line bar by bar and signals its indicator at some point along the tracking of the line. So I guess is it obvious lines have lots of uses which have absolutely nothing to do with trend lines. I am guessing traders have collectively come up with 1,000s of ways lines can be used.


Return to “MultiCharts”