current price line

post your indicators here

Moderator: moderators

User avatar
michal.kreslik
rank: 1000+ posts
rank: 1000+ posts
Posts: 1032
Joined: Sat May 13, 2006 2:40 am
Reputation: 0
Location: Monte Carlo, Monaco
Real name: Michal Kreslik
Gender: Male
Contact:

current price line

Postby michal.kreslik » Wed May 17, 2006 4:44 pm

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;
Attachments
current_price_line.jpg
current_price_line.jpg (27.52 KiB) Viewed 695 times
CURRENT_PRICE_LINE.ELD
(4.57 KiB) Downloaded 88 times

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.

User avatar
eagles
rank: <50 posts
rank: <50 posts
Posts: 28
Joined: Mon May 22, 2006 6:38 pm
Reputation: 0
Location: Plano, TX
Gender: Male

Postby eagles » Mon May 22, 2006 9:38 pm

Michal,
I have tried this, and I can't seem to get anything to plot. Not sure what is happening?

Regards,
Jack

User avatar
michal.kreslik
rank: 1000+ posts
rank: 1000+ posts
Posts: 1032
Joined: Sat May 13, 2006 2:40 am
Reputation: 0
Location: Monte Carlo, Monaco
Real name: Michal Kreslik
Gender: Male
Contact:

Postby michal.kreslik » Mon May 22, 2006 10:03 pm

eagles,

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

Does Tradestation verify the code correctly?

User avatar
eagles
rank: <50 posts
rank: <50 posts
Posts: 28
Joined: Mon May 22, 2006 6:38 pm
Reputation: 0
Location: Plano, TX
Gender: Male

Postby eagles » Tue May 23, 2006 3:48 pm

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
Attachments
CPL.ELD
Modified from original to add other color change options.
(6.26 KiB) Downloaded 52 times

troller
rank: <50 posts
rank: <50 posts
Posts: 1
Joined: Sat Jan 20, 2007 9:44 pm
Reputation: 0
Gender: None specified

Postby troller » Sat Jan 20, 2007 10:06 pm

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 ?

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.

User avatar
michal.kreslik
rank: 1000+ posts
rank: 1000+ posts
Posts: 1032
Joined: Sat May 13, 2006 2:40 am
Reputation: 0
Location: Monte Carlo, Monaco
Real name: Michal Kreslik
Gender: Male
Contact:

Postby michal.kreslik » Sat Jan 20, 2007 11:59 pm

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

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.


Return to “Tradestation indicators”