Welcome to the Traders Laboratory Forums.
Coding Forum Collaborate, receive help, or discuss coding related issues.

Reply
Old 11-02-2009, 06:11 AM   #1

simterann22's Avatar

Join Date: May 2009
Location: Sydney
Posts: 64
Ignore this user

Thanks: 42
Thanked 51 Times in 20 Posts

Question Help with Plotting Close T/L on Each New Bar

Hi all,

I was watching a vid from TradeGuider.com and liked the way their charts plotted a horizontal trendline at the value of every current tick. Here is the code I was playing with:

Code:
Vars:
	mytime(0),
	mydate(0);
If barnumber=1 then begin
	mytime=time;
	mydate=date;
end;


Variables: ID(0);

if lastbaronchart then begin

 ID = TL_New(MyDate, MyTime, Close, Date, Time, Close); 
 Value1 = TL_SetExtRight(ID, True);

"a condition here".................TL_Delete(ID);

 end;
This is exactly what I wanted it to do (partially) : It would plot a trendline at the current tick value. So for example the T/L would move with the tick value of each bar as it ticked back and forth. On a 60min chart this would happen up to say 200 or more times.....great.....BUT. The problem is that when the chart plots a new bar, a T/L remains from the last close value for the previous bar. So if you were using a 1min chart then a T/L would remain every 1 minute. I wanted the T/L to move to the next bar and only plot the current bar's current value.

I'm assuming that the 'lastbaronchart' may not need to be used. This was used to test the recent activity of the T/L. I also played with barnumber<>barnumber[1] parameters to delete previuos T/Ls but since T/Ls were plotted more than once per bar this did not seem to work. Any ideas?

Thanks in advance,

Sim.
simterann22 is offline  
Reply With Quote
Old 11-02-2009, 07:11 AM   #2

Blu-Ray's Avatar

Join Date: Nov 2006
Location: England
Posts: 508
Ignore this user

Thanks: 164
Thanked 292 Times in 105 Posts

Re: Help with Plotting Close T/L on Each New Bar

Hi Sim

Here you go, try this :

Code:
Variables:
	mytime(0),mydate(0),ID(0),OldID(0);

If barnumber=1 then begin
	mytime=time;
	mydate=date;
end;

If TL_Exist(OldID) then TL_Delete(OldID);

if lastbaronchart then begin

ID = TL_New(MyDate, MyTime, Close, Date, Time, Close); 
Value1 = TL_SetExtRight(ID, True);

OldID = ID;

 end;
As you can see in the code.... I've put the TL Delete function before you plot your new TL and also before the lastbaronchart bracket, so it will always delete the previous ticks trendline no matter if the bars change.

Hope this helps

Blu-Ray
__________________

“ Search is the ultimate expression of the power of the individual, using a computer, looking at the world, and finding exactly what they want ” – Eric Schmidt, Google

Last edited by Blu-Ray; 11-02-2009 at 07:18 AM.
Blu-Ray is offline  
Reply With Quote
The Following User Says Thank You to Blu-Ray For This Useful Post:
aaa (11-07-2009)
Old 11-03-2009, 08:05 AM   #3

simterann22's Avatar

Join Date: May 2009
Location: Sydney
Posts: 64
Ignore this user

Thanks: 42
Thanked 51 Times in 20 Posts

Re: Help with Plotting Close T/L on Each New Bar

Hey, thanks a lot Blu-Ray.....you're always a champion in my eyes! Best regards.
simterann22 is offline  
Reply With Quote
The Following User Says Thank You to simterann22 For This Useful Post:
Blu-Ray (11-03-2009)

Reply

Tags
trendline

Thread Tools
Display Modes Help Others By Rating This Thread
Help Others By Rating This Thread:


Similar Threads
Thread Thread Starter Forum Replies Last Post
Paintbar Plotting chrisleonard Coding Forum 8 10-02-2009 12:50 PM
Anyway to Plot an Indicator Value Without Actually Plotting It? daedalus Coding Forum 3 04-24-2009 11:43 PM
Plotting Globex High and Low brownsfan019 Open E Cry 3 03-26-2009 06:38 AM
Can Someone Tell Me How to Get an Indicator to Stop Plotting shortski Coding Forum 31 02-08-2009 12:49 PM
Plotting Market Profile on TS dah7 Market Profile 9 03-16-2007 09:49 PM

All times are GMT -4. The time now is 09:25 AM.
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
CS to VB integration by DeskLancer
©2006-2011 Traders Laboratory, All Rights Reserved.