End tl after entry .. is possible ?

Questions about MultiCharts and user contributed studies.
maubonvi
Posts: 16
Joined: 26 Sep 2014

End tl after entry .. is possible ?

Postby maubonvi » 26 Mar 2015

sorry for my English writing ... but I wanted to know if you can stop a trendline after an input. I tried to write the following code but it does not work. How can you do?

if(MarketPosition= -1) then begin
if BarsSinceEntry=1 then
tl_setend(tlUP,date[0],time[0],entryprice);
end;

Regards

Mauro

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

Re: End tl after entry .. is possible ?

Postby TJ » 26 Mar 2015

sorry for my English writing ... but I wanted to know if you can stop a trendline after an input. I tried to write the following code but it does not work. How can you do?
if(MarketPosition= -1) then begin
if BarsSinceEntry=1 then
tl_setend(tlUP,date[0],time[0],entryprice);
end;
Regards
Mauro
You have to describe your problem in more detail.

What do you mean by "...but it does not work"?

At the minimum, you have to draw a diagram to illustrate what you want to do,
and what is the stumbling block?

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

Re: End tl after entry .. is possible ?

Postby TJ » 26 Mar 2015

ps.
[FAQ] How to Post Codes (that people can read)
viewtopic.php?f=16&t=11713

maubonvi
Posts: 16
Joined: 26 Sep 2014

Re: End TrendLine after entry .. is possible ?

Postby maubonvi » 27 Mar 2015

ok .. thanks TJ .. let me explain better ....in attached, I send an image of the chart and explanations of what I would do.
That is, end the trendline after making an entrance Long or Short.

The code I wrote is:

Code: Select all

if(MarketPosition= -1) then begin
if BarsSinceEntry=1 then
tl_setend(tlUP,date[0],time[0],entryprice);
end;
...but it does not work, in the sense that even after making an 'entry, the trendline is not terminated.
Is it possible do it?

Regards

Mauro
Attachments
CutTrendLine.JPG
(67.6 KiB) Downloaded 389 times

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: End TrendLine after entry .. is possible ?

Postby JoshM » 27 Mar 2015

That is, end the trendline after making an entrance Long or Short.

The code I wrote is:

Code: Select all

if(MarketPosition= -1) then begin
if BarsSinceEntry=1 then
tl_setend(tlUP,date[0],time[0],entryprice);
end;
If the trend line should also be extended after making a new enter long trade, checking for just `MarketPosition = -1` is not sufficient (since that will only check for short).

I would adjust the above code snippet to:

Code: Select all

if (MarketPosition(0) <> 0) and (BarsSinceEntry(1) = 1) then begin

TL_SetEnd(tlUP, Date[0], Time[0], EntryPrice(1));

end;
If you have a reproducible code example, we can offer more help.

maubonvi
Posts: 16
Joined: 26 Sep 2014

Re: End tl after entry .. is possible ?

Postby maubonvi » 27 Mar 2015

Thanks JoshM,
letting loose the code that I wrote, I would like to know if there is a way to stop/break the trendline just made an 'entry. (see the attached image file to the previous post)

thanks

Regards

Mauro


Return to “MultiCharts”