# Simple Coding Help - No Promise.

##### Well-Known Member
hi,
i am looking for an indicator that can show me how much change is there from yday close and CP (running) of today in % and points. there is an indicator i am not able to find showing the same thing once overlayed on chart. can somebody please share.

#### bbhanushali

##### Active Member
hi,
i am looking for an indicator that can show me how much change is there from yday close and CP (running) of today in % and points. there is an indicator i am not able to find showing the same thing once overlayed on chart. can somebody please share.
@primitivetrader : Hope it helps. Thnx.
Code:
``````_SECTION_BEGIN("Percent Change from Previous Day Close");

AbsoluteorPercent = ParamToggle("Percent or AbsValue Plot?","Percent|AbsValue",0);//Use this toggle to select % or Difference Points
C1 = TimeFrameGetPrice("C", inDaily, -1); // yesterdays close

TC = Close; //Current close

Diff = TC-C1;
Percent = (Diff/C1)*100;

nd = Day()!=Ref(Day(),-1);
prc = Valuewhen(nd,Ref(Percent,-1));
Percentcolor = IIf(Percent>prc,colorGreen,colorOrange);

if(AbsoluteorPercent == 0)
{Plot(Percent,"% Change ",Percentcolor,styleline);
prc = Valuewhen(nd,Ref(Percent,-1));
Plot(prc,"",colorred,styleDashed|styleNoLabel|styleNoRescale|styleStaircase,0,0,0,-1,1.5);
PlotText("PDC "+ WriteVal(prc,1.2), BarCount+2, SelectedValue(prc),colorred,colorDefault,-4);}

if(AbsoluteorPercent == 1)
{Plot(Diff,"Value Change ",Percentcolor,styleline);
prc = Valuewhen(nd,Ref(Diff,-1));
Plot(prc,"",colorred,styleDashed|styleNoLabel|styleNoRescale|styleStaircase,0,0,0,-1,1.5);
PlotText("PDC "+ WriteVal(prc,1.2), BarCount+2, SelectedValue(prc),colorred,colorDefault,-4);}

_SECTION_END();``````

#### indyan

##### New Member
This is afl of SKyQuant, I am getting Error 61. The number of format specifier(s) (%) does not match the number of arguments passed.

please any learned member fix it, as i am noob in afl and new to amibroker cant find it way to fix, i added extra % to both fields but didnt worked,
_SECTION_BEGIN("SkyQuant_circle");
/*******************************************************************************************/
// SkyQuant for AmiBroker
// You may use, copy, distribute, modify SkyQuant under the terms of
// the GNU General Public License (GPL) Version 2, 2012
/*******************************************************************************************/
//GfxSetOverlayMode( 2 ); // don't display charts nor grids
pi = 3.1415926;
pik = pi / 180;

PList1 = "0,1,2,3,4,5,6,7,8,9,11,12,15";
PList2 = "1,2,3,4,5,6,7,8,9,11,12,15";
_N( PList1 = ParamStr("Planets 1", PList1 ) );
_N( PList2 = ParamStr("Planets 2", PList2 ) );
_N( AnglesList = ParamStr("Angles", "0,90,180,60,120") );

p1arr = p2arr = -1;
for( pp1 = 0; StrExtract( PList1, pp1 ) != ""; pp1++ )
{
p = StrToNum( StrExtract( PList1, pp1 ) );
eph = SQpl(TZ, p, iflag, Cpos, bx) * -1;
VarSet( "eph" + p, eph );
eph *= -1;
zod = floor(eph/30);
grad1 = eph - zod * 30;
if( SQpl(TZ, p, 2 | 256, 3, bx) < 0 ) dir = "Retro";
else dir = " -----";
printf( SQname(p) + " \t| " + ZODIACNAME(zod[bx]) +
p1arr[pp1] = p;
}
for( pp1 = 0; StrExtract( PList2, pp1 ) != ""; pp1++ )
{
p = StrToNum( StrExtract( PList2, pp1 ) );
p2arr[pp1] = p;
}

Hfont = 6;
titleStr = "";
r = Param ("Zodiac size", 22, 3, 50, 1);
r *= 10;
xs = 40;
ys = 50;
x0 = r + xs;
y0 = r + ys;
C1 = 92 / 100;
C2 = 86 / 100;
C3 = 55 / 100;
C4 = 61 / 100;
C5 = 5 / 100;

GfxSetTextColor( colorDarkBlue );
GfxSelectPen( colorBlue );

a = -30;
for( i = 1; i <= 12; i++ )
{
GfxSelectSolidBrush( fELEMENT(i,1) );
x3 = x0 - cos( a * (i-1) * pik) * r;
y3 = y0 - sin( a * (i-1) * pik) * r;
x4 = x0 - cos( a * i * pik) * r;
y4 = y0 - sin( a * i * pik) * r;
GfxPie(xs,ys,xs+2*r,ys+2*r,x3,y3,x4,y4);
GfxSetTextAlign( 6 );
SYMBOL( i * -1, Hfont * r/100, x0 - cos( (a * i + 15) * pik) * r*C1,
y0-10 - sin( (a * i + 15) * pik) * r*C1 );
}

GfxSelectSolidBrush( ColorRGB(240,240,240) );
GfxCircle( x0, y0, r*C2 );

GfxSelectSolidBrush( GetChartBkColor() );
GfxCircle( x0, y0, r*C3 );
GfxSelectPen( colorTan );
GfxCircle( x0, y0, r*C5 );

GfxSelectPen( colorLightGrey, 1, 2 );
for( i = 1; i <= 12; i++ )
{
GfxMoveTo( x0 - cos( a * i * pik) * r*C3, y0 - sin( a * i * pik) * r*C3 );
GfxLineTo( x0 - cos( a * i * pik) * r*C2, y0 - sin( a * i * pik) * r*C2 );
}

GfxSelectPen( colorBlue, 1, 2 );
for( pp1 = 0; p1arr[pp1] >= 0; pp1++ )
{
p = p1arr[pp1];
eph = VarGet("eph" + p);
GfxSetTextColor( pColors[p] );
GfxSelectPen( pColors[p], 1, 2 );
k = 0;
for( pp2 = pp1+1; p1arr[pp2] >= 0; pp2++ )
{
p2 = p1arr[pp2];
eph_2 = VarGet("eph" + p2);
ang = ANGLE( eph, eph_2 );
if( ang < r/20 && p != p2 ) {
k += ( r/20 - ang) / 100;
}
}
p1x = x0 - cos( eph * pik ) * r*C3;
p1y = y0 - sin( eph * pik ) * r*C3;
p2x = x0 - cos( eph * pik ) * r*(C4 + k - 0.03);
p2y = y0 - sin( eph * pik ) * r*(C4 + k - 0.03);
GfxMoveTo( p1x, p1y );
GfxLineTo( p2x, p2y );
GfxSelectPen( pColors[p] );
GfxCircle( x0 - cos( eph * pik) * r*C3, y0 - sin( eph * pik) * r*C3, 2 );
SYMBOL( p, Hfont * r/100, x0 - cos( eph * pik) * r*(C4+k), y0-10 - sin( eph * pik) * r*(C4+k) );
}

GfxSetTextColor( colorDarkBlue );
printf( "\n << Aspects >>\n" );
for( pp1 = 0; p1arr[pp1] >= 0; pp1++ )
{
p1 = p1arr[pp1];
ep1 = VarGet("eph" + p1);
for( pp2 = pp1; p1arr[pp2] >= 0; pp2++ )
{
p2 = p2arr[pp2];
ep2 = VarGet("eph" + p2);
asp = ANGLE( ep1, ep2 );

for( angN = 0; StrExtract( AnglesList, angN ) != ""; angN++ )
{
aspect = StrToNum( StrExtract( AnglesList, angN ) ) ;
if( aspect-ORB <= asp && asp <= aspect+ORB && p1 != p2 )
{
if( aspect != 0 )
{
Color = ColorBlend( GetChartBkColor() , ASPCOLORCIRCLE(aspect), (ORB-abs(aspect-asp))/ORB );
GfxSelectSolidBrush( Color );
GfxSelectPen( Color, (ORB-abs(aspect-asp))/ORB * 3, 0 );
p1x = x0 - cos( ep1 * pik) * r*C3;
p1y = y0 - sin( ep1 * pik) * r*C3;
p2x = x0 - cos( ep2 * pik) * r*C3;
p2y = y0 - sin( ep2 * pik) * r*C3;
GfxMoveTo( p1x, p1y );
GfxLineTo( p2x, p2y );
p1x = x0 - cos( ep1 * pik) * r*C3;
p1y = y0-10 - sin( ep1 * pik) * r*C3;
p2x = x0 - cos( ep2 * pik) * r*C3;
p2y = y0-10 - sin( ep2 * pik) * r*C3;
SYMBOL( -1000-aspect, Hfont * r/120, (p1x+p2x)/2, (p1y+p2y)/2 );
}
else
{
p1x = x0 - cos( ep1 * pik) * r*C3*0.92;
p1y = y0-10 - sin( ep1 * pik) * r*C3*0.92;
p2x = x0 - cos( ep2 * pik) * r*C3*0.92;
p2y = y0-10 - sin( ep2 * pik) * r*C3*0.92;
SYMBOL( -1000-aspect, Hfont * r/120, (p1x+p2x)/2, (p1y+p2y)/2 );
}
printf( SQname(p1) + "\t< " + NumToStr(asp,3.2) + PRINTASP(asp[bx], ORB, p1, p2) + " >\t" + SQname(p2) + "\n");
}
}
}
}

printf( "\n << House Cuspids >>\n" );
Hsys = "P";
GfxSelectPen( colorGrey50, 1, 0 );
Hfont *= r/120;
SQih(TZ, Hsys, Lat, Lon, bx );
for( z = 1; z <= 12; z++ )
{
Cusp = VarGet( "Cusp" + z )*-1;
p1x = x0 - cos( Cusp * pik) * r*C3;
p1y = y0 - sin( Cusp * pik) * r*C3;
p2x = x0 - cos( Cusp * pik) * r*C1*1.14;
p2y = y0 - sin( Cusp * pik) * r*C1*1.14;
GfxMoveTo( p1x, p1y );
GfxLineTo( p2x, p2y );

p1x = x0 - cos( Cusp * pik) * r*C3;
p1y = y0-10 - sin( Cusp * pik) * r*C3;
p2x = x0 - cos( Cusp * pik) * r*C1*1.2;
p2y = y0-10 - sin( Cusp * pik) * r*C1*1.2;

Hstr = "[" + NumToStr( z, 0.0) + "]";
GfxSetTextColor( colorViolet );

if( z == 1 && (AlmostEqual(Cusp1, AscMC0, 999)
|| AlmostEqual(360-Cusp1, AscMC0, 999)) )
{
GfxSetTextColor( colorBlue );
SYMBOL( -30, Hfont, p2x, p2y );
Hstr = "";
}
if( z == 4 && (AlmostEqual(Cusp4, abs(AscMC1-180), 999)
|| AlmostEqual(360-Cusp4, abs(AscMC1-180), 999)) )
{
GfxSetTextColor( colorBlue );
SYMBOL( -33, Hfont, p2x, p2y );
Hstr = "";
}
if( z == 7 && (AlmostEqual(Cusp7, abs(AscMC0-180), 999)
|| AlmostEqual(360-Cusp7, abs(AscMC0-180), 999)) )
{
GfxSetTextColor( colorBlue );
SYMBOL( -32, Hfont, p2x, p2y );
Hstr = "";
}
if( z == 10 && (AlmostEqual(Cusp10, AscMC1, 999)
|| AlmostEqual(360-Cusp10, AscMC1, 999)) )
{
GfxSetTextColor( colorBlue );
SYMBOL( -31, Hfont, p2x, p2y );
Hstr = "";
}

GfxSetTextAlign( 6 );
GfxSelectFont("Tahoma", Hfont*0.7, 700 );
GfxTextOut( Hstr, p2x, p2y );

Cusp *= -1;
zod = floor(Cusp/30);
grad1 = Cusp - zod * 30;

printf( "[ %0.0f ]\t" + ZODIACNAME(zod[bx]) + " %0.0f°%0.0f' \t" + "\n", z, floor(grad1), grad2 );
}

_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", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );

//
_SECTION_END();

#### bbhanushali

##### Active Member
hi,
i am looking for an indicator that can show me how much change is there from yday close and CP (running) of today in % and points. there is an indicator i am not able to find showing the same thing once overlayed on chart. can somebody please share.
@primitivetrader : In case you are looking for just numbers on price panel, then here it is, just drag and drop the code on price chart. Hope it helps. Thnx.
Code:
``````_SECTION_BEGIN("Percent Point Change from Previous Day Close on Price Panel");

showChangeValues = ParamToggle("Show Change Value?","No|Yes",0);//Use this toggle to show or not to show change values on chart pane

C1 = TimeFrameGetPrice("C", inDaily, -1); // yesterdays close
TC = Close; //Current close
Diff = TC-C1;
Percent = (Diff/C1)*100;

nd = Day()!=Ref(Day(),-1);
prc = Valuewhen(nd,Ref(Percent,-1));
Percentcolor = iIf(Percent>prc,1,0);

x=Param("xposn",895,0,1000,1);// Use to move around on your chart horizontally
y=Param("yposn",25,0,1000,1);// Use to move around on your chart vertically

if(showChangeValues)
{
GfxSetBkMode( 1 );
GfxSelectFont("Courier New", 18, 700 );
GfxSetTextColor( colorblue );
GfxTextOut(""+WriteVal(TC,1.2), x,y);
if(Percentcolor=1)
{GfxSetTextColor(colorgreen);}//above previous day close percent/diff

if(Percentcolor=0)
{GfxSetTextColor(colorred);}// below previous day close percent/diff
GfxSelectFont("Courier New", 8, 700 );
GfxTextOut(""+WriteVal(Diff,1.2),x,y+23);
GfxTextOut("("+WriteVal(Percent,1.2)+"%)",x+45,y+23);

}

_SECTION_END();``````

##### Well-Known Member
@primitivetrader : In case you are looking for just numbers on price panel, then here it is, just drag and drop the code on price chart. Hope it helps. Thnx.
Code:
``````_SECTION_BEGIN("Percent Point Change from Previous Day Close on Price Panel");

showChangeValues = ParamToggle("Show Change Value?","No|Yes",0);//Use this toggle to show or not to show change values on chart pane

C1 = TimeFrameGetPrice("C", inDaily, -1); // yesterdays close
TC = Close; //Current close
Diff = TC-C1;
Percent = (Diff/C1)*100;

nd = Day()!=Ref(Day(),-1);
prc = Valuewhen(nd,Ref(Percent,-1));
Percentcolor = iIf(Percent>prc,1,0);

x=Param("xposn",895,0,1000,1);// Use to move around on your chart horizontally
y=Param("yposn",25,0,1000,1);// Use to move around on your chart vertically

if(showChangeValues)
{
GfxSetBkMode( 1 );
GfxSelectFont("Courier New", 18, 700 );
GfxSetTextColor( colorblue );
GfxTextOut(""+WriteVal(TC,1.2), x,y);
if(Percentcolor=1)
{GfxSetTextColor(colorgreen);}//above previous day close percent/diff

if(Percentcolor=0)
{GfxSetTextColor(colorred);}// below previous day close percent/diff
GfxSelectFont("Courier New", 8, 700 );
GfxTextOut(""+WriteVal(Diff,1.2),x,y+23);
GfxTextOut("("+WriteVal(Percent,1.2)+"%)",x+45,y+23);

}

_SECTION_END();``````
View attachment 42310
thanks a lot this is what i have been looking for

#### wwf

##### Member
hi everybody , can anyone rewrite this code without loop , this is vital for me and im so greatful,

aa = 0;
for(i = 1; i <200; i++)
{
aa += Ref(high,-i)*sqrt(i);
}
Plot(aa,"aa",colorLime,styleLine) ;

#### ram2010

##### Well-Known Member
Need a exploration code for

current day volume greater than last 5 days average volume-

Any one?

#### bbhanushali

##### Active Member
thanks a lot this is what i have been looking for
@primitivetrader : Code below is with minor corrections. Thnx.
Code:
``````_SECTION_BEGIN("Percent Point Change from Previous Day Close on Price Panel");

showChangeValues = ParamToggle("Show Change Value?","No|Yes",0);//Use this toggle to show or not to show change values on chart pane

C1 = TimeFrameGetPrice("C", inDaily, -1); // yesterdays close

TC = Close; //Current close

Diff = TC-C1;
Percent = (Diff/C1)*100;

nd = Day()!=Ref(Day(),-1);
prc = Valuewhen(nd,Ref(Percent,-1));
Percentcolor = WriteIf(Percent>prc,"Up","Dn");

x=Param("xposn",895,0,1000,1);// Use to move around on your chart horizontally
y=Param("yposn",25,0,1000,1);// Use to move around on your chart vertically

if(showChangeValues)
{
GfxSetBkMode( 1 );
GfxSelectFont("Courier New", 18, 700 );
GfxSetTextColor( colorblue );
GfxTextOut(""+WriteVal(TC,1.2), x,y);

if(Percentcolor=="Up")
{
GfxSelectFont("Courier New", 8, 700 );
GfxSetTextColor(colorgreen);//above previous day close percent/diff
GfxTextOut(""+WriteVal(Diff,1.2),x,y+23);
GfxTextOut("("+WriteVal(Percent,1.2)+"%)",x+45,y+23);
GfxTextOut("|Y-day Cl = "+WriteVal(prc,1.2)+"% |",x,y+33);//comment this line if you don't want it to appear in chart panel.

}

if(Percentcolor=="Dn")
{GfxSetTextColor(colororange);// below previous day close percent/diff
GfxSelectFont("Courier New", 8, 700 );
GfxTextOut(""+WriteVal(Diff,1.2),x,y+23);
GfxTextOut("("+WriteVal(Percent,1.2)+"%)",x+45,y+23);
GfxTextOut("|Y-day Cls = "+WriteVal(prc,1.2)+"% |",x,y+33);//comment this line if you don't want it to appear in chart panel.
}

}

_SECTION_END();``````

#### wwf

##### Member
hi everybody , can anyone rewrite this code without loop , this is vital for me and im so greatful,

aa = 0;
for(i = 1; i <200; i++)
{
aa += Ref(high,-i)*sqrt(i);
}
Plot(aa,"aa",colorLime,styleLine) ;
can everyone able to solve my problem , Much appreciate of this

Last edited:

#### yusi

##### Well-Known Member
can everyone able to solve my problem , Much appreciate of this
Looked at it; but could not think of a better solution than a loop.

First, you would be dividing aa by sum(sqrt(i)) somewhere before plotting as you seem to be looking at a custom WMA. Second, I imagine that you wanted to write as aa += Ref(high,-i)*sqrt(200 - i);