Regression Trend channels

manojborle

Well-Known Member
#15
Title="sameers nifty options system arrowup:buy call,arrowdown:sell call,triangledown:buyput,triangle up:exit put";

SetChartOptions(0,0,chartGrid30|chartGrid70);
periods = Param( "Periods", 15, 1, 200, 1 );
Colordyn=IIf(TEMA(RSI( periods),5)>MA(TEMA(RSI( periods),5),20),colorGreen,colorRed);
Plot( TEMA(RSI( periods),5), "Sameers nifty option system
Arrowup:Sell put Buy call
arrow down:sellput AND Buy call", Colordyn,stylenotitle);
_SECTION_END();

_SECTION_BEGIN("Bollinger Bands");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorCycle );
Style = ParamStyle("Style");
Plot( BBandTop( P, Periods, Width ), "BBTop" + _PARAM_VALUES(), Color, styleNoTitle );
Plot( BBandBot( P, Periods, Width ), "BBBot" + _PARAM_VALUES(), Color, styleNoTitle );
_SECTION_END();

aa=TEMA(RSI(14),5);
bb=MA(aa,20);
bbt=BBandTop(aa,20,2.5);
bbt=BBandBot(aa,20,2.5);

Buy=Cross(aa,bb) AND C>MA(C,50);
Sell= Cross(bb,aa);
Short=Cross(bb,aa) AND C<MA(C,50);;

Cover=Cross(aa,bb);;
Buy = ExRem( Buy, Sell );
Sell = ExRem( Sell, Buy );
Short=ExRem(Short,Cover);
Cover=ExRem(Cover,Short);

PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorWhite);
PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorWhite);
PlotShapes(IIf(Short,shapeDownTriangle,shapeNone),colorYellow);
PlotShapes(IIf(Cover,shapeUpTriangle,shapeNone),colorYellow);

_SECTION_BEGIN("MA1");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1, 10 );
Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), styleNoTitle );
 

manojborle

Well-Known Member
#16
Title="sameers nifty options system arrowup:buy call,arrowdown:sell call,triangledown:buyput,triangle up:exit put";

SetChartOptions(0,0,chartGrid30|chartGrid70);
periods = Param( "Periods", 15, 1, 200, 1 );
Colordyn=IIf(TEMA(RSI( periods),5)>MA(TEMA(RSI( periods),5),20),colorGreen,colorRed);
Plot( TEMA(RSI( periods),5), "Sameers nifty option system
Arrowup:Sell put Buy call
arrow down:sellput AND Buy call", Colordyn,stylenotitle);
_SECTION_END();

_SECTION_BEGIN("Bollinger Bands");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorCycle );
Style = ParamStyle("Style");
Plot( BBandTop( P, Periods, Width ), "BBTop" + _PARAM_VALUES(), Color, styleNoTitle );
Plot( BBandBot( P, Periods, Width ), "BBBot" + _PARAM_VALUES(), Color, styleNoTitle );
_SECTION_END();

aa=TEMA(RSI(14),5);
bb=MA(aa,20);
bbt=BBandTop(aa,20,2.5);
bbt=BBandBot(aa,20,2.5);

Buy=Cross(aa,bb) AND C>MA(C,50);
Sell= Cross(bb,aa);
Short=Cross(bb,aa) AND C<MA(C,50);;

Cover=Cross(aa,bb);;
Buy = ExRem( Buy, Sell );
Sell = ExRem( Sell, Buy );
Short=ExRem(Short,Cover);
Cover=ExRem(Cover,Short);

PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorWhite);
PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorWhite);
PlotShapes(IIf(Short,shapeDownTriangle,shapeNone),colorYellow);
PlotShapes(IIf(Cover,shapeUpTriangle,shapeNone),colorYellow);

_SECTION_BEGIN("MA1");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1, 10 );
Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), styleNoTitle );
This is not regression channel, but I found it online so shared it here
 
#17
_SECTION_BEGIN("chang's channel");
p= log(Close);
Daysback = Param("Period for Liner Regression Line",21,1,9900,1);
shift = Param("Look back period",0,0,1500,1);


x = Cum(1);
lastx = LastValue( x ) - shift;
aa = LastValue( Ref(LinRegIntercept( p, Daysback), -shift) );
bb = LastValue( Ref(LinRegSlope( p, Daysback ), -shift) );
y = Aa + bb * ( x - (Lastx - DaysBack +1 ) );


LRColor = ParamColor("LR Color", colorCycle );
LRStyle = ParamStyle("LR Style");

LRLine = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y, Null );
Plot( LRLine , "LinReg", LRCOLOR, LRSTYLE ); // styleDots );
Plot( p , "log", LRCOLOR, styleDots ); // styleDots );




SDP = Param("Standard Deviation", 1.16, 0, 6, 0.01);
SD = SDP/2;

width = LastValue( Ref(SD*StDev(p, Daysback),-shift) ); // THIS IS WHERE THE WIDTH OF THE CHANELS IS SET
SDU = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y+width , Null ) ;
SDL = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y-width , Null ) ;

SDColor = ParamColor("SD Color", colorCycle );
SDStyle = ParamStyle("SD Style");

Plot( SDU , "Upper Lin Reg", SDColor,SDStyle );
Plot( SDL , "Lower Lin Reg", SDColor,SDStyle );

SDP2 = Param("2d Standard Deviation", 2.0, 0, 6, 0.01);
SD2 = SDP2/2;

width2 = LastValue( Ref(SD2*StDev(p, Daysback),-shift) ); // THIS IS WHERE THE WIDTH OF THE CHANELS IS SET
SDU2 = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y+width2 , Null ) ;
SDL2 = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y-width2 , Null ) ;

SDColor2 = ParamColor("2 SD Color", colorCycle );
SDStyle2 = ParamStyle("2 SD Style");

Plot( SDU2 , "Upper Lin Reg", SDColor2,SDStyle2 );
Plot( SDL2 , "Lower Lin Reg", SDColor2,SDStyle2 );

_SECTION_END();
 
#18
SetChartBkColor(ParamColor("Background Color",colorBlack));
SetChartOptions(0,chartShowDates);
SetBarFillColor(IIf(C>O,ParamColor("Candle UP
Color",colorGreen),IIf(C<=O,ParamColor("Candle Down
Color",colorRed),colorLightGrey)));

Plot(C,"Price",IIf(C>O,ParamColor("Wick UP
Color",colorDarkGreen),IIf(C<=O,ParamColor("Wick Down
Color",colorDarkRed),colorLightGrey)),64,0,0,0,0);

_SECTION_BEGIN("Linear Reg Channel");
//Plot(Close, "", 55, GetPriceStyle());
P = ParamField("Price field", -1);
Daysback = Param("Period for Linear Regression Channel", 50, 1, 300, 1);
SDP1 = Param("Standard Deviation 1", 1.0, 0, 6, 0.05);
SDP2 = Param("Standard Deviation 2", 2.0, 0, 6, 0.05);
SDP3 = Param("Standard Deviation 3", 3.0, 0, 6, 0.05);
ext = Param("extend Linear Regression Channel", 15, 0, 50, 1);
shift = Param("Look back period", 0, 0, 240, 1);
Collg = ParamColor("Color Linear Reg Line", colorRed);
Colsd1 = ParamColor("Color StDev 1", colorBlue);
Colsd2 = ParamColor("Color StDev 2", colorLime);
Colsd3 = ParamColor("Color StDev 3", colorGold);
SDP1 = SDP1/2;
SDP2 = SDP2/2;
SDP3 = SDP3/2;
pds = Daysback;
x = BarIndex() + 1;
sx = SelectedValue(x)-shift;
aa = SelectedValue(Ref(LinRegIntercept(P, pds), -shift));
bb = SelectedValue(Ref(LinRegSlope(P, pds), -shift));
StDev0 = StDev(P, pds);
fd1 = SelectedValue(Ref(SDP1 * StDev0, -shift) );
fd2 = SelectedValue(Ref(SDP2 * StDev0, -shift) );
fd3 = SelectedValue(Ref(SDP3 * StDev0, -shift) );
ys = SelectedValue(ValueWhen(x, aa, 1));
yi = SelectedValue(ValueWhen(x, bb, 1));
xs = sx - pds;
d = ext;//Shift Line Right
xe = xs + pds + d;
ye = ys + yi * (xe - xs);
sty = 1|32|2048;
Plot(LineArray(xs-d,ys,xe-d,ye,1),"",Collg,sty,0,0,d);
Plot(LineArray(xs-d,ys-fd1,xe-d,ye-fd1,1),"",Colsd1,sty,0,0,d);
Plot(LineArray(xs-d,ys+fd1,xe-d,ye+fd1,1),"",Colsd1,sty,0,0,d);
Plot(LineArray(xs-d,ys-fd2,xe-d,ye-fd2,1),"",Colsd2,sty,0,0,d);
Plot(LineArray(xs-d,ys+fd2,xe-d,ye+fd2,1),"",Colsd2,sty,0,0,d);
Plot(LineArray(xs-d,ys-fd3,xe-d,ye-fd3,1),"",Colsd3,sty,0,0,d);
Plot(LineArray(xs-d,ys+fd3,xe-d,ye+fd3,1),"",Colsd3,sty,0,0,d);
_SECTION_END();
 
#19
// Andrews Pitchfork V3.3
//
// Use Peak() & Trough() to get peaks & troughs.
// This version deals with adjacent peaks and adjacent
// troughs, i.e. two peaks without an intervening trough or vice-versa.
// It goes backwards from the selected bar until it has a set of
// peak,trough,peak or trough,peak,trough points to use for calulating
// the pitchfork. When 2 or more peaks or 2 or more troughs are adjacent
// it only uses the last one, i.e. the rightmost one, of the series.
//
// This version only uses the zigzag peak troughs after they have been
// revealed by the subsequent price action. i.e. the price has to have
// moved off the high/low by the zigzag pct before the peak or trough will
// be used.
//
// This version plots the trendlines as exponential curves that plot as
// straight lines on an semilog chart.
//


SetChartBkColor(ParamColor("bkcolor",colorLightGrey));

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

si = Param( "Zoom/In Out", 5, -30, 30, 1 );
GraphXSpace = si;

////////////////////////////////////////////////////////REGRESION LINEAL /////////////////////////////////////////////////////////////////////

LookBack = Param( "Lookback (RegressionChannel)", 17, 2, 300 );

NH = LastValue( HHVBars( High, LookBack ) ); // lookback period - can be set by the user if necessary
NL = LastValue( LLVBars( Low , LookBack ) ); // lookback period - can be set by the user if necessary

N = 0;

if ( NL > NH )
{
N = NL;
}
else
{
N = NH;
}

Start = 1;

X = Cum( Start ); // Set up the x cordinate array of the Linear Regression Line
Y = Close; // Set the y co-ordinate of the Linear Regression line

/* Calculate the slope (bconst) and the y intercept (aconst) of the line */

SUMX = LastValue( Sum( X, N ) );
SUMY = LastValue( Sum( Y, N ) );
SUMXY = LastValue( Sum( X * Y, N ) );
SUMXSqd = LastValue( Sum( X * X, N ) );
SUMSqdX = LastValue( SUMX * SUMX );

bconst = ( N * SUMXY - SUMX * SUMY ) / ( N * SUMXSqd - SUMSqdX );
aconst = ( SUMY - bconst * ( SUMX ) ) / N;

/* Force the x value to be very negative so the graph does not apear before the
lookback period */

Domain = IIf ( X > LastValue( X ) - N, 1 , -1e10 );
Xvar = X * Domain;

/* Linear Regression Line */

Yvar = aconst + bconst * Xvar;

Plot( Yvar + LastValue( HHV( High - Yvar, N ) ), "Upper Channel", colorBrown, styleDots | styleNoLabel );
Plot( Yvar, "Middle Channel", colorBrown, styleDots | styleNoLabel );
Plot( Yvar - LastValue( HHV( Yvar - Low , N ) ), "Lower Channel", colorBrown, styleDots | styleNoLabel );

numbars = SelectedValue( Cum( Status( "barvisible" ) ) );
fraction = IIf( StrRight( Name(), 3 ) == "", 3.2, 3.2 );

hts = Param ( "Text Shift", -50, -100, 100, 10 );

PlotText( "" + WriteVal( Yvar + LastValue( HHV( High - Yvar, N ) ), fraction ),
SelectedValue( BarIndex() + 13 ) - 13, SelectedValue( Yvar + LastValue( HHV( High - Yvar, N ) ) ), 2 );

PlotText( "" + WriteVal( Yvar, fraction ),
SelectedValue( BarIndex() + 13 ) - 13, SelectedValue( Yvar ), 2 );

PlotText( "" + WriteVal( Yvar - LastValue( HHV( Yvar - Low , N ) ), fraction ),
SelectedValue( BarIndex() + 13 ) - 13, SelectedValue( Yvar - LastValue( HHV( Yvar - Low , N ) ) ), 2 );

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

SetBarsRequired( 999999,999999);

echng=0;
bi=BarIndex();
sbi=SelectedValue(bi);

// Pct threshhold for peak() & trough()

Zigpct=Param("Zigpct",4.6,1.0,30.0,0.1,0);

// Since the Zig function only works on a single array, to get a true
// High/Low peak/trough have to approximate it by an EMA choosing the
// High/Low based on the direction the EMA is moving. Very occasionally
// it misses the correct High/Low. To just use value, for example the close,
// just change zpr=IIf(ROC(zema,1) > 0,H,L); to zpr=C;
zema=EMA(C,14);
zpr=IIf(ROC(zema,1) > 0,H,L);
zag=Zig(zpr,zigpct);
tr=Ref(zag,-1) > zag AND zag < Ref(zag,1);
pk=Ref(zag,-1) < zag AND zag > Ref(zag,1);
pkprice=ValueWhen(pk,zpr);
trprice=ValueWhen(tr,zpr);

// This bit is still valid at the right edge. If price moves far enough in 1 Day to show
// a peak or trough on the last bar, the peak or trough won't go away later. The pk_id OR
// tr_id (below) will appear on the same bar. Normally peaks & troughs appear in 'the past',
// e.g. the high 10 days ago wasn't a peak yesterday but today it is because the price dropped
// enough to make it a peak.
pklast=IIf(BarsSince(pk) < BarsSince(tr),1,0);
trlast=IIf(BarsSince(tr) < BarsSince(pk),1,0);

// A peak or trough is defined as the price moving X pct down or up from a high OR Low.
// The identification point is when the price has actually moved that far. The Peak/Trough
// will appear 'in the past' on the same day as the pk_id or tr_id appears on the rightmost
// bar.
// Use 'OR tr/OR pk' because when the bar that reveals the pk/tr is also a pk/tr the pklast/
// trlast will have flipped.
// Can't use cross of H or L in the 2nd AND because the H or L may not get above OR below the
// trigger price when the pk/tr occurs.
// The NOT conditions eliminate same-day pk/tr pk_id/tr_id cases. i.e. when the Day's price
// range was >= zpct on the pk/tr day.
pk_id=((pklast OR tr) AND pkprice*(1-(zigpct*0.01)) > L ) AND NOT ( pk AND (H - L)/L >= 0.01 * zigpct);
tr_id=((trlast OR pk) AND H > trprice*(1+(zigpct*0.01)) ) AND NOT ( tr AND (H - L)/L >= 0.01 * zigpct);

// The pk_id/tr_id conditions can recur before the next pk or tr
pk_id=ExRem(pk_id,tr_id);
tr_id=ExRem(tr_id,pk_id);

pk_idlast=IIf(BarsSince(pk_id) < BarsSince(tr_id),1,0);
tr_idlast=IIf(BarsSince(tr_id) < BarsSince(pk_id),1,0);

Lookbk=IIf(pk_idlast,BarsSince(pk),BarsSince(tr));

// How many bars to extend the pitchfork past the selected bar.
xtsn=Param("Extension",62,1,2500,1);

// Shift to move pitchfork up/down from original position one penny at time.
shift=Param("Shift",0,-2000,2000,0.01);

// Filter out cases when the angle of the median lines is too extreme,
// The loop will continue until it finds a pitchfork whose slope falls
// between +- the Angle Limit. Setting the angle limit to 90 effectively
// turns it off.
alimit=Param("Angle Limit",40,1,180,1);

// bkgrndcolor should match your background color. It's used to mask the
// parts of the pitchfork arrays outside the calculated pitchfork from view.
bkgrndcolor=ParamColor("Background Color",colorWhite);
pitchforkcolor=ParamColor("Pitchfork Color",colorWhite);

// The peak/trough lines will be used to determine the y coordinates
// of the pitchfork's 3 determining points.

//pline1=Peak(H,Zigpct,1);
//tline1=Trough(L,Zigpct,1);
pline1=pkprice;
tline1=trprice;
// Identify the pivots.

pzag1=pline1 != Ref(pline1,-1);
tzag1=tline1 != Ref(tline1,-1);

// Get the x,y coordinates of the pivots skipping adjacent
// peaks and troughs. Go backwards from the current bar minus the lookback.

// These will hold the x,y coordinates of the pivot points in arrays at the
// sbi index.

zagx1=0;
zagx2=0;
zagx3=0;
zagy1=0;
zagy2=0;
zagy3=0;

for ( i = sbi - Lookbk[sbi], zagfnd = 0, pzagfnd = 0, tzagfnd = 0 ; i >= 0 && zagfnd < 3; i-- ) {
if ( pzag1 || tzag1 ) {
if ( pzag1 && NOT pzagfnd ) {
zagfnd=zagfnd+1;
pzagfnd=1;
tzagfnd=0;
if ( zagfnd == 1 ) {
zagx1[sbi]=i;
zagy1[sbi]=pline1;
} else if (zagfnd == 2) {
zagx2[sbi]=i;
zagy2[sbi]=pline1;
} else if (zagfnd == 3) {
zagx3[sbi]=i;
zagy3[sbi]=pline1;
}
} else if ( tzag1 && NOT tzagfnd ) {
zagfnd=zagfnd+1;
tzagfnd=1;
pzagfnd=0;
if ( zagfnd == 1 ) {
zagx1[sbi]=i;
zagy1[sbi]=tline1;
} else if (zagfnd == 2) {
zagx2[sbi]=i;
zagy2[sbi]=tline1;
} else if (zagfnd == 3) {
zagx3[sbi]=i;
zagy3[sbi]=tline1;
}
}
}

if ( zagfnd == 3 ) { // Got 3 candidate peak/trough points

echng=0;
midx=0;
midy=0;
Handle=0;
Top=0;
Bot=0;

// Determine Midpoint between the rightmost 2 pivots and the slope from the
// leftmost pivot to the midpoint.

Midx[sbi]=zagx2[sbi] + (zagx1[sbi]-zagx2[sbi]) / 2;
Midy[sbi]=exp( log(zagy1[sbi]) - ( log(zagy1[sbi])-log(zagy2[sbi]) ) /2);
echng=(log(midy[sbi])-log(zagy3[sbi]))/(midx[sbi]-zagx3[sbi]);

// Apply the Angle Limit filter

angle_rad = atan(echng);//radians
angle_deg = 100 * angle_rad * 180/3.1416;//degrees

if ( angle_deg < -alimit || angle_deg > alimit ) { // Too steep, reset the search
// to begin from the 2nd pivot found
if ( tzagfnd == 1 ) { // was tr,pk,tr so switch to pk,tr,pk
tzagfnd = 0;
pzagfnd = 1;
zagfnd = 1;
zagx1[sbi]=zagx2[sbi];
zagy1[sbi]=zagy2[sbi];
i = zagx1[sbi];
zagx2=0;
zagx3=0;
zagy2=0;
zagy3=0;
} else { // was pk,tr,pk so switch to tr,pk,tr
tzagfnd = 1;
pzagfnd = 0;
zagfnd = 1;
zagx1[sbi]=zagx2[sbi];
zagy1[sbi]=zagy2[sbi];
i = zagx1[sbi];
zagx2=0;
zagx3=0;
zagy2=0;
zagy3=0;
}
}
}
}

// Calculate the Pitchfork itself

// Handle first

for ( j=zagx3[sbi],n=0 ; j < Min(sbi+xtsn,BarCount) ; j++,n++ ) {
Handle[j]=exp(log(zagy3[sbi]) + n*echng) + shift;
}

// High & low median lines.
if ( (exp(log(zagy2[sbi]) + (sbi-zagx2[sbi])*echng))
> (exp(log(zagy1[sbi]) + (sbi-zagx1[sbi])*echng)) ) { // Which one is top?
for ( j=zagx2[sbi],n=0 ; j < Min(sbi+xtsn,BarCount) ; j++,n++ ) {
top[j]=exp(log(zagy2[sbi]) + n*echng) + shift;
}
for ( j=zagx1[sbi],n=0 ; j < Min(sbi+xtsn,BarCount) ; j++,n++ ) {
bot[j]=exp(log(zagy1[sbi]) + n*echng) + shift;
}
} else {
for ( j=zagx2[sbi],n=0 ; j < Min(sbi+xtsn,BarCount) ; j++,n++ ) {
bot[j]=exp(log(zagy2[sbi]) + n*echng) + shift;
}
for ( j=zagx1[sbi],n=0 ; j < Min(sbi+xtsn,BarCount) ; j++,n++ ) {
top[j]=exp(log(zagy1[sbi]) + n*echng) + shift;
}
}

Hcolor=IIf(Handle==0,bkgrndcolor,IIf(Ref(handle,-1)== 0 AND handle != 0, bkgrndcolor,pitchforkcolor));
Tcolor=IIf(Top==0,bkgrndcolor,IIf(Ref(top,-1)== 0 AND top != 0, bkgrndcolor,pitchforkcolor));
Bcolor=IIf(Bot==0,bkgrndcolor,IIf(Ref(bot,-1)== 0 AND bot != 0, bkgrndcolor,pitchforkcolor));

Htitle=EncodeColor(pitchforkcolor)
+ StrFormat("\nAndrews: pct=%g lkbk=%g shft=%g alimit=%g Angle=%3.2f
Handle=",Zigpct, Lookbk, shift, alimit, 100 * atan(echng) * 180/3.1416);

Plot(Handle,Htitle,Hcolor,styleLine+styleThick+styleNoRescale);
Plot(Bot,EncodeColor(pitchforkcolor)+"Bot=",colorGreen,styleLine+styleThick+styleNoRescale);
Plot(Top,EncodeColor(pitchforkcolor)+"Top=",colorViolet,styleLine+styleThick+styleNoRescale);

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

_SECTION_BEGIN("In Daily Price");
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 ) ) ));

TimeFrameSet(inDaily);
MA3 = MA(C,3);
Cl = C;
TimeFrameRestore();
MA3=(TimeFrameExpand( MA3, inDaily));
Cl=(TimeFrameExpand( Cl, inDaily));
barcolor =IIf(C > O , colorPaleGreen,IIf(C < O,colorPink, colorBlack ) );

PlotOHLC( IIf(Open<Close, Open, Close),High,Low,
IIf(Open<Close, Close, Open), "Close", barColor, styleBar+styleThick+styleNoTitle );

_SECTION_END();

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

_SECTION_BEGIN("Price, Hawamer");

SetBarsRequired(sbrAll);
daynum= Now(9);//day of the week
SatSun= IIf((daynum==1 OR daynum==7),1,0);
dec= IIf(StrRight(Name(),3) == "", 3.2, 3.2);
dec= (Param("Decimals",2,0,7,1)/10)+1;
uc= ParamColor("Up Candle Fill Color",19);
dc= ParamColor("Dn Candle Fill Color",24);
nc= ParamColor("Neutral Fill Color",16);
bc= BarCount-1;
x= BarIndex();
Lx= LastValue(x);
sx= SelectedValue(x);
//==============================
SetBarFillColor(IIf(C>O,43,IIf(C<O,32,nc)));
Plot(C,"",IIf(C>O,27,IIf(C<O,38,16)),64);

_SECTION_END();

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

_SECTION_BEGIN( "Magnified Market Price" );
//by Vidyasagar, [email protected]//
FS = Param( "Font Size", 25, 11, 100, 1 );
GfxSelectFont( "Times New Roman", FS, 700, True );
GfxSetBkMode( colorWhite );
GfxSetTextColor( ParamColor( "Color", colorWhite ) );
Hor = Param( "Horizontal Position", 420, 1, 1200, 1 );
Ver = Param( "Vertical Position", 100, 1, 830, 1 );
GfxTextOut( "" + C, Hor , Ver );
GfxTextOut( Name(), Hor, Ver-50 );

GfxSetTextColor( ParamColor( "ColorY", colorWhite ) );
GfxTextOut( "" + V, Hor , Ver + 45 );

YC = TimeFrameGetPrice( "C", inDaily, -1 );
DD = Prec( C - YC, 2 );
xx = Prec( ( DD / YC ) * 100, 2 );
GfxSelectFont( "Times New Roman", 20, 700, True );
GfxSetBkMode( colorWhite );
GfxSetTextColor( ParamColor( "Color", colorRed ) );
GfxTextOut( "" + DD + " (" + xx + "%)", Hor , Ver + 90 );

_SECTION_END();

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 

wabuf

Well-Known Member
#20
hi shruti trader.

did you get the afl for regression channel (preferably non repainting) ? I am myself looking for one though. Pl kindly post the afl if possible.

Thank you
 
Last edited:

Similar threads