NIRVANA
NIRVANA
NIRVANA
///////////////////////////////////
SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkGradientFill( ParamColor("Inner panel
upper",colorBlack),ParamColor("Inner panel lower",colorBlack));
Title =
EncodeColor(colorWhite)+ Title = Name () + " | "
+EncodeColor(colorYellow) + Date() +" | " + Interval( 2 )+ " | "
+EncodeColor(colorTurquoise)+ "Op : "+ EncodeColor(colorLightGrey)+ O + " | "
+EncodeColor(colorTurquoise)+ "Hi : "+ EncodeColor(colorLightGrey)+ H + " | "
+EncodeColor(colorTurquoise)+ "Lo : "+ EncodeColor(colorLightGrey)+ L + " | "
+EncodeColor(colorTurquoise)+ "Cls : "+ WriteIf(C> Ref(C,
-1),EncodeColor(colorBrightGreen),EncodeColor(colorRed))+ C + " | "
+EncodeColor(colorTurquoise)+ "Change : ("+ WriteIf(C> Ref(C,
-1),EncodeColor(colorBrightGreen),EncodeColor(colorRed)) + WriteVal(C-Ref(C,-1))+"
Rs."
+EncodeColor(colorTurquoise)+ " /"+ WriteIf(C> Ref(C,
-1),EncodeColor(colorBrightGreen),EncodeColor(colorRed))+ WriteVal( ROC( C, 1 ))
+""+ " % "
+EncodeColor(colorTurquoise)+ ") | Volume : " + WriteIf(V> Ref(V,
-1),EncodeColor(colorBrightGreen),EncodeColor(colorRed))+ WriteVal(V,1);
_SECTION_END();
_SECTION_BEGIN("Nirvana_Ribbon");
GraphXSpace=10;
Var4 =(Low+High+2*Close)/4;
OP = EMA(Var4,a);
res1 = HHV(OP,n);
res2 =HHV(OP,m);
sup2 =LLV(OP,m);
sup1 =LLV(OP,n);
_SECTION_END();
/*
_SECTION_BEGIN("Haiken");
/*m1=MACD(r1,r2);
s1=Signal(r1,r2,r3);
mycolor=IIf(m1<0 AND m1>s1, ColorRGB(230,230,0),IIf(m1>0 AND
m1>s1,colorBrightGreen,IIf(m1>0 AND m1<s1,colorOrange,colorDarkRed)));
if(Show_color)
{
ColorHighliter = myColor;
SetBarFillColor( ColorHighliter );
}*/
//////////
/*
m1=MACD(r1,r2);
s1=Signal(r1,r2,r3);
mycolor=IIf(m1<0 AND m1>s1, ColorRGB(230,230,0),IIf(m1>0 AND
m1>s1,colorWhite,IIf(m1>0 AND m1<s1,colorOrange,colorDarkRed)));
if(Show_color)
{
ColorHighliter = mycolor;
SetBarFillColor( ColorHighliter );
}
_SECTION_END();
*/
_SECTION_BEGIN("Flower_HA_Normal Candle");
//////////
m1=MACD(r1,r2);
s1=Signal(r1,r2,r3);
mycolor=IIf(m1<0 AND m1>s1, ColorRGB(230,230,0),IIf(m1>0 AND
m1>s1,colorWhite,IIf(m1>0 AND m1<s1,colorOrange,colorDarkRed)));
if(Show_color)
{
ColorHighliter = mycolor;
SetBarFillColor( ColorHighliter );
}
_SECTION_END();
_SECTION_BEGIN("Breakout Setting");
Buyperiods=Param("Breakout periods best is usually 18",5,1,100,1,1);
Sellperiods=Param("Exit Breakout",5,1,100,1,1);
Buy= C>Ref(HHV(High,Buyperiods),-1);
Sell= C<Ref(LLV(Low,Sellperiods),-1);
_SECTION_END();
_SECTION_BEGIN("Pivot Box");
Hi=Param("High_Period",7,1,50,1);
Lo=Param("Low_Period",7,1,50,1);
A1=ExRemSpan(Ref(High,-2)==HHV(High,Hi),3);
A2=ExRemSpan(Ref(Low,-2)==LLV(Low,Lo),3);
A3=Cross(A1,0.9);
A4=Cross(A2,0.9);
TOP=Ref(HaHigh,-BarsSince(A3));
breakoutLine=Param("BrOutLineLength",10,2,30,0.1);
upDaysback1 = breakoutLine;
upFirstBar1 = BarCount - upDaysBack1;
upst2=TOP;
Plot(upYYY2,"",ParamColor("BreakoutColor", colorOrange)
,ParamStyle("BreakoutLine",styleLine|styleThick|styleStaircase,maskAll));
//Plot(top,"",11,styleDots+styleLine+styleThick);
bot=Ref(HaLow,-BarsSince(A4));
breakDownLine=Param("BrDownLineLength",10,2,30,0.1 );
dnDaysback1 = breakDownLine;
dnFirstBar1 = BarCount - dnDaysBack1;
dnst2=BOT;
Plot(dnYYY2,"",ParamColor("BreakDownColor", colorBrightGreen)
,ParamStyle("BreakdownLine",styleLine|styleThick|styleStaircase,maskAll));
//Plot(bot,"",6,styleDots+styleLine);
_SECTION_END();
function T3(price,periods)
{
s = 0.84;
e1=EMA(price,periods);
e2=EMA(e1,Periods);
e3=EMA(e2,Periods);
e4=EMA(e3,Periods);
e5=EMA(e4,Periods);
e6=EMA(e5,Periods);
c1=-s*s*s;
c2=3*s*s+3*s*s*s;
c3=-6*s*s-3*s-3*s*s*s;
c4=1+3*s+s*s*s+3*s*s;
Ti3=c1*e6+c2*e5+c3*e4+c4*e3;
return ti3;
}
//**************************************************
********************************
// Plot price horizontal line *
//**************************************************
********************************/
_SECTION_BEGIN("Price Line");
PriceLineColor=ParamColor("PriceLineColor",ColorRGB(82,82,82));
PriceLevel = ParamField("PriceField", field = 3 );
Plot(YY,"Current Price",PriceLineColor,ParamStyle("LineStyle",styleLine|
styleDashed|styleNoTitle|styleNoLabel|styleThick,maskAll));
side = Param("side",1,0,1000,1);
dist = 0;
_SECTION_END();
/*_SECTION_BEGIN("Average 0");
//Average_switch = ParamToggle("Candle On/off", "Off|On");
P = HaClose;
Type = ParamList("Type", "Weighted,Lagless-21,Hull-26,Linear
Regression-45,Exponential,Double Exponential,Tripple
Exponential,Wilders,Simple");
Periods = Param("Periods", 20, 2, 200 );
Displacement = Param("Displacement", 1, -50, 50 );
m = 0;
if( Type == "Weighted" ) m= WMA( P, Periods );
if( Type == "Lagless-21" ) m= 2*EMA(P, Periods)-EMA(EMA(P, Periods), Periods);
if( Type == "Hull-26" ) m= WMA(2*(WMA(P, Periods/2))-WMA(P, Periods) ,4 );
if( Type == "Linear Regression-45" ) m= LinearReg( P, Periods );
if( Type == "Exponential" ) m = EMA( P, Periods );
if( Type == "Double Exponential" ) m = DEMA( P, Periods );
if( Type == "Tripple Exponential" ) m = TEMA( P, Periods );
if( Type == "Wilders" ) m = Wilders( P, Periods );
if( Type == "Simple" ) m = MA( P, Periods );
_SECTION_END();*/
_SECTION_BEGIN("Bands_Short");
BandDays= Param("DaysBack",40,10,900,1);
HighestHigh = HHV( H, BandDays ) ;
LowestLow = LLV( L, BandDays) ;
CloudUpColor1=ParamColor("ShortupColor1",ColorRGB( 0,55,55));
CloudUpColor2=ParamColor("ShortupColor2",ColorRGB( 60,15,0));
CloudDownColor1=ParamColor("ShortDnColor1",ColorRGB(0,0,83));
CloudDownColor2= ParamColor("ShortDnColor2",ColorRGB(43,43,89));
CU1=HighestHigh;
CU2=(KS+HighestHigh )/2;
_SECTION_END();
_SECTION_BEGIN("Pivot");
nBars = Param("Number of bars", 25, 5, 40);
LP=Param("LookBack Period",250,1,500,1);
bShowTCZ = Param("Show TCZ", 0, 0, 1);
nExploreBarIdx = 0;
nExploreDate = 0;
nCurDateNum = 0;
DN = DateNum();
DT = DateTime();
bTCZLong = False;
bTCZShort = False;
nAnchorPivIdx = 0;
ADX8 = ADX(8);
if(Status("action")==1) {
bDraw = True;
bUseLastVis = 1;
} else {
bDraw = False;
bUseLastVis = False;
bTrace = 1;
nExploreDate = Status("rangetodate");
for (i=LastValue(BarIndex());i>=0;i--) {
nCurDateNum = DN[i];
if (nCurDateNum == nExploreDate) {
nExploreBarIdx = i;
}
}
}
GraphXSpace=7;
if (bDraw) {
}
aHPivs = H - H;
aLPivs = L - L;
aHPivHighs = H - H;
aLPivLows = L - L;
aHPivIdxs = H - H;
aLPivIdxs = L - L;
aAddedHPivs = H - H;
aAddedLPivs = L - L;
aLegVol = H - H;
aRetrcVol = H - H;
nHPivs = 0;
nLPivs = 0;
lastHPIdx = 0;
lastLPIdx = 0;
lastHPH = 0;
lastLPL = 0;
curPivBarIdx = 0;
aHHVBars = HHVBars(H, nBars);
aLLVBars = LLVBars(L, nBars);
aHHV = HHV(H, nBars);
aLLV = LLV(L, nBars);
nLastVisBar = LastValue(
Highest(IIf(Status("barvisible"), BarIndex(), 0)));
curBar = IIf(nlastVisBar > 0 AND bUseLastVis, nlastVisBar,
IIf(Status("action")==4 AND nExploreBarIdx > 0, nExploreBarIdx,
LastValue(BarIndex())));
curTrend = "";
if (aLLVBars[curBar] < aHHVBars[curBar])
curTrend = "D";
else
curTrend = "U";
if (curBar >= LP) {
for (i=0; i<LP; i++) {
curBar = IIf(nlastVisBar > 0 AND bUseLastVis,
nlastVisBar-i,
IIf(Status("action")==4 AND nExploreBarIdx > 0,
nExploreBarIdx-i,
LastValue(BarIndex())-i));
if (aLLVBars[curBar] < aHHVBars[curBar]) {
if (curTrend == "U") {
curTrend = "D";
curPivBarIdx = curBar - aLLVBars[curBar];
aLPivs[curPivBarIdx] = 1;
aLPivLows[nLPivs] = L[curPivBarIdx];
aLPivIdxs[nLPivs] = curPivBarIdx;
nLPivs++;
}
} else {
if (curTrend == "D") {
curTrend = "U";
curPivBarIdx = curBar - aHHVBars[curBar];
aHPivs[curPivBarIdx] = 1;
aHPivHighs[nHPivs] = H[curPivBarIdx];
aHPivIdxs[nHPivs] = curPivBarIdx;
nHPivs++;
}
}
}
}
curBar =
IIf(nlastVisBar > 0 AND bUseLastVis,
nlastVisBar,
IIf(Status("action")==4 AND nExploreBarIdx > 0,
nExploreBarIdx,
LastValue(BarIndex()))
);
if (nHPivs >= 2 AND nLPivs >= 2) {
lastLPIdx = aLPivIdxs[0];
lastLPL = aLPivLows[0];
lastHPIdx = aHPivIdxs[0];
lastHPH = aHPivHighs[0];
nLastHOrLPivIdx = Max(lastLPIdx, lastHPIdx);
nAddPivsRng = curBar - nLastHOrLPivIdx;
aLLVAfterLastPiv = LLV(L, nAddPivsRng);
nLLVAfterLastPiv = aLLVAfterLastPiv[curBar];
aLLVIdxAfterLastPiv = LLVBars(L, nAddPivsRng);
nLLVIdxAfterLastPiv = curBar - aLLVIdxAfterLastPiv[curBar];
aHHVAfterLastPiv = HHV(H, nAddPivsRng);
nHHVAfterLastPiv = aHHVAfterLastPiv[curBar];
aHHVIdxAfterLastPiv = HHVBars(H, nAddPivsRng);
nHHVIdxAfterLastPiv = curBar - aHHVIdxAfterLastPiv[curBar];
if (lastHPIdx > lastLPIdx) {
/* ************************************************** **************
Still finding missed pivot(s). Here, the last piv is a low piv.
************************************************** ************** */
} else {
/* ****************************************
// -- Done with finding pivots
***************************************** */
if (bDraw) {
/* ****************************************
// -- Done with discovering and plotting pivots
***************************************** */
minRtrc = 0;
maxRtrc = 0;
minLine = 0;
maxLine = 0;
triggerLine = 0;
firstProfitLine = 0;
triggerInc = 0;
triggerPrc = 0;
firstProfitPrc = 0;
retrcPrc = 0;
retrcBar = 0;
retrcBarIdx = 0;
retrcRng = 0;
aRetrcPrc = H-H;
aRetrcPrcBars = H-H;
aRetrcClose = C;
retrcClose = 0;
tcz500 =
(aHPivHighs[0] -
(.5 * (aHPivHighs[0] - aLPivLows[1])));
tcz618 =
(aHPivHighs[0] -
(.618 * (aHPivHighs[0] - aLPivLows[1])));
tcz786 =
(aHPivHighs[0] -
(.786 * (aHPivHighs[0] - aLPivLows[0])));
retrcPrc = aRetrcPrc[curBar];
retrcBarIdx = curBar - aRetrcPrcBars[curBar];
retrcClose = aRetrcClose[retrcBarIdx];
// -- bTCZLong setup?
bTCZLong = (
tcz500 =
(aHPivHighs[1] -
(.5 * (aHPivHighs[1] - aLPivLows[0])));
tcz618 =
(aHPivHighs[0] -
(.618 * (aHPivHighs[1] - aLPivLows[0])));
tcz786 =
(aHPivHighs[0] -
(.786 * (aHPivHighs[0] - aLPivLows[0])));
bTCZShort = (
// -- Are retracement levels arranged in
// tcz order?
if (bShowTCZ) {
Plot(
LineArray( IIf(bTCZLong, aHPivIdxs[0], aLPivIdxs[0]),
tcz500, curBar, tcz500 , 0),
"tcz500", colorPaleBlue, styleLine);
Plot(
LineArray( IIf(bTCZLong, aHPivIdxs[0], aLPivIdxs[0]),
tcz618, curBar, tcz618, 0),
"tcz618", colorPaleBlue, styleLine);
Plot(
LineArray( IIf(bTCZLong, aHPivIdxs[0], aLPivIdxs[0]),
tcz786, curBar, tcz786, 0),
"tcz786", colorTurquoise, styleLine);
}
// -- if (bShowTCZ)
}
// **************************
// END INDICATOR CODE
// **************************
_SECTION_END();
///********************************************//
flowerClose = EMA((Open+High+Low+Close)/4,3) ;
flowerOpen = EMA((Ref(Open,-1) + Ref(flowerClose,-1))/2,3);
Temp = Max(High, flowerOpen);
flowerHigh = EMA(Max(Temp, flowerClose),3);
Temp = Min(Low,flowerOpen);
flowerLow = EMA(Min(Temp, flowerClose),3);
//------------//
//#include <T3_include.AFL>;
/* _SECTION_BEGIN("trending ribbon");
//BT=ParamColor("BT", colorRed );
TimeFrameSet (inDaily);
uptrend=PDI()>MDI()AND Signal()<MACD();
downtrend=MDI()>PDI()AND Signal()>MACD();
//UTM3=IIf( uptrend, colorGreen, IIf( downtrend, colorRed, colorLightGrey ));
TimeFrameRestore();
UpA=uptrend;
DownB=downtrend;
RequestTimedRefresh( 0 );
GfxSelectFont( "Tahoma", 12, 100 );
GfxSetBkMode( 1 );
GfxSetTextColor( colorWhite );
if ( Trend1 =="Up1")
{
GfxSelectSolidBrush( 34 ); //ColorRGB(0,70,0) 30 to 34
}
else
if ( Trend2 =="Down1")
{
GfxSelectSolidBrush( 25); //ColorRGB(70,0,0)// 48 to 25
}
else
if ( Trend2 =="")
{
GfxSelectSolidBrush( colorGrey40 );
_SECTION_BEGIN("Trendslong");
//CT=ParamColor("CT", colorRed );
//for Trend1
if ( Trendslongup =="trendlongup")
{
GfxSelectSolidBrush(34 ); //ColorRGB(0,90,0)
}
else
if (Trendslongdown =="trendlongdn")
{
GfxSelectSolidBrush(25 ); //ColorRGB(90,0,0)
else
if (Trendslongdown =="")
{
GfxSelectSolidBrush( colorYellow );
_SECTION_END();
_SECTION_BEGIN("Trendsmid");
//DT=ParamColor("DT", colorRed );
//for trend2
if ( Trendmidup =="trendmidup")
{
GfxSelectSolidBrush( 34 ); //ColorRGB(0,120,0)
}
else
if (Trendmiddown =="trendmiddn")
{
GfxSelectSolidBrush(25 ); //ColorRGB(120,0,0)
}
else
if (Trendmidcon =="trendmidcon")
{
GfxSelectSolidBrush( 14 ); //colorYellow
_SECTION_END();
_SECTION_BEGIN("Trendsshort");
//ET=ParamColor("ET", colorRed );
//for Trend1
if ( Trendshortup =="trendup")
{
GfxSelectSolidBrush( 34 ); //ColorRGB(0,150,0)
}
else
if (Trendshortdown =="trenddn")
{
GfxSelectSolidBrush(25 ); //ColorRGB(150,0,0)
else
if (Trendshortcon =="trendcon")
{
GfxSelectSolidBrush( colorYellow );
_SECTION_END();
_SECTION_BEGIN("Rays");
//FT=ParamColor("FT", colorRed );
Pp1=3;
Pp2=2;
CS33=HHV(LLV(flowerHigh,Pp1)-ATR(Pp2),4);
CR33=HHV(LLV(flowerHigh,Pp1)-ATR(Pp2),5);
if ( ATRup =="atrup")
{
GfxSelectSolidBrush( 34 ); //ColorRGB(0,180,0)
}
else
if (ATRdown =="atrdn")
{
GfxSelectSolidBrush( 25); //ColorRGB(180,0,0)
else
if ( ATRdown =="")
{
GfxSelectSolidBrush( colorGrey40 );
_SECTION_BEGIN("Exit_Beast-3");
//GT=ParamColor("GT", colorRed );
EntrylookbackPeriod=10;
EntryATRperiod=1.9;
EntrySig = C > ( LLV( flowerLow, EntrylookbackPeriod ) + EntryATRperiod * ATR( 10 )
);
ExitSig = C < ( HHV( flowerHigh, EntrylookbackPeriod ) -EntryATRperiod *
ATR( 10 ) );
RequestTimedRefresh( 0 );
GfxSelectFont( "Tahoma", 12, 100 );
GfxSetBkMode( 1 );
GfxSetTextColor( colorWhite );
if ( EntryB =="eu")
{
GfxSelectSolidBrush( 34 ); //ColorRGB(0,210,0)
}
else
if ( ExitB =="ed")
{
GfxSelectSolidBrush( 25); //ColorRGB(210,0,0)
else
if ( ExitB =="")
{
GfxSelectSolidBrush( colorGrey40 );
_SECTION_END();
_SECTION_BEGIN("CCI9-2");
//HT=ParamColor("HT", colorRed );
ccidn=CCI(8) < 0;
cciup=CCI(9) > 0;
RequestTimedRefresh( 0 );
GfxSelectFont( "Tahoma", 12, 100 );
GfxSetBkMode( 1 );
GfxSetTextColor( colorWhite );
if ( ccresult1 =="cu")
{
GfxSelectSolidBrush( 34 ); //ColorRGB(0,240,0)
}
else
if ( ccresult2 =="cd")
{
GfxSelectSolidBrush(25 ); //
else
if ( ccresult2 =="")
{
GfxSelectSolidBrush( colorGrey40 );
_SECTION_END();
_SECTION_BEGIN("%BB7-1");
//IT=ParamColor("IT", colorRed );
p=7;
x=((C+2*StDev(C,p)-MA(C,p))/(4*StDev(C,p)))*100;
bbdown= x < 40;
bbup= x > 40;
RequestTimedRefresh( 0 );
GfxSelectFont( "Tahoma", 12, 100 );
GfxSetBkMode( 1 );
GfxSetTextColor( colorWhite );
if ( bbresult1 =="bu")
{
GfxSelectSolidBrush(34 ); //ColorRGB(62,255,62)
}
else
if ( bbresult2 =="bd")
{
GfxSelectSolidBrush(25 ); //ColorRGB(255,62,62)
else
if ( bbresult2 =="")
{
GfxSelectSolidBrush( colorGrey40 );
_SECTION_END();
_SECTION_BEGIN("Fast_trend");
//JT=ParamColor("JT", colorRed );
Prd3=5; //Param("Daily_Period1",8,1,200,1);
Prd4=8; //Param("Daily_Period2",15,1,200,1);
TimeFrameSet (inDaily);
TM3 = T3 ( C , Prd3) ;
TM4 = T3 ( C , Prd4) ;
TimeFrameRestore();
RequestTimedRefresh( 0 );
GfxSelectFont( "Tahoma", 12, 100 );
GfxSetBkMode( 1 );
GfxSetTextColor( colorWhite );
if ( result1 =="bullrevers")
{
GfxSelectSolidBrush( 17 ); // colorwhite
}
else
if ( result2 =="bull")
{
GfxSelectSolidBrush( 34 ); //ColorRGB(113,255,113)
else
if ( result3 =="bearishrevers")
{
GfxSelectSolidBrush( 36 ); // colorGrey40
else
if ( result4 =="bear")
{
GfxSelectSolidBrush( 25 ); //ColorRGB(255,113,113)
OP = "M";
_SECTION_END();