Rsi Bar afl covertion

johnnypareek

Well-Known Member
#31
Hello Johhny,

Well gr8 afl..

Would u please help to make..Macd-ADX Ribbon for Buy - Sell - Neutral portion in 3 part?
HTML:
uptrend= Signal(18)<MACD(7);
downtrend= Signal(18)>MACD(7);
PRSI=adx(8)>25 ;

Plot( 2, /* defines the height of the ribbon in percent of pane width */"ribbon",
IIf( uptrend and prsi, colorGreen, IIf( downtrend and prsi, colorRed, yellow )), /* choose color */
styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );

paste this in that afl please change value as per ur requirment or like in that afl
 
#32
Hi Anand23983...

Could u plz post the afl here?

This is Repainting afl for macd and adx combination for Johnny sir info


_SECTION_BEGIN("ADX + RSI + MACD");
// This combines three indicators into one timing Signal
//function ParamOptimize( description, default, minv, maxv, step )
// { return Optimize(description, Param(description,default, minv, maxv, step ), minv, maxv, step ); }
tgl = ParamToggle("Result", "AND logic|Compare");
// adx di lines
Plot( ADX(14), _DEFAULT_NAME(), ParamColor( "ADX color", colorBlue), ParamStyle("ADX style", styleDots ) );
range = Param("ADX Periods", 14, 2, 200, 1 );
myPdi = PDI(range );
myMdi = MDI(range );
upAdx = IIf( myPdi > myMdi, 1, 0);
// macd
r1 = Param( "Macd Fast avg", 13, 2, 200, 1 );
r2 = Param( "Macd Slow avg", 34, 2, 200, 1 );
r3 = Param( "Macd Signal avg", 8, 2, 200, 1 );
myMacd = MACD(r1,r2);
mySignal = Signal(r1,r2,r3);
upMacd = IIf(myMacd > mySignal, 1, 0);
// switch test calculation and compare the results
if(tgl)
{
myBuy = upAdx AND upMacd;
myShort = !upAdx AND !upMacd;
}
else
{
myBuy = IIf( myMacd > mySignal AND myPdi > myMdi,1,0);
myShort = IIf( myMacd < mySignal AND myPdi < myMdi,1,0);
}
Buy = Cover = ExRem(myBuy, myShort);
Short = Sell = ExRem(myShort, myBuy);
Plot( Buy * C, "ADX(" + NumToStr(range,1.0) + ") + MACD(" + NumToStr(r1,1.0) + "," + NumToStr(r2,1.0) + "," + NumToStr(r3,1.0) + ") - myBuy ", colorGreen); // a positive spike that indicates a buy or cover trade.
Plot( -Short * C , "myShort ", colorRed);

PlotShapes( Buy * shapeUpArrow + Sell * shapeDownArrow, IIf( Buy, colorGreen, colorRed ) );


AlertIf( Buy , "SOUND C:\\Windows\\Media\\chimes.wav", "Audio alert", 2 );
AlertIf( Sell , "SOUND C:\\Windows\\Media\\alert.wav", "Audio alert", 2 );
// exploration
Filter = Buy OR Short;
AddColumn(Close, "Close", 1.2);
AddColumn(Buy, "Buy", 1.0);
AddColumn(Short, "Short",1.0);
_SECTION_END();

trendup = IIf(MACD(12,26) > 0 AND MACD(12,26) > Signal(12,26,9), colorGreen, colorWhite);
trendcolor = IIf(MACD(12,26) < 0 AND MACD(12,26) < Signal(12,26,9), colorRed, trendup);
//Plot( C, "Close", trendcolor, styleBar | styleThick );

//RSIup = RSI(7) > 70;
//RSIdown = RSI(7) < 30;

sp = Param( "RSI Period", 14, 1, 100 );
r = RSI( sp );
RSIup = r > 70;
RSIdown = r < 30;

shape = RSIup * shapeNone + RSIdown * shapeNone;
PlotShapes(shape, IIf( RSIup, colorBrightGreen, colorRed ), 0, IIf( RSIup, Low, High ) );
Plot( 1, "", TRENDCOLOR , styleOwnScale|styleHistogram+styleThick| styleNoLabel, -0.1, 25 );
//Plot( 1, "", TREND, styleArea | styleOwnScale | styleNoLabel, -0.1, 50 );

_SECTION_END();
 
#34
Dear johnny sir,

Previous one afl modified following, is this afl correct or not and which one can
i follow the stoploss for the long or short entry, if correct say to me sir i need some cosmetic for this afl form you i need latter

_SECTION_BEGIN("Chart Settings");

SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkColor(ColorBlend(colorBlack, colorBlack, 0.2));
strWeekday = StrMid("SunMonTueWedThuFriSat", SelectedValue(DayOfWeek())*3,3);
GraphXSpace=Param("GraphXSpace",24,0,100,1);
_N(Title = StrFormat("{{NAME}}- {{INTERVAL}} {{DATE}} O= %g, H= %g, L= %g, C= %g (%.1f%%) V= " +WriteVal( V, 1.0 ) +"\n{{VALUES}}", O, H, L, C,

SelectedValue( ROC( C, 1 )) ));

//===========================================================================================//=================TITLE================================================================================================
_SECTION_BEGIN("Price Ploting");

pricestyle=ParamToggle("Price style","Bar|Candle",1);
if (pricestyle == 1)
{
Candlefill = IIf(C>=Ref(C,-1),ParamColor("Green candle",colorGreen),ParamColor("red candle",colorRed) );
SetBarFillColor (Candlefill);
PlotOHLC( Open, High, Low, Close, "", Candlefill, styleCandle,maskPrice);
}
if (pricestyle == 0)
{
Candlefill = IIf(C>=Ref(C,-1),ParamColor("Green candle",colorLime),ParamColor("red candle",colorRed) );
PlotOHLC( Open, High, Low, Close, "", Candlefill, styleBar,maskPrice);
}

pbfak= Param("Pin Bar Factor",3,0,100,0.25);
CR = abs(H-L);
CB = abs(O-C);
Candlecheck = IIf((CR >=(pbfak*CB)),1,0);
SetBarFillColor (IIf(Candlecheck ==1,candlefill,colorBlack));
PlotOHLC( Open, High, Low, Close, "", IIf(Candlecheck ==1,Candlefill,colorBlack), styleCandle,maskPrice);

_SECTION_END();
//=================TITLE================================================================================================

_SECTION_BEGIN("Advanced Trend Lines");
ShowSR = ParamToggle("Show Vert S/R","No|Yes", 1);
SRPer = Param("S/R Percentage", 0.5, 0.1,50,0.1);
SRBack = Param("S/R Back", 1, 1,10,1);
function GetXSupport(Lo, Percentage, Back)
{
return ((BarCount - 1) - LastValue(TroughBars(Lo, Percentage,Back)));
}
function GetYSupport(Lo, Percentage, Back)
{
return (LastValue(Trough(Lo, Percentage, back)));
}

function GetXResistance(Hi, Percentage, Back)
{
return ((BarCount - 1) -LastValue(PeakBars(Hi, Percentage, Back)));
}
function GetYResistance(Hi, Percentage, Back)
{
return (LastValue(Peak(Hi, Percentage, Back)));
}

if(ShowSR)
{
for(i=1; i<=SRBack; i++)
{
x0 = GetXSupport(L, SRPer, i);
x1 = BarCount-1;
y0 = GetYSupport(L, SRPer, i);
x = LineArray(x0, y0, x1, y0, 0);
Plot(x, "", IIf(LastValue(C) > x, colorDarkGrey, colorViolet), styleLine|styleDashed|styleThick);
x0 = GetXResistance(H, SRPer, i);
y0 = GetYResistance(H, SRPer, i);
x = LineArray(x0, y0, x1, y0, 0);
Plot(x, "", IIf(LastValue(C) > x, colorDarkGrey, colorViolet), styleLine|styleDashed|styleThick);

}
}


//=========================================================================================
_SECTION_BEGIN("Magnified Market Price");
FS=Param("Font Size",20,11,100,1);
GfxSelectFont("Arial", FS, 400, italic = False, underline = False, True );
GfxSetBkMode( colorWhite );
GfxSetTextColor( ParamColor("Color",colorGreen) );
Hor=Param("Horizontal Position",625,1,1200,1);
Ver=Param("Vertical Position",1,500,1,1);
GfxTextOut("CMP "+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",colorWhite) );
//GfxTextOut(""+DD+" ("+xx+"%)", Hor+5, Ver+45 );

_SECTION_END();


_SECTION_BEGIN("ADX + EMA + MACD");
// This combines three indicators into one timing Signal
//function ParamOptimize( description, default, minv, maxv, step )
// { return Optimize(description, Param(description,default, minv, maxv, step ), minv, maxv, step ); }
tgl = ParamToggle("Result", "AND logic|Compare");
// ema
emaPrice = ParamField("Ema Price field", 3);
PeriodShort = Param("Ema Short Periods", 5, 2, 20, 1);
PeriodLong = Param("Ema Long Periods", 15, 2, 100, 1);
pS = EMA(emaPrice , PeriodShort);
pL = EMA(emaPrice , PeriodLong);
upEma = IIf(pS > pL, 1, 0); // fast ema is above slow, long condition


// adx di lines
//Plot( ADX(14), _DEFAULT_NAME(), ParamColor( "ADX color", colorBlue), ParamStyle("ADX style", styleDots ) );
range = Param("ADX Periods", 14, 2, 200, 1 );
myPdi = PDI(range );
myMdi = MDI(range );
upAdx = IIf( myPdi > myMdi, 1, 0);
// macd
r1 = Param( "Macd Fast avg", 13, 2, 200, 1 );
r2 = Param( "Macd Slow avg", 34, 2, 200, 1 );
r3 = Param( "Macd Signal avg", 8, 2, 200, 1 );
myMacd = MACD(r1,r2);
mySignal = Signal(r1,r2,r3);
upMacd = IIf(myMacd > mySignal, 1, 0);
// switch test calculation and compare the results
if(tgl)
{
myBuy = upEma AND upAdx AND upMacd;
myShort = !upEma AND!upAdx AND !upMacd;
}
else
{
myBuy = IIf( myMacd > mySignal AND myPdi > myMdi,1,0);
myShort = IIf( myMacd < mySignal AND myPdi < myMdi,1,0);
}
Buy = Cover = ExRem(myBuy, myShort);
Short = Sell = ExRem(myShort, myBuy);
//Plot( Buy * C, "ADX(" + NumToStr(range,1.0) + ") + MACD(" + NumToStr(r1,1.0) + "," + NumToStr(r2,1.0) + "," + NumToStr(r3,1.0) + ") - myBuy ", colorGreen); // a positive spike that indicates a buy or cover trade.
//Plot( -Short * C , "myShort ", colorRed);

PlotShapes( Buy * shapeUpArrow + Sell * shapeDownArrow, IIf( Buy, colorWhite, colorLightOrange ) );

AlertIf( Buy , "SOUND C:\\Windows\\Media\\chimes.wav", "Audio alert", 2 );
AlertIf( Sell , "SOUND C:\\Windows\\Media\\alert.wav", "Audio alert", 2 );

// exploration
Filter = Buy OR Short;
AddColumn(Close, "Close", 1.2);
AddColumn(Buy, "Buy", 1.0);
AddColumn(Short, "Short",1.0);
_SECTION_END();
 

Bewinner

Well-Known Member
#39
Johnnybro...
It is really very shocking for a family where Cancer steps in...Take ur time and take care of your brother in law....We pray to GOD for him...
 
Last edited:

Bewinner

Well-Known Member
#40
Johnnybro...
It is really very shocking for a family where Cancer steps in...Take ur time and take care of your brother in law....We pray to GOD for him...
 
Last edited:

Similar threads