Current Market Price AFL Font Size

aggy

Active Member
#1
Can someone please tell me how to PLOT TEXT in much bigger SIZE in this particular AFL

And if possible i would like to add HIGH VALUE also as close and previous close is in this AFL.

Thanks in advance

_SECTION_BEGIN("Price Line");
dp= Param("dps",3,0,1000,1);
PriceLineColor=ParamColor("PriceLineColor",ColorRGB(82,82,82));
PriceLevel = ParamField("PriceField", field = 3 );
PriceLeve2 = ParamField("PriceField", field = dp );
Daysback = Param("Bars Back",1,10,500,1);
FirstBar = BarCount - DaysBack;
YY = IIf(BarIndex() >= Firstbar,EndValue(PriceLevel),Null);

Plot(YY,"Current Price",PriceLineColor,ParamStyle("LineStyle",styleLine|styleDashed|styleNoTitle|styleNoLabel|styleThick,maskAll));

PC=TimeFrameGetPrice( "C", inDaily, -1 );
Plot(pc,"Current Price",PriceLineColor,ParamStyle("LineStyle",styleLine|styleDashed|styleNoTitle|styleNoLabel|styleThick,maskAll));

side = Param("side",1,0,1000,1);

dist = 0;

for( i = 0; i < BarCount; i++ )
{
if(i+side== BarCount) PlotText( "\n " + PriceLevel[ i ], i, YY[ i ]-dist, colorLightBlue );
if(i+side== BarCount) PlotText( "\n " + Pc[ i ], i, pc[ i ]-dist, colorLightBlue );
}

_SECTION_END();
 

KelvinHand

Well-Known Member
#2
Can someone please tell me how to PLOT TEXT in much bigger SIZE in this particular AFL

And if possible i would like to add HIGH VALUE also as close and previous close is in this AFL.

Thanks in advance

_SECTION_BEGIN("Price Line");
dp= Param("dps",3,0,1000,1);
PriceLineColor=ParamColor("PriceLineColor",ColorRGB(82,82,82));
PriceLevel = ParamField("PriceField", field = 3 );
PriceLeve2 = ParamField("PriceField", field = dp );
Daysback = Param("Bars Back",1,10,500,1);
FirstBar = BarCount - DaysBack;
YY = IIf(BarIndex() >= Firstbar,EndValue(PriceLevel),Null);

Plot(YY,"Current Price",PriceLineColor,ParamStyle("LineStyle",styleLine|styleDashed|styleNoTitle|styleNoLabel|styleThick,maskAll));

PC=TimeFrameGetPrice( "C", inDaily, -1 );
Plot(pc,"Current Price",PriceLineColor,ParamStyle("LineStyle",styleLine|styleDashed|styleNoTitle|styleNoLabel|styleThick,maskAll));

side = Param("side",1,0,1000,1);

dist = 0;

for( i = 0; i < BarCount; i++ )
{
if(i+side== BarCount) PlotText( "\n " + PriceLevel[ i ], i, YY[ i ]-dist, colorLightBlue );
if(i+side== BarCount) PlotText( "\n " + Pc[ i ], i, pc[ i ]-dist, colorLightBlue );
}

_SECTION_END();



I think only Ver 5.80, then you can change the font size using PlotTextSetFont() then plottext() without much modification.

Lower then that, you need to involve a lot of codes writing to use the Graphic API such as
- GfxSetFont()
- GfxSetBkColor()
- GfxSetTextColor()
- GfxTextOut()

AND
Logical to Pixel Conversion of the X n Y coord.


This is version 5.80.

PHP:
_SECTION_BEGIN("Price Line");
Version(5.80); 
dp= Param("dps",3,0,1000,1);
PriceLineColor=ParamColor("PriceLineColor",ColorRGB(82,82,82));
PriceLevel = ParamField("PriceField", 3 ); 
PriceLeve2 = ParamField("PriceField", dp );
Daysback = Param("Bars Back",10,10,500,1); 

Font = ParamStr("Font.Name", "Arial");
FontSize = Param("Font.Size", 10, 5);
FontColor = ParamColor("Font Color", colorLightBlue);
FontBkColor = ParamColor("Font BKColor", colorDefault);

Loc = Param("Font.Loc",5,0,999);
offset = Param("Text Offset", -16, -99, 99);


FirstBar = BarCount - DaysBack; 
YY = IIf(BarIndex() >= Firstbar,EndValue(PriceLevel),Null); 

Plot(YY,"Current Price",PriceLineColor,ParamStyle("LineStyle",styleLine|styleDashed|styleNoTitle|styleNoLabel|styleThick,maskAll)); 

PC=TimeFrameGetPrice( "C", inDaily, -1 ); 
Plot(pc,"Current Price",PriceLineColor,ParamStyle("LineStyle",styleLine|styleDashed|styleNoTitle|styleNoLabel|styleThick,maskAll)); 



dist = 0; 



i=BarCount-Loc;
PlotTextSetFont( ""+PriceLevel[ i ], Font, FontSize, 
  i, YY[ i ]-dist[i], FontColor, FontBkColor, offset);
  
PlotText( ""+ Pc[ i ], 
  i, pc[ i ]-dist[i], FontColor, FontBkColor, offset); 

_SECTION_END();

 
Last edited:

ocil

Well-Known Member
#8
Aggy try this work on ami 5.4 +
=============================
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
/////////////////////
Disp1=1;
if(Disp1){
PriceLineColor= colorYellow;
PriceLevel=C;
Daysback= 20;
FirstBar= BarCount - DaysBack;
YY= IIf(BarIndex() >= Firstbar,EndValue(PriceLevel),Null);
Plot(YY,"Current Price",PriceLineColor,styleLine|styleDashed|styleNoTitle|styleNoLabel,maskAll);
Side=1;
Dist=0;
for(i = 0; i < BarCount; i++ )
{
if(i+Side== BarCount) PlotText("\n " + PriceLevel[ i ], i, YY[ i ]-Dist, colorDarkYellow );
}}


===============================================
Remove space if any error found
 

KelvinHand

Well-Known Member
#9
PHP:
Your code
=======
side = Param("side",1,0,1000,1);
Dist=0; 
for(i = 0; i < BarCount; i++ ) 
{ 
    
    if(i+side== BarCount) PlotText( "\n " + PriceLevel[ i ], i, YY[ i ]-dist[i], colorLightBlue );
    if(i+side== BarCount) PlotText( "\n " + Pc[ i ], i, pc[ i ]-dist[i], colorLightBlue ); 

}
Assume
BarCount =1000;
Side = 1;

You are doing unnecessary looping from 0 to 998 then
on 999 +1 == 1000 then PlotText();


Since
if(i+Side== BarCount) then ....

What If i convert to
if(i== BarCount-Side)

is it going to be the same ???


so on the new code, instead of looping because you only want to display the last one then

PHP:
dist = 0; 

//-- if you want to plottext at the LAST TRADED PRICE then set side(=>Loc) to 1
//-- to make  it more readeable, then change the param to :
//--   Loc = Param("Trade.Loc",1,1,1000);
//--
i=BarCount-Side;   //(note:Loc is same as side)

PlotTextSetFont( ""+PriceLevel[ i ], Font, FontSize, 
  i, YY[ i ]-dist[i], FontColor, FontBkColor, offset);

PlotText( ""+ Pc[ i ], 
  i, pc[ i ]-dist[i], FontColor, FontBkColor, offset);
As given by Ocil
just put these statement in front to show the candlestick

_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );


The code i given only work only on version 5.80+, if you see error or nothing, then check your version before you do anything.
 
Last edited:

Similar threads