NexusFi: Find Your Edge


Home Menu

 





Volume Chart Trend Lines


Discussion in TradeStation

Updated
    1. trending_up 2,080 views
    2. thumb_up 2 thanks given
    3. group 2 followers
    1. forum 0 posts
    2. attach_file 0 attachments




 
Search this Thread

Volume Chart Trend Lines

  #1 (permalink)
madeinnyc
Highland Park, TX
 
Posts: 36 since Jan 2020
Thanks Given: 17
Thanks Received: 20

I use volume charts, but it's hard to tell when an individual bar hits a high/lo during its oscillation period. I wanted a visual horizontal line that plotted the high/lo of each bar and then removes the previous horizontal line at the start of the next bar...and the process repeats all over again. I've been tinkering with some ideas and here's what I found:

TS has a built-in indicator "Line at Price". Set to high/low, it begins it range calculation immediately upon a new bar forming and as the price oscillates so do the high/low points, which makes it difficult to tell if its really hit a high/low for the active bar. It was confusing to use so scratch! I was actually thinking more like this:

If the current price is GREATER than the MIDPOINT of the developing bar then
show (LOW plus Maximum Bar Range minus Current Price).

If the current price is EQUAL to the MIDPOINT of the developing bar then
show the MIDPOINT value as dot.

If the current price is LESS THAN the MIDPOINT of the developing bar then
show (High minus Maximum Bar Range plus the Current Price).


So here's the code that:


 
Code
[LegacyColorValue = false];

inputs: MidColor(rgb(150,150,150)), Upcolor(rgb(100,255,150)), Dncolor(rgb(238,50,50)),decimal(2);

vars:
rangevalue(0),
halfpoint(0),
Remaining(0),
str(" "),
ID(-1);

// Determine the Range of the Range bars:
If barnumber = 2 then rangevalue = range[1];

// Determine the Half point of the developing bar:
halfpoint = (((H - L) *0.5)+L);

// Find Remaining value depending upon where the current close is in relation to the Half Point:
If C > halfpoint then
Remaining = (L+rangevalue)-C;
If C = halfpoint then
Remaining = rangevalue *.5;
If C < halfpoint then
Remaining = (H-rangevalue)-C;

// Print the Remaining Value next to the current closing price:
If barnumber = 1 then // write the text on the first bar
ID = text_new(date,calctime(time,(barinterval*3)),close,str)
else begin // and update that text rather than erase and redraw. More efficient.
text_setstring(ID,numtostr(Remaining,decimal));
text_setlocation(ID,date,calctime(time,(barinterval*3)),close);
end;

// Set the color based upon where the current close is in relation to the Half Point:
If close > halfpoint then
text_SetColor(ID,UPColor);
If close = halfpoint then
text_SetColor(ID,MidColor);
If close < halfpoint then
text_SetColor(ID,DNColor);
And here's the code to add the horizontal line to Range High and Low. But the TL_Delete would have be used to remove the previous horizontal line. I think these trend lines can be deleted with a statement like:

 
Code
Value = TL_Delete( TLrangelo ) ;
Value = TL_Delete( TLrangeHi ) ;


TLrangelo = TL_New( Date, Time, rangelo, Date, SessionEndTime(1, 1), rangelo ) ;
TL_SetColor( TLrangelo, (rgb(238,130,238))) ;
TL_SetStyle( TLrangelo, Tool_Dotted ) ;

TLrangeHi = TL_New( Date, Time, rangeHi, Date, SessionEndTime(1, 1), rangeHi) ;
TL_SetColor( TLrangeHi , (rgb(238,130,238))) ;
TL_SetStyle( TLrangeHi , Tool_Dotted ) ;
As much as I like this code, I don't think it works on a volume based chart. Please correct me if I'm wrong!

So then I thought instead of deleting previously drawn trend lines, a better approach would be to update the beginning and ending points as new bars are formed. Hmm, so I gave this some thought and with some help instead of using trend-lines, how about Displace Horizontal Plots? A benefit to this approach is that the line values can be set to appear in the price axis.

Would like some feedback on what you guys think of this study:

 
Code
using elsystem; 
 
inputs: 
	HighColor(Green), 
	LowColor(Red), 
	PlotBarsRight(5), 
	PlotBarsLeft(0);   
 
variables: 
	BarsRight( MinList( GetAppInfo(aiSpaceToRight), PlotBarsRight ) ), 
	BarsLeft( MaxList( 0, PlotBarsLeft ) ), 
	Idx(0); 
 
if LastBarOnChartEx then 
begin 
 
	for Idx = -BarsLeft to BarsRight 
	begin 
		Plot1[-Idx](Low + Range[1], "High", HighColor); 
		Plot2[-Idx](Low - Range[1], "Low", LowColor); 
	end; 
	 
	SetPlotColor[BarsLeft + 1](1, Transparent); 
	SetPlotColor[BarsLeft + 1](2, Transparent); 
 
end;
If you plan to use this code, be sure to set scaling at 1.

Reply With Quote
Thanked by:




Last Updated on July 1, 2020


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts