feature request - quoteboards

Questions about MultiCharts and user contributed studies.
User avatar
arnie
Posts: 1594
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

feature request - quoteboards

Postby arnie » 23 Jan 2013

Hi.

Just created a new feature request.
How many of you would like the ability to look at your symbols this way?

Image

Please vote (MC-1228)
Attachments
quoteboards.png
(29.82 KiB) Downloaded 2095 times

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: feature request - quoteboards

Postby JoshM » 23 Jan 2013

How many of you would like the ability to look at your symbols this way?
Since you asked, I don't. :) It looks nice for sure, but I don't see much value added compared with the market scanner, which shows the information horizontal compared with the vertical representation in your image.

Perhaps an update for the market scanner would be a better (i.e., more efficient) idea than the creation of a new quote board functionality from scratch.

User avatar
arnie
Posts: 1594
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

Re: feature request - quoteboards

Postby arnie » 23 Jan 2013

How many of you would like the ability to look at your symbols this way?
Since you asked, I don't. :) It looks nice for sure, but I don't see much value added compared with the market scanner, which shows the information horizontal compared with the vertical representation in your image.

Perhaps an update for the market scanner would be a better (i.e., more efficient) idea than the creation of a new quote board functionality from scratch.
LOL

The value is one, visually you are able to see the candle for the day without having a chart opened.
You can easily see what prices did or are doing through the bar instead of 4 prices displayed horizontally among dozens of other symbols and other numbers.

This is a much more "clean" way to simply follow/show quotes.

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: feature request - quoteboards

Postby TJ » 23 Jan 2013

Hi.

Just created a new feature request.
How many of you would like the ability to look at your symbols this way?

Image

Please vote (MC-1228)
This screen can be coded as an indicator... will take some time tho.

User avatar
arnie
Posts: 1594
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

Re: feature request - quoteboards

Postby arnie » 23 Jan 2013

TJ's message has some truth in it.

After a couple of copy/paste between some studies I was able to create this simple homemade quoteboard.

Image

Now, a couple of problems arise.
The location of each box is not an easy task. I was able to align them but was not easy. As soon you change the window size things get messy and you need to change the ShiftText input.
But the biggest problem now is how to add the arrow indicating the lastest tick, up or down? How to align each arrow to each box? And the candle? How can we create the candle side by side with each box and align it?

It would be nice to have the possibility to set the text color inside the text_setstring keyword.

Here is the code:

Code: Select all

//1st version : 01-23-2013
// MC forum thread : http://www.multicharts.com/discussion/viewtopic.php?f=1&t=11804&p=58081#p58081


inputs:
ShiftText (1),
LabelLocation (2), // 1 = top left | 2 = top right
MyDecimals (2),
LabelSize (9),
LabelColor (white),
LabelFont ("Lucida Sans Typewriter");

variables:
databoxTXT (-1),
textShift (0),
timeOffSet (ELTimeToDateTime(1)),
dTick (MinMove/PriceScale),
stDate (false),
hasDayOpen (false),
dailyHi (0),
dailyLo (0),
dailyOp (0),
dailyCl (0),
changePct (0),
changePrice (0),
intrabarpersist lastPrice (0);

if currentbar = 1 then begin
dataBoxTXT = Text_new_s(JulianToDate(aiLeftDispDateTime), GetAppInfo(aiLeftDispDateTime), GetAppInfo(aiHighestDispValue) - textShift,"");
text_setfontname(dataBoxTXT , LabelFont);
text_setcolor(dataBoxTXT , LabelColor);
text_setsize(dataBoxTXT , LabelSize);
Text_SetStyle(dataBoxTXT , iff(labelLocation = 1, 0, 1), 0);
text_setborder(dataBoxTXT, true);
text_setbgcolor(dataBoxTXT, black);

textShift = shiftText * dTick;
end;

dailyCl = close[1];

if date <> date[1] then begin
stDate = true;
dailyHi = -999999;
dailyLo = +999999;
hasDayOpen = false;
end;

if stDate then begin
if High > dailyHi then
dailyHi = High;
if Low < dailyLo then
dailyLo = Low;

lastPrice = close;

if hasDayOpen = false then begin
hasDayOpen = true;
dailyOp = Open;
end;

if dailyCl <> 0 then
changePct = ((lastPrice / dailyCl) - 1) * 100;

changePrice = lastPrice - dailyCl;

text_setstring(dataBoxTXT, " < " + text(getsymbolname) + " > " + NewLine +
" OP - " + NumToStr(dailyOp, MyDecimals) + " " + NewLine +
" HI - " + NumToStr(dailyHi, MyDecimals) + " " + NewLine +
" LO - " + NumToStr(dailyLo, MyDecimals) + " " + NewLine +
" CL - " + NumToStr(lastPrice, MyDecimals) + " " + NewLine +
" % - " + NumToStr(changePct, 2) + "%" + NewLine +
" CH - " + NumToStr(changePrice, MyDecimals) + "pt");

if BarStatus(1) = 2 then begin
if LabelLocation = 1 then
Text_SetLocation_s(dataBoxTXT, JulianToDate(GetAppInfo(aileftDispDateTime)),DateTime2ELTime_s(GetAppInfo(aileftDispDateTime) +
timeOffSet), GetAppInfo(aiHighestDispValue) - textshift)
else
Text_SetLocation_s(dataBoxTXT, JulianToDate(GetAppInfo(airightDispDateTime)),DateTime2ELTime_s(GetAppInfo(airightDispDateTime) -
timeOffSet), GetAppInfo(aiHighestDispValue) - textshift);
end;
end;


Attachments
mc_quoteboard.png
(15.35 KiB) Downloaded 2097 times

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: feature request - quoteboards

Postby TJ » 23 Jan 2013

TJ's message has some truth in it.
...
Some truth only? Not the whole truth? ;-)

Thanks for sharing the code. You are a true community leader.
(you are quick too!)

A tip:
For alignment, best to use % of the screen.
Find out the left/right margin date/time, and the top/bottom price,
then work out a percentage from there.

eg. bottom price = 0% and top price = 100%

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: feature request - quoteboards

Postby TJ » 23 Jan 2013

Tip #2:

NewLine can be written as \n

Code: Select all

" OP - " + NumToStr(dailyOp, MyDecimals) + " " + NewLine +
to:

Code: Select all

" OP - " + NumToStr(dailyOp, MyDecimals) + " \n" +

Same operation;
NewLine is easier to understand when you re-read your code,
writing \n is faster when you need to code a lot.

User avatar
arnie
Posts: 1594
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

Re: feature request - quoteboards

Postby arnie » 24 Jan 2013

Some truth only? Not the whole truth? ;-)
:P
Thanks for sharing the code. You are a true community leader.
(you are quick too!)
It was all about copy/paste snippets of code.
I have a bit of ABC's code, JoshM's, TJ's... nothing of mine own really.
A tip:
For alignment, best to use % of the screen.
Find out the left/right margin date/time, and the top/bottom price,
then work out a percentage from there.

eg. bottom price = 0% and top price = 100%
I'm gonna try that % of the screen.

User avatar
arnie
Posts: 1594
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

Re: feature request - quoteboards

Postby arnie » 24 Jan 2013

So I made a couple of changes.

Aligning the boxes on a vertical position seems to be the better way to achieve my goals.
I tweaked the text_FloatLocation function so it could plot the boxes the way I want.

Image

Code: Select all

// 1st version : 01-23-2013
// 2nd version : 01-24-2013
// Change the way the box location is set
// 2 boxes for each set of data
// text_FloatLocation function was tweaked and saved as text_FloatQuoteboard
// MC forum thread : http://www.multicharts.com/discussion/viewtopic.php?f=1&t=11804&p=58081#p58081


inputs:
DataBoxLocation (90), // set as percentage
VariBoxLocation (84), // set as percentage
BoxColor (rgb(30,30,30)),
SetDataBoxEndSpace (2), // align box end
SetVariBoxEndSpace (2), // align box end
MyDecimals (2),
DataLabelColor (white),
VariLabelUpColor (green),
VariLabelDnColor (red),
ShowBoxBorder (false),
LabelSize (9),
LabelFont ("Lucida Sans Typewriter");

variables:
databoxTXT (-1),
varBoxTXT (-1),
textShift (0),
stDate (false),
hasDayOpen (false),
dailyHi (-999999),
dailyLo (+999999),
dailyOp (0),
dailyCl (0),
prevDailyCl (0),
changePct (0),
changePrice (0),
intrabarpersist lastPrice (0);

if currentbar = 1 then begin
dataBoxTXT = Text_new_s(date, time_s, high,"");
text_setfontname(dataBoxTXT , LabelFont);
text_setcolor(dataBoxTXT , DataLabelColor);
text_setsize(dataBoxTXT , LabelSize);
text_setborder(dataBoxTXT, ShowBoxBorder);
text_setbgcolor(dataBoxTXT, boxColor);

varBoxTXT = Text_new_s(date, time_s, high,"");
text_setfontname(varBoxTXT , LabelFont);
text_setsize(varBoxTXT , LabelSize);
text_setborder(varBoxTXT , ShowBoxBorder);
text_setbgcolor(varBoxTXT , boxColor);
end;

if date <> date[1] then begin
stDate = true;
dailyHi = -999999;
dailyLo = +999999;
hasDayOpen = false;
dailyCl = close[1];
end;

if stDate then begin
if High > dailyHi then
dailyHi = High;
if Low < dailyLo then
dailyLo = Low;

lastPrice = close;

if hasDayOpen = false then begin
hasDayOpen = true;
dailyOp = Open;
end;

if dailyCl <> 0 then
changePct = ((lastPrice / dailyCl) - 1) * 100;

changePrice = lastPrice - dailyCl;

// DataBox
text_setstring(dataBoxTXT, " < " + text(getsymbolname) + " > " + NewLine +
spaces(1) + " OP | " + NumToStr(dailyOp, MyDecimals) + spaces(SetDataBoxEndSpace) + NewLine +
spaces(1) + " HI | " + NumToStr(dailyHi, MyDecimals) + spaces(SetDataBoxEndSpace) + NewLine +
spaces(1) + " LO | " + NumToStr(dailyLo, MyDecimals) + spaces(SetDataBoxEndSpace) + NewLine +
spaces(1) + " CL | " + NumToStr(lastPrice, MyDecimals) + spaces(SetDataBoxEndSpace)) ;

// Set color for VariBox
if lastPrice > dailyCl then
text_setcolor(varBoxTXT , VariLabelUpColor)
else
text_setcolor(varBoxTXT , VariLabelDnColor);

// VariBox
text_setstring(varBoxTXT , spaces(1) + " % | " + NumToStr(changePct, 2) + spaces(SetVariBoxEndSpace) + NewLine +
spaces(1) + " CH | " + NumToStr(changePrice, MyDecimals) + spaces(SetVariBoxEndSpace)) ;

// Plot both boxes
text_FloatQuoteboard(dataBoxTXT, DataBoxLocation);
text_FloatQuoteboard(varBoxTXT, VariBoxLocation);

end;



Attachments
mc_quoteboard02.png
(19.77 KiB) Downloaded 2064 times

User avatar
arnie
Posts: 1594
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

Re: feature request - quoteboards

Postby arnie » 24 Jan 2013

I need some help here.
How can I "separate" the background size from the total number of characters?

Every time I get one more or one less character the background size changes., which is pretty annoying.

Image
Attachments
one less character.png
(7.12 KiB) Downloaded 2110 times

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: feature request - quoteboards

Postby TJ » 24 Jan 2013

I need some help here.
How can I "separate" the background size from the total number of characters?

Every time I get one more or one less character the background size changes., which is pretty annoying.
You can add spaces to line up the decimal points.

SP
Posts: 465
Joined: 06 Feb 2006
Has thanked: 36 times
Been thanked: 286 times

Re: feature request - quoteboards

Postby SP » 25 Jan 2013

You could change the line to:

Code: Select all

// VariBox
text_setstring(varBoxTXT , spaces(1) + " % | " + NumToStr(changePct, 2) +
Spaces(StrLen (NumToStr(changePrice, MyDecimals)) - StrLen( NumToStr(changePct, 2)) )+
spaces(SetVariBoxEndSpace) + NewLine +
spaces(1) + " CH | " + NumToStr(changePrice, MyDecimals) +
Spaces(StrLen (NumToStr(lastPrice, MyDecimals)) - StrLen( NumToStr(changePrice, MyDecimals)) )+ spaces(SetVariBoxEndSpace)) ;


User avatar
arnie
Posts: 1594
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

Re: feature request - quoteboards

Postby arnie » 25 Jan 2013

You could change the line to:

Code: Select all

// VariBox
text_setstring(varBoxTXT , spaces(1) + " % | " + NumToStr(changePct, 2) +
Spaces(StrLen (NumToStr(changePrice, MyDecimals)) - StrLen( NumToStr(changePct, 2)) )+
spaces(SetVariBoxEndSpace) + NewLine +
spaces(1) + " CH | " + NumToStr(changePrice, MyDecimals) +
Spaces(StrLen (NumToStr(lastPrice, MyDecimals)) - StrLen( NumToStr(changePrice, MyDecimals)) )+ spaces(SetVariBoxEndSpace)) ;

Working on it...

User avatar
arnie
Posts: 1594
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

Re: feature request - quoteboards

Postby arnie » 25 Jan 2013

SP, I believe you've nail it!
Just need to make a couple more tests but so far it's like this:

Image
Attachments
mc_quoteboard03.png
(26.83 KiB) Downloaded 2079 times

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: feature request - quoteboards

Postby TJ » 25 Jan 2013

SP, I believe you've nail it!
Just need to make a couple more tests but so far it's like this:
...
Looking AMAZINGLY good !

This just shows to everybody, MultiCharts is one powerful tool. If you put your mind to it, you can make impossibles happen.

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: feature request - quoteboards

Postby JoshM » 25 Jan 2013

Looking AMAZINGLY good !
Indeed, very impressive!

(Sorry, not much else to add. Just wanted to say how good it looks. ;) )

User avatar
arnie
Posts: 1594
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

Re: feature request - quoteboards

Postby arnie » 25 Jan 2013

Hey JoshM, just remembered, what about you build this on the .NET? ;)
I'm sure that the platform allows you to build the bar on the right side of the box.
Last edited by arnie on 27 Jan 2013, edited 1 time in total.

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: feature request - quoteboards

Postby JoshM » 26 Jan 2013

Hey JoshM, just remembered, what about you build this on the .NET? ;)
I'm sure that the platform allows you to build the bar on the right side of the box.
I suppose it also can be done on the .NET, just not yet by me. ;) (lack of skills)

Perhaps a substitute for a bar for this indicator can be made with regular keyboards signs? This would require to calculate where the current price is in relation to the daily high and low, and then plot something like..

Near the upper range:
  • |
    ++
    ||
    ||
    ||
    ||
    |
Near the lower range:
  • |
    |
    ||
    ||
    ||
    ++
    |
But that's not very pretty I'm afraid.

SP
Posts: 465
Joined: 06 Feb 2006
Has thanked: 36 times
Been thanked: 286 times

Re: feature request - quoteboards

Postby SP » 26 Jan 2013

I would love to have the bar for the day but that is really outside of my programming capabilities and I really can't see how that can be done when we are overlaying several data series here.
You could create two vertical trendlines, the thicker one for the candle body and the thinner for the wicks.

For example add :

Code: Select all

vars: candle (0), candlebody(0),HighestDispValue(0),LowestDispValue(0),
dayRange(0),hi(0),lo(0), bottom(0),top(0),ito(0),itc(0);

HighestDispValue = GetAppInfo(aiHighestDispValue);
LowestDispValue = GetAppInfo(aiLowestDispValue);

hi = dailyHi;
lo = dailyLo;
dayRange = hi - lo;
top = LowestDispValue + 0.0111*VariBoxLocation* (HighestDispValue - LowestDispValue);
bottom = LowestDispValue + 0.0099*VariBoxLocation* (HighestDispValue - LowestDispValue);

itc = (( lastPrice - dailyLo ) / dayRange ) * (top-bottom) + bottom;
ito = (( dailyOp - dailyLo ) / dayRange ) * (top-bottom) + bottom;

tl_delete (candle); tl_delete (candlebody);

candle = tl_new_s (date,time_S,bottom, date,time_S, top);

candlebody= tl_new_s (date,time_S, ito , date,time_S, itc );

tl_setsize (candle, 3 );
tl_setcolor(candle,darkgray);

tl_setsize (candlebody, 6 );
if lastPrice > dailyCl then
tl_setcolor(candlebody, VariLabelUpColor)
else
tl_setcolor(candlebody, VariLabelDnColor);
Image

You need to adjust the date and time settings to your text_FloatQuoteboard date and time settings.
Attachments
Quoteboard.jpg
(3.88 KiB) Downloaded 2026 times

User avatar
arnie
Posts: 1594
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

Re: feature request - quoteboards

Postby arnie » 26 Jan 2013

WOW!

Working on it...

User avatar
arnie
Posts: 1594
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

Re: feature request - quoteboards

Postby arnie » 26 Jan 2013

SP... you are the MAN!

Image

Now I only need to fix the bug...

Markets should be closed, not open.
Attachments
mc_quoteboard04.png
(28.15 KiB) Downloaded 2079 times

User avatar
arnie
Posts: 1594
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

Re: feature request - quoteboards

Postby arnie » 27 Jan 2013

A big THANK YOU must be given to SP and his candle. His code really made this study shine. I'm really happy how this looks like.

A lot more calculations can now be made and included on each box but that is something outside of the scope of this study. I just wanted a simple way to have the quotes for the day.
Personally, I consider a quoteboard such as this much easier to look at than the Scanner.

If your goal is just to have your favorite indices, stocks, commodities, currencies in handy for a quick look, this is definitely the way to go.

I was having a problem with the open/close status since the close would not be triggered as it was supposed to but I believe this has been fixed. At least all seems to be working fine when playing back the data.


Regards.
Fernando

Code: Select all

{-------------------------------------------------------------------------------------------------}

// Fernando Santos
// MC forum thread : http://www.multicharts.com/discussion/viewtopic.php?f=1&t=11804

// 1st version : 01-23-2013
// 2nd version : 01-24-2013
// SP (forum member), wrote lines 204 till 208 for a better box alignment
// 3rd version : 01-27-2013
// SP (forum member), wrote the candle drawing code
// embed the text_FloatLocation function for better text and trendline management
// there's a time input for set the exchange close time so we can have an open/close status

{-------------------------------------------------------------------------------------------------}

inputs:
DataBoxLocation (90), // set as percentage
VariBoxLocation (84), // set as percentage
BoxColor (rgb(30,30,30)),
SetDataBoxEndSpace (2), // align box
SetVariBoxEndSpace (2), // align box
MyDecimals (2),
DataLabelColor (white),
VariLabelUpColor (green),
VariLabelDnColor (red),
ShowBoxBorder (false),
SessionCloseTime (1515), // time at which the regular trading hour session close
CloseLabelColor (rgb(81,81,81)),
ShowStatus (false), // show open or close label
ShowCandle (false),
LabelSize (9),
LabelFont ("Lucida Sans Typewriter");

variables:
databoxTXT (-1),
variBoxTXT (-1),
statusTXT (-1),
textShift (0),
stDate (false),
hasDayOpen (false),
dailyHi (-999999),
dailyLo (+999999),
dailyOp (0),
dailyCl (0),
prevDailyCl (0),
changePct (0),
changePrice (0),
closeTime (0),
intrabarpersist lastPrice (0),
intrabarpersist DataBox (0.95),
intrabarpersist VariBox (0.95),

candleWick (0),
candleBody (0),
HighestDispValue (0),
LowestDispValue (0),
CloseDispValue (0),
dayRange (0),
hi (0),
lo (0),
bottom (0),
top (0),
ito (0),
itc (0);

if currentbar = 1 then begin
closeTime = TimeToMinutes(sessionCloseTime) * 60;
closeTime = SecondsToTime_s(closeTime);

dataBoxTXT = Text_new_s(date, time_s, high,"");
text_setfontname(dataBoxTXT, LabelFont);
text_setsize(dataBoxTXT, LabelSize);
text_setstyle(dataBoxTXT, 0, 2);
text_setborder(dataBoxTXT, ShowBoxBorder);
text_setbgcolor(dataBoxTXT, boxColor);

variBoxTXT = Text_new_s(date, time_s, high,"");
text_setfontname(variBoxTXT, LabelFont);
text_setsize(variBoxTXT, LabelSize);
text_setstyle(variBoxTXT, 0, 2);
text_setborder(variBoxTXT, ShowBoxBorder);
text_setbgcolor(variBoxTXT, boxColor);

if ShowStatus = true then begin
statusTXT = Text_new_s(date, time_s, high,"");
text_setfontname(statusTXT, LabelFont);
text_setsize(statusTXT, LabelSize);
text_setstyle(statusTXT, 1, 2);
end;
end;

tl_delete (candleWick);
tl_delete (candleBody);

// Vertical percentage position function
if LastBarOnChart_s then begin
HighestDispValue = GetAppInfo(aiHighestDispValue);
LowestDispValue = GetAppInfo(aiLowestDispValue);
CloseDispValue = (Close - LowestDispValue)/(HighestDispValue - LowestDispValue);

if DataBoxLocation = -1 or VariBoxLocation = -1 then begin
if CloseDispValue > 0.6 then begin
DataBox = 0.05;
VariBox = 0.05;
end
else begin
if CloseDispValue < 0.4 then begin
DataBox = 0.95;
VariBox = 0.95;
end;
end;
end
else begin
DataBox = 0.01 * DataBoxLocation;
VariBox = 0.01 * VariBoxLocation;
end;
end;

if date <> date[1] then begin
stDate = true;
dailyHi = -999999;
dailyLo = +999999;
hasDayOpen = false;
dailyCl = close[1];
end;

if stDate then begin
// Set day's high, low and range
if High > dailyHi then
dailyHi = High;
if Low < dailyLo then
dailyLo = Low;
hi = dailyHi;
lo = dailyLo;
dayRange = hi - lo;

lastPrice = close;

// Set open
if hasDayOpen = false then begin
hasDayOpen = true;
dailyOp = Open;
end;

//Candle wick
top = LowestDispValue + (DataBox * (HighestDispValue - LowestDispValue));
bottom = LowestDispValue + (VariBox * (HighestDispValue - LowestDispValue));

// Candle body
if dayRange <> 0 then begin
itc = ((lastPrice - dailyLo) / dayRange) * (top-bottom) + bottom;
ito = ((dailyOp - dailyLo) / dayRange) * (top-bottom) + bottom;
end;

// Candle lines
if ShowCandle = true then begin
candleWick = tl_new_s(date, time_s, bottom, date, time_s, top);
tl_setsize (candleWick, 2);
tl_setcolor(candleWick,lightgray);

candleBody = tl_new_s(date, time_s, ito, date, time_s, itc);
tl_setsize (candleBody, 4);
end;

// Daily variation
if dailyCl <> 0 then
changePct = absvalue(((lastPrice / dailyCl) - 1) * 100);

changePrice = absvalue(lastPrice - dailyCl);

// Set color
if time_s = closeTime and barstatus = 2 then begin
text_setstring(statusTXT , "C \nL \nO \nS \nE");

text_setcolor(variBoxTXT , CloseLabelColor);
text_setcolor(dataBoxTXT , CloseLabelColor);
text_setcolor(statusTXT, white);
tl_setcolor(candleBody, CloseLabelColor);
tl_setcolor(candleWick, CloseLabelColor);
end
else begin
text_setstring(statusTXT , "O \nP \nE \nN");

text_setcolor(dataBoxTXT , DataLabelColor);
text_setcolor(statusTXT, rgb(81,81,81));

if lastPrice > dailyCl then begin
text_setcolor(variBoxTXT , VariLabelUpColor);
tl_setcolor(candleBody, VariLabelUpColor);
end
else begin
text_setcolor(variBoxTXT , VariLabelDnColor);
tl_setcolor(candleBody, VariLabelDnColor);
end;
end;

// DataBox
text_setstring(dataBoxTXT, " < " + text(getsymbolname) + " > " + NewLine +
spaces(1) + " OP |" + " " + NumToStr(dailyOp, MyDecimals) + spaces(SetDataBoxEndSpace) + NewLine +
spaces(1) + " HI |" + " " + NumToStr(dailyHi, MyDecimals) + spaces(SetDataBoxEndSpace) + NewLine +
spaces(1) + " LO |" + " " + NumToStr(dailyLo, MyDecimals) + spaces(SetDataBoxEndSpace) + NewLine +
spaces(1) + " CL |" + " " + NumToStr(lastPrice, MyDecimals) + spaces(SetDataBoxEndSpace)) ;

// VariBox
text_setstring(variBoxTXT , spaces(1) + " % | " + NumToStr(changePct, 2) +
Spaces(StrLen(NumToStr(changePct, 2)) - StrLen(NumToStr(changePrice, 1))) +
spaces(SetVariBoxEndSpace) + NewLine +
spaces(1) + " CH | " + NumToStr(changePrice, MyDecimals) +
Spaces(StrLen (NumToStr(lastPrice, MyDecimals)) - StrLen(NumToStr(changePrice, MyDecimals))) + spaces(SetVariBoxEndSpace)) ;

// Both boxes location
text_setlocation_s(dataBoxTXT, date, time_s, LowestDispValue + (DataBox * (HighestDispValue - LowestDispValue)));
text_setlocation_s(variBoxTXT, date, time_s, LowestDispValue + (VariBox * (HighestDispValue - LowestDispValue)));

// Status location
if ShowStatus = true then
text_setlocation_s(statusTXT, date, time_s, LowestDispValue + (DataBox * (HighestDispValue - LowestDispValue)));
end;




User avatar
arnie
Posts: 1594
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

Re: feature request - quoteboards

Postby arnie » 28 Jan 2013

Pretty cool to see this working live.
I've made a little change for the candle coloring. SP coded it to show the color according to the daily variation but personally I like to see it showing the difference against the open and not the previous day's close.

Image

I've already started working on a new feature for this study.
Actually the new feature is fully implemented although not working when I start to overlay data series. It works fine on a single data series though.

There's some kind of conflict that I was not yet able to figure it out.
Attachments
quoteboards_candle.png
(12.21 KiB) Downloaded 2006 times

User avatar
arnie
Posts: 1594
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

Re: feature request - quoteboards

Postby arnie » 30 Jan 2013

Please help...

The study is working perfectly fine on single data series charts but on multiple data series ones the status Open/Close and the color for the candle are messed up.
Depending of the order the data series are loaded the different the study coloring and status.

Image

Image

Since we're having different starts and closes for each data series the colors and Open/Close status are all over the place.

The alerts, the new feature added, are working fine.

I just can't see how to solve this.
Added line 286 to see if I could force the candle color to change when the symbol close but had no luck.
The problem must be between line 263 and 290 where the colors are set (I also have color settings between line 175 and 187 since I was having the candle body changing color on the last minute/bar for the day).

I've already thought on removing the status and color statements and have it like that but I do like to see everything colored gray when markets are closed and see the Open/Close labels.

There's a .pla and .wsp file on the bottom for download.
I also added the folder with the custom made sounds for each symbol on the study.


Code: Select all

{-------------------------------------------------------------------------------------------------}

// Fernando Santos
// MC forum thread : http://www.multicharts.com/discussion/viewtopic.php?f=1&t=11804

// 1st version : 01-23-2013
// 2nd version : 01-24-2013
// SP (forum member), wrote lines 204 till 208 for a better box alignment
// 3rd version : 01-27-2013
// SP (forum member), wrote the candle drawing code
// embed the text_FloatLocation function for better text and trendline (candle) management
// there's a time input for set the exchange close time so we can have an open/close status
// 4th version : 00-00-0000
// custom sound alerts were added

{-------------------------------------------------------------------------------------------------}

inputs:
DataBoxLocation (90), // set as percentage
VariBoxLocation (84), // set as percentage
BoxColor (rgb(30,30,30)),
SetDataBoxEndSpace (2), // align box
SetVariBoxEndSpace (2), // align box
MyDecimals (2),
DataLabelColor (white),
VariLabelUpColor (green),
VariLabelDnColor (red),
ShowBoxBorder (false),
CloseLabelColor (rgb(81,81,81)),
ShowStatus (true), // show open or close label
ShowCandle (true),
LabelSize (9),
LabelFont ("Lucida Sans Typewriter"),
UseALerts (true),
SessionCloseTime (2115), // time at which the regular trading hour session close
AlertTimeTrigger (5), // minutes to trigger alert prior market close
SymbolAlert ("ES"), // symbol for alerts - ES, NQ, YM, TY, CL, EU
AlertsLocation ("C:\Sounds"); // folder where alerts sounds are

variables:
alertTrigger (0),
isAlertOff (-1),
databoxTXT (-1),
variBoxTXT (-1),
statusTXT (-1),
textShift (0),
isStartDay (false),
isDayOpen (false),
dailyHi (-999999),
dailyLo (+999999),
dailyOp (0),
dailyCl (0),
prevDailyCl (0),
changePct (0),
changePrice (0),
closeTime (0),
intrabarpersist lastPrice (0),
intrabarpersist DataBox (0.95),
intrabarpersist VariBox (0.95),
candleWick (0),
candleBody (0),
HighestDispValue (0),
LowestDispValue (0),
CloseDispValue (0),
dayRange (0),
hi (0),
lo (0),
bottom (0),
top (0),
ito (0),
itc (0);


// Vertical percentage position function
if LastBarOnChart_s then begin
HighestDispValue = GetAppInfo(aiHighestDispValue);
LowestDispValue = GetAppInfo(aiLowestDispValue);
CloseDispValue = (Close - LowestDispValue)/(HighestDispValue - LowestDispValue);

if DataBoxLocation = -1 or VariBoxLocation = -1 then begin
if CloseDispValue > 0.6 then begin
DataBox = 0.05;
VariBox = 0.05;
end
else begin
if CloseDispValue < 0.4 then begin
DataBox = 0.95;
VariBox = 0.95;
end;
end;
end
else begin
DataBox = 0.01 * DataBoxLocation;
VariBox = 0.01 * VariBoxLocation;
end;
end;

// Reminder to enable alerts
If UseALerts = true then begin
If AlertEnabled = False And LastBarOnChart_S then
isALertOff = Text_New_S(Date, Time_S, Low, "Enable alerts at Format Study > Alerts > Enable Alerts");
text_setfontname(isAlertOff, "arial black");
text_setsize(isAlertOff, 16);
text_setcolor(isAlertOff, white);
text_setstyle(isAlertOff, 1, 2);
end;

if currentbar = 1 then begin
closeTime = TimeToMinutes(sessionCloseTime) * 60;
closeTime = SecondsToTime_s(closeTime);
alertTrigger = secondstotime_s((timetominutes(sessionclosetime) * 60) - (alerttimetrigger * 60));

dataBoxTXT = Text_new_s(date, time_s, high,"");
text_setfontname(dataBoxTXT, LabelFont);
text_setsize(dataBoxTXT, LabelSize);
text_setstyle(dataBoxTXT, 0, 2);
text_setborder(dataBoxTXT, ShowBoxBorder);
text_setbgcolor(dataBoxTXT, boxColor);

variBoxTXT = Text_new_s(date, time_s, high,"");
text_setfontname(variBoxTXT, LabelFont);
text_setsize(variBoxTXT, LabelSize);
text_setstyle(variBoxTXT, 0, 2);
text_setborder(variBoxTXT, ShowBoxBorder);
text_setbgcolor(variBoxTXT, boxColor);

if ShowStatus = true then begin
statusTXT = Text_new_s(date, time_s, high,"");
text_setfontname(statusTXT, LabelFont);
text_setsize(statusTXT, LabelSize);
text_setstyle(statusTXT, 1, 2);
end;
end;

tl_delete (candleWick);
tl_delete (candleBody);

if date <> date[1] then begin
isStartDay = true;
dailyHi = -999999;
dailyLo = +999999;
isDayOpen = false;
dailyCl = close[1];
end;

if isStartDay then begin
// Set day's high, low and range
if High > dailyHi then
dailyHi = High;
if Low < dailyLo then
dailyLo = Low;
hi = dailyHi;
lo = dailyLo;
dayRange = hi - lo;

lastPrice = close;

// Set open
if isDayOpen = false then begin
isDayOpen = true;
dailyOp = Open;
end;

// Candle wick
top = LowestDispValue + (DataBox * (HighestDispValue - LowestDispValue));
bottom = LowestDispValue + (VariBox * (HighestDispValue - LowestDispValue));

// Candle body
if dayRange <> 0 then begin
itc = ((lastPrice - dailyLo) / dayRange) * (top-bottom) + bottom;
ito = ((dailyOp - dailyLo) / dayRange) * (top-bottom) + bottom;
end;

// Candle lines
if ShowCandle = true then begin
candleWick = tl_new_s(date, time_s, bottom, date, time_s, top);
tl_setsize (candleWick, 2);
tl_setcolor(candleWick,lightgray);

candleBody = tl_new_s(date, time_s, ito, date, time_s, itc);
tl_setsize (candleBody, 4);

if lastPrice > dailyOp then
tl_setcolor(candleBody, VariLabelUpColor)
else
tl_setcolor(candleBody, VariLabelDnColor);
end;

// Daily variation
if dailyCl <> 0 then
changePct = absvalue(((lastPrice / dailyCl) - 1) * 100);

changePrice = absvalue(lastPrice - dailyCl);

// Alerts
if UseALerts = true then begin
if time_s = alertTrigger and barstatus = 2 and LastBarOnChart_s then begin
if SymbolAlert = "ES" then begin
Alert("S&P futures will close in " + numtostr(AlertTimeTrigger, 0) + " minutes");
PlaySound(AlertsLocation + "\ESclosein5min.wav");
end
else
if SymbolAlert = "NQ" then begin
Alert("Nasdaq futures will close in " + numtostr(AlertTimeTrigger, 0) + " minutes");
PlaySound(AlertsLocation + "\NQclosein5min.wav");
end
else
if SymbolAlert = "YM" then begin
Alert("Dow Jones futures will close in " + numtostr(AlertTimeTrigger, 0) + " minutes");
PlaySound(AlertsLocation + "\YMclosein5min.wav");
end
else
if SymbolAlert = "TY" then begin
Alert("10 year note will close in " + numtostr(AlertTimeTrigger, 0) + " minutes");
PlaySound(AlertsLocation + "\TYclosein5min.wav");
end
else
if SymbolAlert = "EU" then begin
Alert("Euro futures will close in " + numtostr(AlertTimeTrigger, 0) + " minutes");
PlaySound(AlertsLocation + "\EUclosein5min.wav");
end
else
if SymbolAlert = "CL" then begin
Alert(" Crude Oil futures will close in " + numtostr(AlertTimeTrigger, 0) + " minutes");
PlaySound(AlertsLocation + "\CLclosein5min.wav");
end;
end
else
if time_s = closeTime and barstatus = 2 and LastBarOnChart_s then begin
if SymbolAlert = "ES" then begin
Alert("S&P futures just closed for the day");
PlaySound(AlertsLocation + "\ESisclosed.wav");
end
else
if SymbolAlert = "NQ" then begin
Alert("Nasdaq futures just closed for the day");
PlaySound(AlertsLocation + "\NQisclosed.wav");
end
else
if SymbolAlert = "YM" then begin
Alert("Dow Jones futures just closed for the day");
PlaySound(AlertsLocation + "\YMisclosed.wav");
end
else
if SymbolAlert = "TY" then begin
Alert("10 year note just closed for the day");
PlaySound(AlertsLocation + "\TYisclosed.wav");
end
else
if SymbolAlert = "EU" then begin
Alert("Euro futures just closed for the day");
PlaySound(AlertsLocation + "\EUisclosed.wav");
end
else
if SymbolAlert = "CL" then begin
Alert("Crude Oil just closed for the day");
PlaySound(AlertsLocation + "\CLisclosed.wav");
end;
end;
end;

// Color settings
if time_s < closeTime then begin
text_setstring(statusTXT , "O \nP \nE \nN");
text_setcolor(dataBoxTXT , DataLabelColor);
text_setcolor(statusTXT, rgb(81,81,81));

if lastPrice > dailyCl then
text_setcolor(variBoxTXT , VariLabelUpColor)
else
text_setcolor(variBoxTXT , VariLabelDnColor);

if lastPrice > dailyOp then
tl_setcolor(candleBody, VariLabelUpColor)
else
tl_setcolor(candleBody, VariLabelDnColor);
end
else
if time_s = closeTime and barstatus = 2 and LastBarOnChart_s then begin
text_setstring(statusTXT , "C \nL \nO \nS \nE");

text_setcolor(variBoxTXT , CloseLabelColor);
text_setcolor(dataBoxTXT , CloseLabelColor);
text_setcolor(statusTXT, white);

if lastPrice >= dailyOp or lastPrice <= dailyOp then begin
tl_setcolor(candleBody, CloseLabelColor);
tl_setcolor(candleWick, CloseLabelColor);
end;
end;

// DataBox
text_setstring(dataBoxTXT, " < " + text(getsymbolname) + " > " + NewLine +
spaces(1) + " OP |" + " " + NumToStr(dailyOp, MyDecimals) + spaces(SetDataBoxEndSpace) + NewLine +
spaces(1) + " HI |" + " " + NumToStr(dailyHi, MyDecimals) + spaces(SetDataBoxEndSpace) + NewLine +
spaces(1) + " LO |" + " " + NumToStr(dailyLo, MyDecimals) + spaces(SetDataBoxEndSpace) + NewLine +
spaces(1) + " CL |" + " " + NumToStr(lastPrice, MyDecimals) + spaces(SetDataBoxEndSpace)) ;

// VariBox
text_setstring(variBoxTXT , spaces(1) + " % | " + NumToStr(changePct, 2) +
Spaces(StrLen(NumToStr(changePct, 2)) - StrLen(NumToStr(changePrice, 1))) +
spaces(SetVariBoxEndSpace) + NewLine +
spaces(1) + " CH | " + NumToStr(changePrice, MyDecimals) +
Spaces(StrLen (NumToStr(lastPrice, MyDecimals)) - StrLen(NumToStr(changePrice, MyDecimals))) + spaces(SetVariBoxEndSpace)) ;

// Data and Vari box location
text_setlocation_s(dataBoxTXT, date, time_s, LowestDispValue + (DataBox * (HighestDispValue - LowestDispValue)));
text_setlocation_s(variBoxTXT, date, time_s, LowestDispValue + (VariBox * (HighestDispValue - LowestDispValue)));

// Status location
if ShowStatus = true then
text_setlocation_s(statusTXT, date, time_s, LowestDispValue + (DataBox * (HighestDispValue - LowestDispValue)));
end;

if ShowCandle = true then begin
tl_setbegin_s(candleWick, date, time_s, bottom);
tl_setend_s(candleWick, date, time_s, top);

tl_setbegin_s(candleBody, date, time_s, ito);
tl_setend_s(candleBody, date, time_s, itc);
end;
Attachments
Sounds.zip
(888.77 KiB) Downloaded 217 times
beta2_quoteboard.wsp
(1.34 MiB) Downloaded 483 times
quoteboard_status.pla
(29.98 KiB) Downloaded 469 times
quoteboard_status_issue02.png
(50.66 KiB) Downloaded 1978 times
quoteboard_status_issue01.png
(70.58 KiB) Downloaded 1965 times

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: feature request - quoteboards

Postby TJ » 30 Jan 2013

Please help...
...
Since we're having different starts and closes for each data series the colors and Open/Close status are all over the place.
...
If you want multiple symbols on the same chart, you have to set up a 24 hr chart, and modify the code to capture the portion of the OHLC for the specific symbol.

e.g.
You won't be able to use

Code: Select all

if Date <> Date[1] then...
instead, you have to use

Code: Select all

if Time >= sessionopen and Time[1] < sessionopen then...

User avatar
arnie
Posts: 1594
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

Re: feature request - quoteboards

Postby arnie » 30 Jan 2013

Please help...
...
Since we're having different starts and closes for each data series the colors and Open/Close status are all over the place.
...
If you want multiple symbols on the same chart, you have to set up a 24 hr chart, and modify the code to capture the portion of the OHLC for the specific symbol.

e.g.
You won't be able to use

Code: Select all

if Date <> Date[1] then...
instead, you have to use

Code: Select all

if Time >= sessionopen and Time[1] < sessionopen then...

That was actually going to be my next project after finishing this one since with this one, like you said, I can't call the OHLC for the 24h session.

I was hoping that I could manage this the way I wanted using RTH charts but it seems that it's not possible :(

Thanks TJ.


Return to “MultiCharts”