Page 1 of 1

current price line

Posted: Wed May 17, 2006 4:44 pm
by michal.kreslik
Hello,

are you using bar charts (not candles) and often wonder where the current price is? With bar charts, the right "tick" line is so tiny that sometimes it is almost impossible to have a quick reference on where the hell the closing price within the bar is :shock:

Well, no more, !_current_price_line indicator will show you that:

Horizontal line is plotted at the current closing price level and changes with the price change. You can set the color of the line when the price is higher, lower or same as the opening price of the bar. You can also set whether you want to plot the line to the left, to the right or to both sides of the bar for better visibility.

ELD file attached below.

Michal

Code: Select all

{
   program name: current price trendline
   last change: May/17/2006
   version: 1.02
   author: Michal Kreslik
   email: michal.kreslik@kreslik.com
   comments:
      intended for bar charts to help
      visually spot where the current price is
}

inputs:
   iDownColor( red ),
   iUpColor( green ),
   iNoChangeColor( lightgray ),
   iDrawToTheRight( true ),
   iDrawToTheLeft( true );

vars:
   vTrendLineID( 0 ),
   vTrendLineAction1( 0 ),
   vTrendLineAction2( 0 ),
   vTrendLineAction3( 0 );
   

If LastBarOnChart then
   begin
      vTrendLineID = TL_New(date, time, close, date, time, close);

      if iDrawToTheRight then
         vTrendLineAction1 = TL_SetExtRight(vTrendLineID, true);
      if iDrawToTheLeft then
         vTrendLineAction2 = TL_SetExtLeft(vTrendLineID, true);

      if close = open then TL_SetColor(vTrendLineID, iNoChangeColor);
      if close > open then TL_SetColor(vTrendLineID, iUpColor);
      if close < open then TL_SetColor(vTrendLineID, iDownColor);

      if vTrendLineID[1] > 0 AND vTrendLineID <> vTrendLineID[1] then
         vTrendLineAction3 = TL_Delete(vTrendLineID[1]);
   end;

Posted: Mon May 22, 2006 9:38 pm
by eagles
Michal,
I have tried this, and I can't seem to get anything to plot. Not sure what is happening?

Regards,
Jack

Posted: Mon May 22, 2006 10:03 pm
by michal.kreslik
eagles,

have you imported the attached ELD file or did you paste the text from the code-box?

Does Tradestation verify the code correctly?

Posted: Tue May 23, 2006 3:48 pm
by eagles
Actually, I did both. It appears I had an issue with the LastBaronChart function. It is working now.

I have taken the liberty to modify your code to compare the current price to other data points. Attached file is renamed to "Current Price Line"

There are 3 inputs to set one to true, the other 2 to false.

NOTE:This must be done manually, as I didn't see an easy way to make a 3 choice selection in the inputs. (And too lazy to look very hard).

iDayMidpoint - Current price color change based on level relative to yesterday's midpoint. (Might be useful for Milk the Cow stuff)
iBarOpen - original indicator
iLastClose - Current price color change based on level relative to close[1]

Thanks for doing the hard stuff with the Trend Lines. Their coding seems particularly painful to me.

Regards,
Jack

Posted: Sat Jan 20, 2007 10:06 pm
by troller
Hi
I can't get this to work either. It verifies but nothing shows on chart. I am useing TS2000i and I copied and pasted to easylanguage editor. Will it work on TS2000i ?

Posted: Sat Jan 20, 2007 11:59 pm
by michal.kreslik
I'm not sure, I wrote it for Tradestation 8.1 and it worked fine with that.

I'm not using Tradestation any more, though.

Michal