Formula for this JPG

#2
"Stochastic" indicators with higher period...
 
#3
_SECTION_BEGIN("Time Left");
function GetSecondNum()
{
Time = Now( 4 );
Seconds = int( Time % 100 );
Minutes = int( Time / 100 % 100 );
Hours = int( Time / 10000 % 100 );
SecondNum = int( Hours * 60 * 60 + Minutes * 60 + Seconds );
return SecondNum;
}
RequestTimedRefresh( 1 );
TimeFrame = Interval();
SecNumber = GetSecondNum();
Newperiod = SecNumber % TimeFrame == 0;
SecsLeft = SecNumber - int( SecNumber / TimeFrame ) * TimeFrame;
SecsToGo = TimeFrame - SecsLeft;

x=Param("xposn",300,0,1000,1);
y=Param("yposn",50,0,1000,1);

GfxSelectSolidBrush( ColorRGB( 230, 230, 230 ) );
GfxSelectPen( ColorRGB( 230, 230, 230 ), 2 );
if ( NewPeriod )
{
GfxSelectSolidBrush( colorYellow );
GfxSelectPen( colorYellow, 2 );
Say( "New period" );
}
GfxRoundRect( x+45, y+17, x-3, y-2, 0, 0 );
GfxSetBkMode(1);
GfxSelectFont( "Arial", 12, 700, False );
GfxSetTextColor( colorBlack );
GfxTextOut( ""+SecsToGo+" / "+NumToStr( TimeFrame, 1.0 ), x, y );
_SECTION_END();
_SECTION_BEGIN("Magnified Market Price");
FS=Param("Font Size",20,11,50,1);
GfxSelectFont("Times New Roman", FS, 350, True );
GfxSetBkMode( colorWhite );
GfxSetTextColor( ParamColor("Color",colorBlack ) );
Hor=Param("Horizontal Position",300,1,1200,1);
Ver=Param("Vertical Position",45,1,830,1);
GfxTextOut(""+C, Hor , Ver );
YC=TimeFrameGetPrice("C",inDaily,-1);
DD=Prec(C-YC,2);
xx=Prec((DD/YC)*100,2);
GfxSelectFont("Times New Roman", 11, 700, True );
GfxSetBkMode( colorWhite );
GfxSetTextColor(ParamColor("Color",colorBlack) );
GfxTextOut(""+DD+" ("+xx+"%)", Hor , Ver+45 );

_SECTION_END ();

_SECTION_BEGIN("Stochastic Oscillator");
// Stochastic Oscillator
// www.Stoox.pl

periods = Param( "Periods", 35, 1, 200, 1 );
Ksmooth = Param( "%K avg", 7, 1, 200, 1 );
Dsmooth = Param( "%D avg", 7 , 1, 200, 1 );
Upper=Param("Upper-OB", 75, 50, 100, 1);
Lower=Param("Lower-OS", 25, 0, 50, 1);

_N(Title = StrFormat("{{NAME}} "+"Stochastic(%g,%g,%g)
",periods,Ksmooth,Dsmooth)+"{{VALUES}}");


Plot( StochK( periods , Ksmooth), "%K", ParamColor( "%K Color", colorRed ),
ParamStyle("Style") );
Plot( StochD( periods , Ksmooth, DSmooth ), "%D", ParamColor( "%D Color",
colorAqua ), ParamStyle("Style") );

Plot(Upper,"OB", colorRed ,styleLine);
Plot(Lower,"OS", colorGreen ,styleLine);

_SECTION_END();
 

Similar threads