How to add time in Price Chart ?

#11
Whole code

Code:
_SECTION_BEGIN("AFL Coding");
SetBarFillColor( IIf( Close > Open, colorGreen, colorRed ) );
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Op %g, Hi %g, Lo %g, Close %g (%.1f%%)\n {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot(C,"", colorBlack, styleCandle );
Plot(EMA(C,3),"EMA(3)", colorRed );
Plot(EMA(C,15),"EMA(15)", colorGreen );
Buy=Cross(EMA(C,3),EMA(C,15));
Sell=Cross(EMA(C,15),EMA(C,3));
Filter = 1;
AddColumn( Close, "Close" );
_SECTION_END();
Have you ever heard of adding \n or are you a programming noob?
If you are the latter one then I tell you that adding \n causes a line break wherever you want it to be in your text output.

You could add another line break at

Plot(EMA(C,15),"\nEMA(15)", colorGreen );

and so on ...
 

megapixel

Well-Known Member
#12
Whole code

Code:
_SECTION_BEGIN("AFL Coding");
SetBarFillColor( IIf( Close > Open, colorGreen, colorRed ) );
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Op %g, Hi %g, Lo %g, Close %g (%.1f%%)\n {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot(C,"", colorBlack, styleCandle );
Plot(EMA(C,3),"EMA(3)", colorRed );
Plot(EMA(C,15),"EMA(15)", colorGreen );
Buy=Cross(EMA(C,3),EMA(C,15));
Sell=Cross(EMA(C,15),EMA(C,3));
Filter = 1;
AddColumn( Close, "Close" );
_SECTION_END();
Have you ever heard of adding \n or are you a programming noob?
If you are the latter one then I tell you that adding \n causes a line break wherever you want it to be in your text output.

You could add another line break at

Plot(EMA(C,15),"\nEMA(15)", colorGreen );

and so on ...
bingo ....it works !

:clap:

 
#13
Here is a correction removing the space in the second line

Code:
_SECTION_BEGIN("AFL Coding");
SetBarFillColor( IIf( Close > Open, colorGreen, colorRed ) );
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Op %g, Hi %g, Lo %g, Close %g (%.1f%%) \n{{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot(C,"", colorGrey40, styleCandle );
Plot(EMA(C,3),"EMA(3)", colorRed );
Plot(EMA(C,15),"EMA(15)", colorGreen );
Buy=Cross(EMA(C,3),EMA(C,15));
Sell=Cross(EMA(C,15),EMA(C,3));
Filter = 1;
AddColumn( Close, "Close" );
_SECTION_END();
 

megapixel

Well-Known Member
#14
Here is a correction removing the space in the second line

Code:
_SECTION_BEGIN("AFL Coding");
SetBarFillColor( IIf( Close > Open, colorGreen, colorRed ) );
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Op %g, Hi %g, Lo %g, Close %g (%.1f%%) \n{{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot(C,"", colorGrey40, styleCandle );
Plot(EMA(C,3),"EMA(3)", colorRed );
Plot(EMA(C,15),"EMA(15)", colorGreen );
Buy=Cross(EMA(C,3),EMA(C,15));
Sell=Cross(EMA(C,15),EMA(C,3));
Filter = 1;
AddColumn( Close, "Close" );
_SECTION_END();
Thanks ....chart looks more beautiful ..
 

asnavale

Well-Known Member
#15
your code has a bug buddy ...it says previous line has a missing semicolon ..this is not true....also I dont have Volume information in data file ...because I'm pulling google data.

anyway...thanks for the post and your time.
Hi MP, Yes there is a bug. The line you highlighted ends with a colon instead of semicolon. Just change the colon to semicolon and it works.

I have corrected it and it works. Here is the corrected code:

_SECTION_BEGIN("AFL Coding");
SetBarFillColor( IIf( Close > Open, colorGreen, colorRed ) );

Plot(C,"", colorBlack, styleCandle );
Plot(EMA(C,3),"EMA(3)", colorRed );
Plot(EMA(C,15),"EMA(15)", colorGreen );

_N(Title = StrFormat("{{NAME}}({{INTERVAL}}) - {{DATE}}: {{OHLCX}}\n{{VALUES}}"));

Buy=Cross(EMA(C,3),EMA(C,15));
Sell=Cross(EMA(C,15),EMA(C,3));
Filter = 1;
AddColumn( Close, "Close" );
_SECTION_END();
 

trash

Well-Known Member
#16
This is making a big text ....I can not scroll to see full text in the screen ...I tried clicking right arrow next to the text ...but it does not scroll.

see this ...

use ChartWrapTitle

Code:
SetChartOptions(0, chartShowArrows|chartShowDates|chartWrapTitle);

_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
 

a1b1trader

Well-Known Member
#17
Hi MP
It seems your chart is not correct.
It seems to be because of your data.
Your utility is not working properly.
 

megapixel

Well-Known Member
#18
Hi,
I have made my chart more attractive and colorful ....no more dull looking :)

However I just need to remove a sectoral line in the chart ....

Can anyone tell how to remove this sectoral line for mouse pointer ? There is NO suitable menu under Tool > Preference > to remove sectoral line...

 

amsin21

Well-Known Member
#19
Hi,
I have made my chart more attractive and colorful ....no more dull looking :)

However I just need to remove a sectoral line in the chart ....

Can anyone tell how to remove this sectoral line for mouse pointer ? There is NO suitable menu under Tool > Preference > to remove sectoral line...

Tools > Preferences > Colors > Selector line .... change the color to same as of b/g color.

But selector line is very much necessary for pin pointing the same area in different panes.
 

megapixel

Well-Known Member
#20
Tools > Preferences > Colors > Selector line .... change the color to same as of b/g color.

But selector line is very much necessary for pin pointing the same area in different panes.
very true....can we just have a cross cursor here instead of that line ? that big line is damaging chart's beauty .... want to get rid of it :)
 

Similar threads