Page 1 of 1

End tl after entry .. is possible ?

Posted: Mar 26 2015
by maubonvi
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

Re: End tl after entry .. is possible ?

Posted: Mar 26 2015
by TJ
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?

Re: End tl after entry .. is possible ?

Posted: Mar 26 2015
by TJ
ps.
[FAQ] How to Post Codes (that people can read)
viewtopic.php?f=16&t=11713

Re: End TrendLine after entry .. is possible ?

Posted: Mar 27 2015
by maubonvi
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

Re: End TrendLine after entry .. is possible ?

Posted: Mar 27 2015
by JoshM
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.

Re: End tl after entry .. is possible ?

Posted: Mar 27 2015
by maubonvi
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