Chart size issues on different screens

Hello sir,

        My AFL on a 27-inch monitor is looking fine. I recently purchased Microsoft Surface device which has 13-inch screen. Default charts ( like Price, Ichimoku charts etc) are auto-adjusted on the screen but my afl is not. Is there any code for which it autofits to the screen? 

For reference:

On 27-inch screen
27-inch

On 13-inch screen
13-inch

Thank You

Again the post WITHOUT FORMULA. Really how on earth you expect anyone to help you? Do you think people have mind reading skills and read your formulas out of your brain? Please follow this advice: How to ask a good question

A WILD GUESS is that you are using PIXEL co-ordinates and low-level GFX, so quite obviously your formula does not translate to screen of different DPI (dots per inch).
If you were smart enough to write formula with low-level GFX you can certainly apply multiplication to co-ordinates expressed in pixels to correctly use different resolution/DPI.

1 Like

Dear Tomasz,

I apologize for providing incomplete resource. I am very sorry for that. Here is the code below.

_SECTION_BEGIN("Name");

GfxSetOverlayMode(0);
GfxSelectFont("Tahoma", Status("pxheight")/20 );
GfxSetTextAlign( 6 );// center alignment
GfxSetTextColor( colorGrey40 );
GfxSetBkMode(1); // transparent
GfxTextOut( Name(), Status("pxwidth")/2, Status("pxheight")/5 );

GfxSelectFont("Brush Script MT",20,100);
GfxSetTextColor(colorOrange);
GfxTextOut( "         Analysed By:  ",200, 0);
GfxSetTextColor(colorBrightGreen);
GfxTextOut( "            Prasada  Rao  Karri",350,2);

_SECTION_END();

_SECTION_BEGIN("Magnified Market Price");
FS=Param("Font Size",28,11,100,1);
GfxSelectFont("Arial", FS, 700, italic = False, underline = False, True ); 
GfxSetBkMode( colorWhite ); 
GfxSetTextColor( ParamColor("Color",colorYellow) ); 
Hor=Param("Horizontal Position",923,923,1200,1);
Ver=Param("Vertical Position",1,1,1200,1);
GfxTextOut(""+C,Hor , Ver );
YC=TimeFrameGetPrice("C",inDaily,-1);
DD=Prec(C-YC,2);
xx=Prec((DD/YC)*100,2);
GfxSelectFont("Arial", 12, 700, italic = False, underline = False, True ); 
GfxSetBkMode( colorWhite ); 
GfxSetTextColor(ParamColor("Color",colorYellow) ); 
_SECTION_END();

_SECTION_BEGIN("Price Chart");

//SetChartOptions(0,chartShowArrows|chartShowDates);
//_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() ); 

GfxSetTextAlign( 0 );

pds = 20;
MAFAST = EMA( Close, 20 );
MASLOW = EMA( Close, 40 );

dn = DateNum(); 
newDay = dn != Ref( dn, -1); 

DonchianUpper = HHV( Ref( H, -1 ), pds );
DonchianLower = LLV( Ref( L, -1 ), pds );
Donchiandle = ( DonchianUpper + DonchianLower ) / 2;
 
UpTrend = C > ( LLV( L, 20 ) + 2 * ATR( 10 ) ) AND EMA( Close, 20 ) > EMA( Close, 40 );
DnTrend = C < ( HHV( H, 20 ) - 2 * ATR( 10 ) ) AND EMA( Close, 20 ) < EMA( Close, 40 );
Color = IIf( UpTrend, colorGreen, IIf( DnTrend, colorRed, colorBlue) );
UpTrend=ExRem(UpTrend,DnTrend);
Dntrend=ExRem(DnTrend,UpTrend);

candle2 = BarsSince( newday) == 1; 
color1 = IIf( candle2, IIf( C> O, colorYellow, colorWhite) , Color ); 
SetBarFillColor( IIf( candle2, color1, IIf( C > O, colorBlack, Color ) ) );
Plot( Close, "", color1, styleCandle,Null,Null,0,0,2);
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | styleCandle,Null,Null,0,0,2); 

NewDay = IIf(Day() != Ref(Day(), -1) OR BarIndex() == LastValue(BarIndex()), 1, 0);

_SECTION_END();

_SECTION_BEGIN("MA Box and CCI");

MA_X = Param("X Distance",320,-500,500);
MA_Y = Param("Y Distance",10,-500,500);

CCIA_X = Param("CCI & Angle X",300,-2000,2000);
CCIA_Y = Param("CCI & Angle Y",10,-2000,2000);

Version(4.70); 
 
EMA12 = EMA(C,12); 

PI = atan(1.00) * 4; 

periods = 30; 

HighHigh = HHV(H, periods); 

LowLow = LLV(L, periods); 

range = 25 / (HighHigh - LowLow) * LowLow; 

x1_EMA12 = 0; 

x2_EMA12 = 1; 

y1_EMA12 = 0; 

y2_EMA12 = (Ref(EMA12, -1) - EMA12) / Avg * range; 

c_EMA12 = sqrt((x2_EMA12 - x1_EMA12)*(x2_EMA12 - x1_EMA12) + (y2_EMA12 - y1_EMA12)*(y2_EMA12 - y1_EMA12)); 

angle_EMA12 = round(180 * acos((x2_EMA12 - x1_EMA12)/c_EMA12) / PI); 

angle_EMA12 = IIf(y2_EMA12 > 0, - angle_EMA12, angle_EMA12); 

GfxSetTextColor(colorWhite);
GfxSelectFont("Tahoma",13);

AO = MA(Avg, 5) - MA(Avg, 34);

EC5 = Prec(EMA(Close,5),2);
//resr; 
EC10 = Prec(EMA(Close,10),2);
EC21 = Prec(EMA(Close,21),2);
EC34 = Prec(EMA(Close,34),2);
EC50 = Prec(MA(Close,50),2);
EC100 = Prec(MA(Close,100),2);
EC200 = Prec(MA(Close,200),2);
//FM7 = Prec(EMA(Close,Periods7),2);

C8 = C > EC5;

C1 = C > EC10;
C2 = C > EC21;
C3 = C > EC34;
C4 = C > EC50;
C5 = C > EC100;
C6 = C > EC200;

CB = C1 + C2 + C3 + C4 + C5 + C6 + C8;
CS = (!C1) + (!C2) + (!C3) + (!C4) + (!C5) + (!C6) + (!C8);

GfxSelectSolidBrush(colorBlack);
if ( SelectedValue(CB) > SelectedValue(CS) )
	GfxSelectPen(colorLime,2);
else GfxSelectPen(colorRed,2);
GfxRoundRect(1270+MA_X,880+MA_Y,1130+MA_X,680+MA_Y,10,10);

if ( SelectedValue(!C1) ) 
{
	GfxSetTextColor(colorRed);
	GfxTextOut(" 10: "+EC10,1140+MA_X,750+MA_Y);
}
else if ( SelectedValue(C1) )
{
	GfxSetTextColor(colorLime);
	GfxTextOut(" 10: "+EC10,1140+MA_X,750+MA_Y);
}

if ( SelectedValue(!C2) )
{
	GfxSetTextColor(colorRed);
	GfxTextOut(" 21: "+EC21,1140+MA_X,770+MA_Y);

}
else if ( SelectedValue(C2) )
{
	GfxSetTextColor(colorLime);
	GfxTextOut(" 21: "+EC21,1140+MA_X,770+MA_Y);
}

if ( SelectedValue(!C3) )
{
	GfxSetTextColor(colorRed);
	GfxTextOut(" 34: "+EC34,1140+MA_X,790+MA_Y);
}
else if ( SelectedValue(C3) )
{
	GfxSetTextColor(colorLime);
	GfxTextOut(" 34: "+EC34,1140+MA_X,790+MA_Y);
}

if ( SelectedValue(!C4) )
{
	GfxSetTextColor(colorRed);
	GfxTextOut(" 50: "+EC50,1140+MA_X,810+MA_Y);
}
else if ( SelectedValue(C4) )
{
	GfxSetTextColor(colorLime);
	GfxTextOut(" 50: "+EC50,1140+MA_X,810+MA_Y);
}

if ( SelectedValue(!C5) )
{
	GfxSetTextColor(colorRed);
	GfxTextOut("100:"+EC100,1140+MA_X,830+MA_Y);
}
else if ( SelectedValue(C5) )
{
	GfxSetTextColor(colorLime);
	GfxTextOut("100:"+EC100,1140+MA_X,830+MA_Y);
}

if ( SelectedValue(!C6) )
{
	GfxSetTextColor(colorRed);
	GfxTextOut( "200:"+EC200,1140+MA_X,850+MA_Y);
}
else if ( SelectedValue(C6) )
{
	GfxSetTextColor(colorLime);
	GfxTextOut( "200:"+EC200,1140+MA_X,850+MA_Y);
}

if ( SelectedValue(angle_EMA12) < 0 )
{
	GfxSetTextColor(colorRed);
	GfxTextOut(" 12 Angle: "+angle_EMA12+"°",1140+MA_X,690+MA_Y);
}
else if ( SelectedValue(angle_EMA12) > 0 )
{
	GfxSetTextColor(colorLime);
	GfxTextOut(" 12 Angle: "+angle_EMA12+"°",1140+MA_X,690+MA_Y);
}

if ( SelectedValue(!C8) )
{
	GfxSetTextColor(colorRed);
	GfxTextOut("05: "+EC5,1145+MA_X,730+MA_Y);
}
else if ( SelectedValue(C8) )
{
	GfxSetTextColor(colorLime);
	GfxTextOut("05: "+EC5,1145+MA_X,730+MA_Y);
}

if ( SelectedValue(AO) > 0 )
	GfxSetTextColor(colorLime);
else GfxSetTextColor(colorRed);
	GfxTextOut(" AO: "+round(AO),1140+MA_X,710+MA_Y);
	
StatcD = C2 + C3 + C4;

StatB = BarsSince(StatcD==3);
StatS = BarsSince(StatcD==0);

	if ( SelectedValue(StatB) < SelectedValue(StatS) )
	{
		GfxSelectPen(colorGreen,3,0);
		GfxSelectSolidBrush(colorBlack);
		GfxCircle(1340+CCIA_X,830+CCIA_Y,45);

		GfxSelectPen(colorBrightGreen,3,0);
		GfxSelectPen(colorDefault,3,5);
		GfxSelectSolidBrush(colorBrightGreen);
		GfxPolygon(1310+CCIA_X,850+CCIA_Y,1340+CCIA_X,800+CCIA_Y,1375+CCIA_X,850+CCIA_Y);
		GfxSelectSolidBrush(colorBlack);
		GfxPolygon(1310+CCIA_X,850+CCIA_Y,1340+CCIA_X,835+CCIA_Y,1375+CCIA_X,850+CCIA_Y);
		GfxPolygon(1341+CCIA_X,808+CCIA_Y,1342+CCIA_X,832+CCIA_Y,1365+CCIA_X,842+CCIA_Y);
		GfxSetTextColor( colorBrightGreen );
		GfxTextOut(""+ValueWhen(StatcD==3,angle_EMA12)+"°",1325+CCIA_X,843+CCIA_Y);
	}
	if ( SelectedValue(StatB) > SelectedValue(StatS) )
	{
		GfxSelectPen(colordarkRed,3,0);
		GfxSelectSolidBrush(colorBlack);
		GfxCircle(1340+CCIA_X,830+CCIA_Y,45);

		GfxSelectPen(colorRed,3,0);
		GfxSelectPen(colorDefault,3,5);
		GfxSelectSolidBrush(colorRed);
		GfxPolygon(1310+CCIA_X,810+CCIA_Y,1340+CCIA_X,860+CCIA_Y,1370+CCIA_X,810+CCIA_Y);
		GfxSelectSolidBrush(colorBlack);
		GfxPolygon(1310+CCIA_X,810+CCIA_Y,1340+CCIA_X,825+CCIA_Y,1375+CCIA_X,810+CCIA_Y);
		GfxPolygon(1318+CCIA_X,818+CCIA_Y,1342+CCIA_X,854+CCIA_Y,1340+CCIA_X,828+CCIA_Y);
		GfxSetTextColor( colorRed );
		GfxTextOut(""+ValueWhen(StatcD==0,angle_EMA12)+"°",1330+CCIA_X,795+CCIA_Y);
	}
	
	if ( SelectedValue(CCI(170)) > 0 )
{
	GfxSelectPen(colorGreen,3);	
	GfxCircle(1440+CCIA_X,830+CCIA_Y,45);
	GfxSelectPen(colorBrightGreen,3);	
	GfxSetTextColor(colorBrightGreen);
	GfxTextOut(""+round(CCI(170)),1420+CCIA_X,850+CCIA_Y);
	GfxPolyline(1430+CCIA_X,830+CCIA_Y,1412+CCIA_X,855+CCIA_Y);
	GfxPolyline(1430+CCIA_X,830+CCIA_Y,1450+CCIA_X,840+CCIA_Y);
	GfxPolyline(1470+CCIA_X,810+CCIA_Y,1450+CCIA_X,840+CCIA_Y);
	GfxPolyline(1470+CCIA_X,810+CCIA_Y,1455+CCIA_X,810+CCIA_Y);
	GfxPolyline(1470+CCIA_X,810+CCIA_Y,1478+CCIA_X,825+CCIA_Y);
}
else if ( SelectedValue(CCI(170)) < 0 )
{
	GfxSelectPen(colordarkRed,3);
	GfxCircle(1440+CCIA_X,830+CCIA_Y,45);
	GfxSelectPen(colorRed,3);
	GfxSetTextColor(colorRed);
	GfxTextOut(""+round(CCI(170)),1420+CCIA_X,850+CCIA_Y);
	GfxPolyline(1430+CCIA_X,840+CCIA_Y,1410+CCIA_X,812+CCIA_Y);
	GfxPolyline(1430+CCIA_X,840+CCIA_Y,1450+CCIA_X,830+CCIA_Y);
	GfxPolyline(1467+CCIA_X,854+CCIA_Y,1450+CCIA_X,830+CCIA_Y);
	GfxPolyline(1467+CCIA_X,854+CCIA_Y,1450+CCIA_X,850+CCIA_Y);
	GfxPolyline(1467+CCIA_X,854+CCIA_Y,1470+CCIA_X,835+CCIA_Y);
}

GfxSetTextColor(colorGold);
GfxTextOut(""+round(CCI(34)),1420+CCIA_X,790+CCIA_Y);

_SECTION_END();

_SECTION_BEGIN("CCI BOX");

CCI_X = Param("X Distance",92,-1000,1000);
CCI_Y = Param("Y Distance",270,-1000,1000);

		CCI34 = CCI(34);
		CCI170 = CCI(170);
		
		AvgCCI34 = ( Ref(CCI34,-1) + Ref(CCI34,-2) + Ref(CCI34,-3) + Ref(CCI34,-4) + Ref(CCI34,-5) )/5;
		AvgCCI170 = ( Ref(CCI170,-1) + Ref(CCI170,-2) + Ref(CCI170,-3) + Ref(CCI170,-4) + Ref(CCI170,-5) )/5;
		
		if ( SelectedValue(CCI34) > 100 AND SelectedValue(CCI170) > 100 AND SelectedValue(AvgCCI34) > 0 AND SelectedValue(AvgCCI170) > 0 )
			GfxSelectPen(colorBrightGreen,3);
		else if ( SelectedValue(CCI34) < -100 AND SelectedValue(CCI170) < -100 AND SelectedValue(AvgCCI34) < 0 AND SelectedValue(AvgCCI170) < 0 )
			GfxSelectPen(colorRed,3);
		else GfxSelectPen(colorBlueGrey,3);
		GfxRoundRect(1503+CCI_X,370+CCI_Y,1700+CCI_X,520+CCI_Y,12,15);
		
		//Upper Circuit
		if ( SelectedValue(CCI34) > 100 )
		{
			GfxSelectPen(colorDefault,3,5);
			GfxSelectSolidBrush(colorBrightGreen);
			GfxPolygon(1615+CCI_X,435+CCI_Y,1645+CCI_X,385+CCI_Y,1680+CCI_X,435+CCI_Y);
			GfxSelectSolidBrush(colorBlack);
			GfxPolygon(1615+CCI_X,435+CCI_Y,1645+CCI_X,420+CCI_Y,1680+CCI_X,435+CCI_Y);
			GfxPolygon(1646+CCI_X,393+CCI_Y,1647+CCI_X,417+CCI_Y,1670+CCI_X,427+CCI_Y);
			GfxSetTextColor(colorBrightGreen);
			GfxTextOut("34",1635+CCI_X,425+CCI_Y);
		}
		else if ( SelectedValue(CCI34) < -100 )
		{
			GfxSelectPen(colorDefault,3,5);
			GfxSelectSolidBrush(colorRed);
			GfxPolygon(1615+CCI_X,385+CCI_Y,1645+CCI_X,435+CCI_Y,1675+CCI_X,385+CCI_Y);
			GfxSelectSolidBrush(colorBlack);
			GfxPolygon(1615+CCI_X,385+CCI_Y,1645+CCI_X,400+CCI_Y,1680+CCI_X,385+CCI_Y);
			GfxPolygon(1623+CCI_X,393+CCI_Y,1647+CCI_X,429+CCI_Y,1645+CCI_X,403+CCI_Y);
			GfxSetTextColor(colorRed);
			GfxTextOut("34",1635+CCI_X,375+CCI_Y);
		}
		else if ( ( SelectedValue(CCI34) >= 0 AND SelectedValue(CCI34) <=100 ) )
		{
			GfxSetTextColor(colorBlue);
			if ( SelectedValue(CCI34) > SelectedValue(AvgCCI34) )
			{
				GfxSelectPen(colorDefault,3,5);
				GfxSelectSolidBrush(colorBlue);
				GfxPolygon(1615+CCI_X,435+CCI_Y,1645+CCI_X,385+CCI_Y,1680+CCI_X,435+CCI_Y);
				GfxSelectSolidBrush(colorBlack);
				GfxPolygon(1615+CCI_X,435+CCI_Y,1645+CCI_X,420+CCI_Y,1680+CCI_X,435+CCI_Y);
				GfxPolygon(1646+CCI_X,393+CCI_Y,1647+CCI_X,417+CCI_Y,1670+CCI_X,427+CCI_Y);
				GfxTextOut("34",1635+CCI_X,425+CCI_Y);
			}
			else if ( SelectedValue(CCI34) < SelectedValue(AvgCCI34) )
			{
				GfxSelectPen(colorDefault,3,5);
				GfxSelectSolidBrush(colorBlue);
				GfxPolygon(1615+CCI_X,385+CCI_Y,1645+CCI_X,435+CCI_Y,1675+CCI_X,385+CCI_Y);
				GfxSelectSolidBrush(colorBlack);
				GfxPolygon(1615+CCI_X,385+CCI_Y,1645+CCI_X,400+CCI_Y,1680+CCI_X,385+CCI_Y);
				GfxPolygon(1623+CCI_X,393+CCI_Y,1647+CCI_X,429+CCI_Y,1645+CCI_X,403+CCI_Y);
				GfxTextOut("34",1635+CCI_X,375+CCI_Y);
			}
		}
		else if ( ( SelectedValue(CCI34) <= 0 AND SelectedValue(CCI34) >= -100 ) )
		{
			GfxSetTextColor(colorCustom12);
			if ( SelectedValue(CCI34) > SelectedValue(AvgCCI34) )
			{
				GfxSelectPen(colorDefault,3,5);
				GfxSelectSolidBrush(colorCustom12);
				GfxPolygon(1615+CCI_X,435+CCI_Y,1645+CCI_X,385+CCI_Y,1680+CCI_X,435+CCI_Y);
				GfxSelectSolidBrush(colorBlack);
				GfxPolygon(1615+CCI_X,435+CCI_Y,1645+CCI_X,420+CCI_Y,1680+CCI_X,435+CCI_Y);
				GfxPolygon(1646+CCI_X,393+CCI_Y,1647+CCI_X,417+CCI_Y,1670+CCI_X,427+CCI_Y);
				GfxTextOut("34",1635+CCI_X,425+CCI_Y);
			}
			else if ( SelectedValue(CCI34) < SelectedValue(AvgCCI34) )
			{
				GfxSelectPen(colorDefault,3,5);
				GfxSelectSolidBrush(colorCustom12);
				GfxPolygon(1615+CCI_X,385+CCI_Y,1645+CCI_X,435+CCI_Y,1675+CCI_X,385+CCI_Y);
				GfxSelectSolidBrush(colorBlack);
				GfxPolygon(1615+CCI_X,385+CCI_Y,1645+CCI_X,400+CCI_Y,1680+CCI_X,385+CCI_Y);
				GfxPolygon(1623+CCI_X,393+CCI_Y,1647+CCI_X,429+CCI_Y,1645+CCI_X,403+CCI_Y);
				GfxTextOut("34",1635+CCI_X,375+CCI_Y);
			}
		}
		
		//Lower Circuit
		if ( SelectedValue(CCI170) > 100 )
		{
			GfxSelectPen(colorDefault,3,5);
			GfxSelectSolidBrush(colorBrightGreen);
			GfxPolygon(1615+CCI_X,500+CCI_Y,1645+CCI_X,450+CCI_Y,1680+CCI_X,500+CCI_Y);
			GfxSelectSolidBrush(colorBlack);
			GfxPolygon(1615+CCI_X,500+CCI_Y,1645+CCI_X,485+CCI_Y,1680+CCI_X,500+CCI_Y);
			GfxPolygon(1646+CCI_X,458+CCI_Y,1647+CCI_X,482+CCI_Y,1670+CCI_X,492+CCI_Y);
			GfxSetTextColor(colorBrightGreen);
			GfxTextOut("170",1635+CCI_X,495+CCI_Y);
		}
		else if ( SelectedValue(CCI170) < -100 )
		{
			GfxSelectPen(colorDefault,3,5);
			GfxSelectSolidBrush(colorRed);
			GfxPolygon(1615+CCI_X,450+CCI_Y,1645+CCI_X,500+CCI_Y,1675+CCI_X,450+CCI_Y);
			GfxSelectSolidBrush(colorBlack);
			GfxPolygon(1615+CCI_X,450+CCI_Y,1645+CCI_X,465+CCI_Y,1680+CCI_X,450+CCI_Y);
			GfxPolygon(1623+CCI_X,458+CCI_Y,1647+CCI_X,494+CCI_Y,1645+CCI_X,468+CCI_Y);
			GfxSetTextColor(colorRed);
			GfxTextOut("170",1630+CCI_X,440+CCI_Y);
		}
		else if ( ( SelectedValue(CCI170) >= 0 AND SelectedValue(CCI170) <=100 ) )
		{
			GfxSetTextColor(colorBlue);
			
			if ( SelectedValue(CCI170) > SelectedValue(AvgCCI170) )
			{
				GfxSelectPen(colorDefault,3,5);
				GfxSelectSolidBrush(colorBlue);
				GfxPolygon(1615+CCI_X,500+CCI_Y,1645+CCI_X,450+CCI_Y,1680+CCI_X,500+CCI_Y);
				GfxSelectSolidBrush(colorBlack);
				GfxPolygon(1615+CCI_X,500+CCI_Y,1645+CCI_X,485+CCI_Y,1680+CCI_X,500+CCI_Y);
				GfxPolygon(1646+CCI_X,458+CCI_Y,1647+CCI_X,482+CCI_Y,1670+CCI_X,492+CCI_Y);
				GfxTextOut("170",1635+CCI_X,495+CCI_Y);
			}
			else if ( SelectedValue(CCI170) < SelectedValue(AvgCCI170) )
			{
				GfxSelectPen(colorDefault,3,5);
				GfxSelectSolidBrush(colorBlue);
				GfxPolygon(1615+CCI_X,450+CCI_Y,1645+CCI_X,500+CCI_Y,1675+CCI_X,450+CCI_Y);
				GfxSelectSolidBrush(colorBlack);
				GfxPolygon(1615+CCI_X,450+CCI_Y,1645+CCI_X,465+CCI_Y,1680+CCI_X,450+CCI_Y);
				GfxPolygon(1623+CCI_X,458+CCI_Y,1647+CCI_X,494+CCI_Y,1645+CCI_X,468+CCI_Y);
				GfxTextOut("170",1630+CCI_X,440+CCI_Y);
			}
		}
		else if ( ( SelectedValue(CCI170) <= 0 AND SelectedValue(CCI170) >= -100 ) )
		{
			GfxSetTextColor(colorCustom12);
			
			if ( SelectedValue(CCI170) > SelectedValue(AvgCCI170) )
			{
				GfxSelectPen(colorDefault,3,5);
				GfxSelectSolidBrush(colorCustom12);
				GfxPolygon(1615+CCI_X,500+CCI_Y,1645+CCI_X,450+CCI_Y,1680+CCI_X,500+CCI_Y);
				GfxSelectSolidBrush(colorBlack);
				GfxPolygon(1615+CCI_X,500+CCI_Y,1645+CCI_X,485+CCI_Y,1680+CCI_X,500+CCI_Y);
				GfxPolygon(1646+CCI_X,458+CCI_Y,1647+CCI_X,482+CCI_Y,1670+CCI_X,492+CCI_Y);
				GfxTextOut("170",1635+CCI_X,495+CCI_Y);
			}
			else if ( SelectedValue(CCI170) < SelectedValue(AvgCCI170) )
			{
				GfxSelectPen(colorDefault,3,5);
				GfxSelectSolidBrush(colorCustom12);
				GfxPolygon(1615+CCI_X,450+CCI_Y,1645+CCI_X,500+CCI_Y,1675+CCI_X,450+CCI_Y);
				GfxSelectSolidBrush(colorBlack);
				GfxPolygon(1615+CCI_X,450+CCI_Y,1645+CCI_X,465+CCI_Y,1680+CCI_X,450+CCI_Y);
				GfxPolygon(1623+CCI_X,458+CCI_Y,1647+CCI_X,494+CCI_Y,1645+CCI_X,468+CCI_Y);
				GfxTextOut("170",1630+CCI_X,440+CCI_Y);
			}
		}
		
		
		if ( SelectedValue(AvgCCI34) > 0 )
		{
			GfxSelectPen(colorDefault,3,5);
			GfxSelectSolidBrush(colorBrightGreen);
			GfxPolygon(1525+CCI_X,435+CCI_Y,1555+CCI_X,385+CCI_Y,1590+CCI_X,435+CCI_Y);
			GfxSelectSolidBrush(colorBlack);
			GfxPolygon(1525+CCI_X,435+CCI_Y,1555+CCI_X,420+CCI_Y,1590+CCI_X,435+CCI_Y);
			GfxPolygon(1556+CCI_X,393+CCI_Y,1557+CCI_X,417+CCI_Y,1580+CCI_X,427+CCI_Y);
			GfxSetTextColor(colorBrightGreen);
			GfxTextOut(""+Prec(AvgCCI34,0),1545+CCI_X,425+CCI_Y);
			GfxTextOut("34 = "+Prec(AvgCCI34,2),10+CCI_X,860+CCI_Y);
		}
		else
		{	
			GfxSelectPen(colorDefault,3,5);
			GfxSelectSolidBrush(colorRed);
			GfxPolygon(1525+CCI_X,385+CCI_Y,1555+CCI_X,435+CCI_Y,1585+CCI_X,385+CCI_Y);
			GfxSelectSolidBrush(colorBlack);
			GfxPolygon(1525+CCI_X,385+CCI_Y,1555+CCI_X,400+CCI_Y,1590+CCI_X,385+CCI_Y);
			GfxPolygon(1533+CCI_X,393+CCI_Y,1557+CCI_X,429+CCI_Y,1555+CCI_X,403+CCI_Y);
			GfxSetTextColor(colorRed);
			GfxTextOut(""+Prec(AvgCCI34,0),1540+CCI_X,375+CCI_Y);
			GfxTextOut("34 = "+Prec(AvgCCI34,2),10+CCI_X,860+CCI_Y);
		}
		
		if ( SelectedValue(AvgCCI170) > 0 )
		{
			GfxSelectPen(colorDefault,3,5);
			GfxSelectSolidBrush(colorBrightGreen);
			GfxPolygon(1525+CCI_X,500+CCI_Y,1555+CCI_X,450+CCI_Y,1590+CCI_X,500+CCI_Y);
			GfxSelectSolidBrush(colorBlack);
			GfxPolygon(1525+CCI_X,500+CCI_Y,1555+CCI_X,485+CCI_Y,1590+CCI_X,500+CCI_Y);
			GfxPolygon(1556+CCI_X,458+CCI_Y,1557+CCI_X,482+CCI_Y,1580+CCI_X,492+CCI_Y);
			GfxSetTextColor(colorBrightGreen);
			GfxTextOut(""+Prec(AvgCCI170,0),1545+CCI_X,495+CCI_Y);
			GfxTextOut("170 = "+Prec(AvgCCI170,2),290+CCI_X,860+CCI_Y);
		}
		else
		{	
			GfxSelectPen(colorDefault,3,5);
			GfxSelectSolidBrush(colorRed);
			GfxPolygon(1525+CCI_X,450+CCI_Y,1555+CCI_X,500+CCI_Y,1585+CCI_X,450+CCI_Y);
			GfxSelectSolidBrush(colorBlack);
			GfxPolygon(1525+CCI_X,450+CCI_Y,1555+CCI_X,465+CCI_Y,1590+CCI_X,450+CCI_Y);
			GfxPolygon(1533+CCI_X,458+CCI_Y,1557+CCI_X,494+CCI_Y,1555+CCI_X,468+CCI_Y);
			GfxSetTextColor(colorRed);
			GfxTextOut(""+Prec(AvgCCI170,0),1540+CCI_X,440+CCI_Y);
			GfxTextOut("170 = "+Prec(AvgCCI170,2),290+CCI_X,860+CCI_Y);
		}
_SECTION_END();

_SECTION_BEGIN("Elliot Wave Theory");

X_dis = Param("X Distance",-398,-1000,1000,1);
Y_dis = Param("Y Distance",15,15,100,1);

GfxSelectFont("Times New Roman", 14 );
Histart = BeginValue(H);
Hiend = EndValue(H);
Lostart = BeginValue(L);
Loend = EndValue(L);

SH = IIf(Histart>Hiend,Histart,Hiend);
SL = IIf(Lostart<Loend,Lostart,Loend);

UR1=((SH-SL)*0.236)+SL; //76.4
UR2=((SH-SL)*0.382)+SL; //61.8
UR3=((SH-SL)*0.5)+SL; //50.0
UR4=((SH-SL)*0.618)+SL; //38.2
UR5=((SH-SL)*0.764)+SL; //23.6
UR6=((SH-SL)*0.146)+SL; //85.4
UT4=((SH-SL)*1.618)+SL;
UT5=((SH-SL)*1.764)+SL;
UT6=((SH-SL)*2.0)+SL;

DR1=-(((SH-SL)*0.236)-SH); //76.4
DR2=-(((SH-SL)*0.382)-SH); //61.8
DR3=-(((SH-SL)*0.5)-SH); //50.0
DR4=-(((SH-SL)*0.618)-SH); //38.2
DR5=-(((SH-SL)*0.764)-SH); //23.6
DR6=-(((SH-SL)*0.146)-SH); //85.4
DT4=-(((SH-SL)*1.618)-SH);
DT5=-(((SH-SL)*1.764)-SH);
DT6=-(((SH-SL)*2.0)-SH);

EndBar = EndValue( BarIndex() ); 
Lastbar = BarIndex();

W3 = "N";
if (Histart>Hiend AND Lostart>Loend) W3 = "D"; else if (Histart<Hiend AND Lostart<Loend) W3 = "A";

W3H = HHV(H,Lastbar-EndBar);
W3L = LLV(L,Lastbar-EndBar);

UW3R2=((W3H-W3L)*0.382)+W3L; //61.8
UW3R3=((W3H-W3L)*0.5)+W3L; //50.0
UW3R4=((W3H-W3L)*0.618)+W3L; //38.2
UW3R5=((W3H-W3L)*0.764)+W3L; //23.6
UW3R6=((W3H-W3L)*0.854)+W3L; //14.6

DW3R2=-(((W3H-W3L)*0.382)-W3H); //61.8
DW3R3=-(((W3H-W3L)*0.5)-W3H); //50.0
DW3R4=-(((W3H-W3L)*0.618)-W3H); //38.2
DW3R5=-(((W3H-W3L)*0.764)-W3H); //23.6
DW3R6=-(((W3H-W3L)*0.854)-W3H); //14.6

W4L = LLV(L,BarsSince(W3H==H));
W4H = HHV(H,BarsSince(W3L==L));

W5 = W5_1 = W5_2 = 0;

if (W3=="A")
{
	W5 = W4L+(SH-SL);
	
	W5_1 = ((SH-SL)+(W3H-W3L))/2;
	W5_1 = (W5_1*0.618)+W4L;
	
	W5_2 = (W3H-W4L)*1.618;
	W5_2 += W4L;
}
else if (W3=="D")
{
	W5 = W4H-(SH-SL);
	
	W5_1 = ((SH-SL)+(W3H-W3L))/2;
	W5_1 = W4H-(W5_1*0.618);
	
	W5_2 = (W4H-W3L)*1.618;
	W5_2 = W4H - W5_2;
}

GfxSelectPen(colorYellow,5);
GfxSelectPen(ColorRGB(153,153,255));
GfxSelectSolidBrush(colorBlack);
GfxRoundRect(1120+X_dis,875+Y_dis,400+X_dis,680+Y_dis,80,168);
GfxSelectPen(colorGold,3);
GfxSetTextColor(ColorRGB(153,153,255));
GfxRectangle(578+X_dis,730+Y_dis,580+X_dis,865+Y_dis);
GfxRectangle(760+X_dis,730+Y_dis,762+X_dis,865+Y_dis);
GfxRectangle(940+X_dis,730+Y_dis,942+X_dis,865+Y_dis);
GfxSelectPen(colorGold,2);
GfxSelectPen(ColorRGB(153,153,255));
GfxRectangle(408+X_dis,720+Y_dis,1114+X_dis,721+Y_dis);
GfxSetTextAlign(8);

if (W3=="A")
{
	GfxSetTextColor(colorRed);
	//Wave 2
	GfxTextOut("38.2% = "+UR4,420+X_dis,780+Y_dis);
	GfxTextOut("50.0% = "+UR3,420+X_dis,800+Y_dis);
	GfxTextOut("61.8% = "+UR2,420+X_dis,820+Y_dis);
	GfxTextOut("76.4% = "+UR1,420+X_dis,840+Y_dis);
	GfxTextOut("85.4% = "+UR6,420+X_dis,860+Y_dis);
	
	//Wave 4
	GfxTextOut("14.6% = "+UW3R6,790+X_dis,780+Y_dis);
	GfxTextOut("23.6% = "+UW3R5,790+X_dis,800+Y_dis);
	GfxTextOut("38.2% = "+UW3R4,790+X_dis,820+Y_dis);
	GfxTextOut("50.0% = "+UW3R3,790+X_dis,840+Y_dis);
	GfxTextOut("61.8% = "+UW3R2,790+X_dis,860+Y_dis);
	
	GfxSetTextColor(colorLime);
	//Wave 3
	GfxTextOut("Tgt 1 = "+UT4,610+X_dis,780+Y_dis);
	GfxTextOut("Tgt 2 = "+UT5,610+X_dis,800+Y_dis);
	GfxTextOut("Tgt 3 = "+UT6,610+X_dis,820+Y_dis);
}
else if (W3=="D")
{
	GfxSetTextColor(colorLime);
	//Wave 2
	GfxTextOut("38.2% = "+DR4,420+X_dis,780+Y_dis);
	GfxTextOut("50.0% = "+DR3,420+X_dis,800+Y_dis);
	GfxTextOut("61.8% = "+DR2,420+X_dis,820+Y_dis);
	GfxTextOut("76.4% = "+DR1,420+X_dis,840+Y_dis);
	GfxTextOut("85.4% = "+DR6,420+X_dis,860+Y_dis);

	//Wave 4
	GfxTextOut("14.6% = "+DW3R6,790+X_dis,780+Y_dis);
	GfxTextOut("23.6% = "+DW3R5,790+X_dis,800+Y_dis);
	GfxTextOut("38.2% = "+DW3R4,790+X_dis,820+Y_dis);
	GfxTextOut("50.0% = "+DW3R3,790+X_dis,840+Y_dis);
	GfxTextOut("61.8% = "+DW3R2,790+x_dis,860+Y_dis);
	
	GfxSetTextColor(colorRed);
	//Wave 3
	GfxTextOut("Tgt 1 = "+DT4,610+X_dis,780+Y_dis);
	GfxTextOut("Tgt 2 = "+DT5,610+X_dis,800+Y_dis);
	GfxTextOut("Tgt 3 = "+DT6,610+X_dis,820+Y_dis);
}

//Wave 5
GfxTextOut("Tgt 1 = "+W5,960+X_dis,780+Y_dis);
GfxTextOut("Tgt 2 = "+W5_1,960+X_dis,800+Y_dis);
GfxTextOut("Tgt 3 = "+W5_2,960+X_dis,820+Y_dis);

GfxSelectFont("Tahoma",15);
GfxSetTextColor(colorOrange);
GfxTextOut("Wave 2",455+X_dis,750+Y_dis);
GfxTextOut("Wave 3",640+X_dis,750+Y_dis);
GfxTextOut("Wave 4",820+X_dis,750+Y_dis);
GfxTextOut("Wave 5",1000+X_dis,750+Y_dis);
GfxSetTextColor(ColorRGB(153,153,255));
GfxTextOut("                 E L L I O T    W A V E    T H E O R Y    ( "+Name()+" )",420+X_dis,710+Y_dis);

GfxSelectFont("Times New Roman", 12 );
GfxSetTextColor(colorDefault);

GfxTextOut("Swing High = "+round(SH),960+X_dis,845+Y_dis);
GfxTextOut("Swing Low = "+round(SL),960+X_dis,865+Y_dis);

GfxTextOut("Wave 3 High = "+round(W3H),610+X_dis,845+Y_dis);
GfxTextOut("Wave 3 Low = "+round(W3L),610+X_dis,865+Y_dis);
	
_SECTION_END();

For Reference:

27-inch
27-inch

13-inch
13-inch

I again regret for the annoyance caused.
I request you to please help me to get out of this problem.

Thank You.

You are already using Status("pxwidth") and Status("pxheight") in some but not ALL places of your formula. This is why you got problems.
Example:

GfxSelectFont("Tahoma", Status("pxheight")/20 ); // size of font depends on chart height
...
// co-ords depend on chart size
GfxTextOut( Name(), Status("pxwidth")/2, Status("pxheight")/5 );

but few lines later:

GfxSelectFont("Brush Script MT",20,100); // fixed point size
...
// absolute pixel position
GfxTextOut( "         Analysed By:  ",200, 0);

Some of your Gfx calls auto-size and some not. You have to decide what you want. If you want to adopt everything to chart size you have to use FIRST method (calculate sizes and co-ords based on pxwidth/pxheight. If you want same looking output regardless of chart size - use absolute values / sizes.
Using MIXTURE as you are doing now, gives mixed output.

1 Like

Thank you hon'ble Tomasz sir

Merry Chirstmas!

1 Like

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.