Professional Documents
Culture Documents
Bollinger Bands
Bollinger Bands
H1 = Ref( H, -1 );
L1 = Ref( L, -1 );
Color= IIf(C==O,colorDefault,
IIf(C>O,colorPaleGreen,
colorRed))));
SetBarFillColor(Color);
Plot(C,"C",IIf(C>O,colorGreen,IIf(C<O,colorDarkRed,colorBlack)),64);
High5Days = (Ref(HHV(High,5),-1));
High20Days = (Ref(HHV(High,20),-1));
High60Days = (Ref(HHV(High,60),-1));
Low5Days = (Ref(LLV(Low,5),-1));
Low20Days = (Ref(LLV(Low,20),-1));
Low60Days = (Ref(LLV(Low,60),-1));
IIf(C>O OR H5Days,colorPaleGreen,
colorRed)));
Color2nd =
IIf(C>O OR H20Days,colorPaleGreen,
colorRed)));
SetBarFillColor(Color1st);
SetBarFillColor(Color2nd);
_SECTION_BEGIN("SupportResistance");
R1_show = 0;
S1_show = 0;
// RESISTANT
LastHighestValue = LastVisibleValue(Ref(H,-1));
if (LastVisibleValue(H) == H[LastValue(BarIndex())])
LastHighestValue = LastVisibleValue(H);
i = 1;
i++;
R1_show = 1;
i++;
i++;
Plot(IIf(BarIndex() >=
R2x,LastValue(R2),Null),"R2",WarnaResistant ,SRStyle);
i++;
i++;
Plot(IIf(BarIndex() >=
R3x,LastValue(R3),Null),"R3",WarnaResistant ,SRStyle);
if (R1 == LastHighestValue)
R1_show = 1;
// SUPPORT
LastLowestValue = LastVisibleValue(Ref(L,-1));
if (LastVisibleValue(L) == L[LastValue(BarIndex())])
LastLowestValue = LastVisibleValue(L);
i = 1;
i++;
S1_show = 1;
i++;
i++;
Plot(IIf(BarIndex() >=
S2x,LastValue(S2),Null),"S2",WarnaSupport ,SRStyle);
i++;
i++;
Plot(IIf(BarIndex() >=
S3x,LastValue(S3),Null),"S3",WarnaSupport ,SRStyle);
S1 = LastVisibleValue(ValueWhen(L >= Ref(L,-1) AND Ref(L,-2) >= Ref(L, -1),Ref(L, -1), i));
if (S1 == LastLowestValue)
{
S1_show = 1;
SR = Prec((1-(S1/R1))*100,2);
_SECTION_BEGIN("Bollinger Bands");
P = ParamField("Price field",-1);
Plot(MA1,"MA15",colorBlack);
PlotOHLC( bbt, bbt, bbb, bbb, "", ColorBlend( Color, GetChartBkColor(), 0.8 ), styleNoLabel | styleCloud |
styleNoRescale, Null, Null, Null, -1 );
_SECTION_END();
//PARAMENTER
AvgPrice=(O+H+L+C)/4;
DV=AvgPrice*V;
DVMil = DV / 1000000000;
FV = DVMil / Ref(MADV10Mil,-1) ;
g=Ref(Langit,-1);
Plot(Langit,"",color,styleNoDraw|styleNoDraw);
Plot(Bumi,"",color,styleNoDraw|styleNoDraw);
Buy = Cross(C,g) AND Likuid AND fv >1 AND ADX(14) > 20;
//BuyPrice=ValueWhen(Buy,g,1);
Sell = Cross(f,C);
SellPrice=ValueWhen(Sell,f,1);
PlotShapes( shape, IIf( Buy, colorBlue, colorBlue ),0, IIf( Buy, Low, High ) );
//FIXED TITLE
Chg=Ref(C,-1);
Title = EncodeColor(colorYellow)+ "Company :: " +Title = Name() + " " +
EncodeColor(colorLightOrange) + "Date :: " + Date() +EncodeColor(11) + EncodeColor(colorWhite) + "\
n{{INTERVAL}} " +
HaClose =EMA((O+H+L+C)/4,3);
supres=ParamToggle("Display(ON - OFF)","Off|On",0);
if(supres)
Prd1=Param("Resistance Period",2,0,200,1);
test = TEMA ( High , Prd1 ) ;
PKV0 = ValueWhen(PK,haHigh,0);
PKV1 = ValueWhen(PK,haHigh,1);
PKV2 = ValueWhen(PK,haHigh,2);
SPV0 = ValueWhen(SP,haLow,0);
SPV1 = ValueWhen(SP,haLow,1);
SPV2 = ValueWhen(SP,haLow,2);
Plot(SD,"Support1", colorYellow,styleDots|styleDashed|styleThick|styleNoTitle,maskAll);
Plot(SD2,"Support2", colorYellow,styleDots|styleDashed|styleThick|styleNoTitle,maskAll);
Plot(SD3,"Support3", colorYellow,styleDots|styleDashed|styleThick|styleNoTitle,maskAll);
Plot(SD4,"Support4", colorYellow,styleDots|styleDashed|styleThick|styleNoTitle,maskAll);
Plot(SD5,"Support5", colorYellow,styleDots|styleDashed|styleThick|styleNoTitle,maskAll);
Plot(SD6,"Support6", colorYellow,styleDots|styleDashed|styleThick|styleNoTitle,maskAll);
_SECTION_END();
P = ParamField("Field");
Type = ParamList("Type", "Weighted,Lagless-21,Hull-26,Linear Regression-45,Exponential,Double
Exponential,Tripple Exponential,Wilders,Simple");
m = 0;
_SECTION_END();
_SECTION_BEGIN("Pivot Finder");
+ "\n"+"C " ;
GraphXSpace=7;
aHPivs = H - H;
aLPivs = L - L;
aHPivHighs = H - H;
aLPivLows = L - L;
aHPivIdxs = H - H;
aLPivIdxs = L - L;
nHPivs = 0;
nLPivs = 0;
lastHPIdx = 0;
lastLPIdx = 0;
lastHPH = 0;
lastLPL = 0;
curPivBarIdx = 0;
aVisBars = Status("barvisible");
//value
curBar = (BarCount-1);
curTrend = "";
if (aLLVBars[curBar] <
aHHVBars[curBar]) {
curTrend = "D";
else {
curTrend = "U";
curBar = (BarCount - 1) - i;
if (curTrend == "U") {
curTrend = "D";
//pivot information
aLPivs[curPivBarIdx] = 1;
aLPivLows[nLPivs] = L[curPivBarIdx];
aLPivIdxs[nLPivs] = curPivBarIdx;
nLPivs++;
// -- or current trend is up
} else {
if (curTrend == "D") {
curTrend = "U";
aHPivs[curPivBarIdx] = 1;
aHPivHighs[nHPivs] = H[curPivBarIdx];
aHPivIdxs[nHPivs] = curPivBarIdx;
nHPivs++;
// -- If curTrend is up...else...
}
curBar = (BarCount-1);
candIdx = 0;
candPrc = 0;
lastLPIdx = aLPivIdxs[0];
lastLPL = aLPivLows[0];
lastHPIdx = aHPivIdxs[0];
lastHPH = aHPivHighs[0];
candPrc = aHHV[curBar];
if (
aHPivs[candIdx] = 1;
aHPivHighs[nHPivs-j] = aHPivHighs[nHPivs-
(j+1)];
aHPivIdxs[nHPivs-j] = aHPivIdxs[nHPivs-(j+1)];
aHPivHighs[0] = candPrc ;
aHPivIdxs[0] = candIdx;
nHPivs++;
} else {
candPrc = aLLV[curBar];
if (
aLPivs[candIdx] = 1;
aLPivIdxs[nLPivs-j] = aLPivIdxs[nLPivs-(j+1)];
aLPivLows[0] = candPrc;
aLPivIdxs[0] = candIdx;
nLPivs++;
PlotShapes(
PIVOT_status =
WriteIf(PIVOT_BUY,"Buy["+PIVOT_BUY+"]",WriteIf(PIVOT_SELL,"Sell["+PIVOT_SELL+"]","NA"));
_SECTION_END();
_SECTION_BEGIN("Volume");
Volumeclimaxup = colorRed;
HighVolumeChurnbars = colorLime;
Lowvolumebars = colorYellow;
Volumeclimaxdn = colorWhite;
ClimaxChurnColor=colorBlue;
Value1 = V;
Value2 = V*(H-L);
Value3 = V/(H-L);
if(VOLUME_TOGGLE==1)
_SECTION_END();
// MA 5 10 crossover
_SECTION_BEGIN("MA");
L_MA = EMA(C,LOW_MA);
H_MA = EMA(C,HIGH_MA);
HT_MA = EMA(C,HIGHEST_MA);
if(MA_TOGGLE==1)
{
}
_SECTION_END();
//ADX
range = Param("Range",14,3,60,1);
px = PDI(range);
nx = MDI(range);
ax = ADX(range);
Line_Control = 20;
// ADX Trends
// Buy Conditions
adsell1 = Cross(nx,ax) AND nx > px AND ax > Ref(ax,-1) AND nx > ax;
ADX_status = WriteIf(BUY_ADX,"Buy["+BUY_ADX+"]",WriteIf(SELL_ADX,"Sell["+SELL_ADX+"]","NA"));
_SECTION_BEGIN("MACD");
m1 = MACD(r1, r2);
s1 = Signal(r1,r2,r3);
difference = m1-s1;
BEAR_ZLR = BarsSince(B_MACD_0);
//HOK1
BULL_HOOK1 = BarsSince(BEAR_CROSS_ABOVE_ZERO);
BEAR_HOOK1 = BarsSince(BULL_CROSS_ABOVE_ZERO);
/*
if(MACD_TOGGLE==1)
GraphX = 5;
PlotShapes(IIf(B_MACD_0,shapeDigit1 ,Null),colorYellow,0,Min(0,0),Min(0,0));
PlotShapes(IIf(B_MACD_0,shapeUpArrow,Null),colorGreen,0,Min(0,0),-20);
PlotShapes(IIf(S_MACD_0,shapeDigit2 ,Null),colorOrange,0,Min(0,0),0);
PlotShapes(IIf(S_MACD_0,shapeDownArrow,Null),colorRed,0,Min(0,0),-20);
PlotShapes(IIf(BULL_CROSS_ABOVE_ZERO,shapeDigit3 ,Null),colorYellow,0,Min(0,0),Min(0,0));
PlotShapes(IIf(BULL_CROSS_ABOVE_ZERO,shapeUpArrow,Null),colorGreen,0,Min(0,0),-20);
PlotShapes(IIf(BEAR_CROSS_ABOVE_ZERO ,shapeDownArrow,Null),colorRed,0,Min(0,0),-20);
PlotShapes(IIf(BULL_CROSS_BELOW_ZERO,shapeDigit5 ,Null),colorYellow,0,Min(0,0),Min(0,0));
PlotShapes(IIf(BULL_CROSS_BELOW_ZERO,shapeUpArrow,Null),colorGreen,0,Min(0,0),-20);
PlotShapes(IIf(BEAR_CROSS_BELOW_ZERO,shapeDigit6 ,Null),colorOrange,0,Min(0,0),Min(0,0));
PlotShapes(IIf(BEAR_CROSS_BELOW_ZERO,shapeDownArrow,Null),colorRed,0,Min(0,0),-20);
PlotShapes(IIf(BEAR_ZLR1,shapeStar+shapePositionAbove,shapeNone),colorRed,0,0,-30);
PlotShapes(IIf(BULL_ZLR1,shapeStar+shapePositionAbove,shapeNone),colorGold,0,0,30);
PlotShapes(IIf(BULL_HOOK,shapeStar+shapePositionAbove,shapeNone),colorGold,0,0,30);
PlotShapes(IIf(BEAR_HOOK,shapeStar+shapePositionAbove,shapeNone),colorRed,0,0,-30);
*/
_SECTION_END();
MACD_status =
WriteIf(BUY_MACD,"Buy["+BUY_MACD+"]",WriteIf(SELL_MACD,"Sell["+SELL_MACD+"]","NA"));
_SECTION_BEGIN("STOCHASTICS");
STOC_TOGGLE = ParamToggle("Plot STOCHASTICS","Off|On",0);
Overbought = 80;
Oversold = 20;
/*
if(STOC_TOGGLE==1)
GraphX = 5;
Plot(Overbought,"Overbought Level",colorRed);
Plot(Oversold,"Oversold Level",colorGreen);
*/
printf("sto %g",BUY_STOCH);
STOCH_status =
WriteIf(BUY_STOCH,"Buy["+BUY_STOCH+"]",WriteIf(SELL_STOCH,"Sell["+SELL_STOCH+"]","NA"));
_SECTION_END();
_SECTION_BEGIN("Trend Detector");
A = (H+C+L)/3;
B=MA(A,5)-EMA(A,34);
D = EMA(A,34)-MA(A,5);
Bcolor=IIf(B>D,25,39);
Dcolor=IIf(D<B,25,39);
Up = B > D;
down = B < D;
TREND_B = Cross(B,D);
TREND_S = Cross(D,B);
if(TREND_TOGGLE==1)
Plot(B,"B ",Bcolor,styleLine|styleThick);
Plot(D,"D ",Dcolor,styleLine|styleThick);
Plot(B,"",Bcolor,styleHistogram|styleThick);
Plot(D,"",Dcolor,styleHistogram|styleThick);
Plot(0,"",colorWhite,styleLine);
_SECTION_END();
_SECTION_BEGIN("RSI");
OB = Param("OverBrought Line",70,70,100,1);
OS = Param("OverSold Line",30,20,40,1);
CentreRSI = 50;
Overbought = OB;
Oversold = OS;
RSI_BEAR_DIV = Close >= HHV( Close, 14 ) AND RSI_PERIODS < HHV( RSI_PERIODS, 14 );
RSI_BULL_DIV = RSI_PERIODS >= HHV( RSI_PERIODS, 14 ) AND Close < HHV( Close, 14 );
RSI_BEAR_DIV1 = RSI_PERIODS <= LLV( RSI_PERIODS, 14) AND Close > LLV(Close,14);
/*****/////////
RSI_BUY = B_RSI ;
RSI_SELL =S_RSI ;
RSI_status = WriteIf(RSI_BUY,"Buy["+RSI_BUY+"]",WriteIf(RSI_SELL,"Sell["+RSI_SELL+"]","NA"));
_SECTION_END();
_SECTION_BEGIN("OBV");
OBV_BUY = Cross(OBV(),MA(OBV(),MA_OBV_Period));
OBV_SELL = Cross(MA(OBV(),MA_OBV_Period),OBV());
OBV_status = WriteIf(OBV_BUY,"Buy",WriteIf(OBV_SELL,"Sell","NA"));
_SECTION_END();
_SECTION_BEGIN("TSV");
intra=log(H)-log(L);
inter = log(Avg)-log(Ref(Avg,-1));
Vinter = StDev(inter,period);
TSI_BUY = Cross(TSI,EMA(TSI,7));
TSI_SELL = Cross(EMA(TSI,7),TSI);
TSI_status = WriteIf(TSI_BUY,"Buy",WriteIf(TSI_SELL,"Sell","NA"));
_SECTION_END();
_SECTION_BEGIN("TRIX");
Zero = 0;
TRIX_VAL = Trix(tPeriods);
SIG_TRIX = EMA(Trix(tPeriods),tSig);
TRIX_status = WriteIf(TRIX_BUY,"Buy",WriteIf(TRIX_SELL,"Sell","NA"));
_SECTION_END();
GAP_UP = GapUp();
GAP_DW = GapDown();
_SECTION_BEGIN("ANALYSIS");
if(ANALYSIS_TOGGLE==1)
Chg=Ref(C,-1);
+"\n"
+"\n"+EncodeColor(colorBlack) +"========================"
//text pivot
+ "\n"
+EncodeColor(colorBlack)+"PIVOT ="+
//text adx
+ "\n"
+EncodeColor(colorBlack)+"ADX = "+
WriteIf (BUY_ADX,EncodeColor(colorGreen)+"BUY("+BUY_ADX+")",WriteIf
(SELL_ADX,EncodeColor(colorRed)+ " SELL("+SELL_ADX+")","Netral"))
+ "\n" +
WriteIf (BUY_MACD,EncodeColor(colorGreen)+"BUY("+BUY_MACD+")",WriteIf
(SELL_MACD,EncodeColor(colorRed)+ "SELL("+SELL_MACD+")","Netral"))
//text stochastic
+"\n"+EncodeColor(colorBlack)+"Stochastics = "
+ WriteIf(BUY_STOCH,EncodeColor(colorGreen)+"BUY
("+BUY_STOCH+")",WriteIf(SELL_STOCH,EncodeColor(colorRed)+"SELL("+SELL_STOCH+")","Netral"))
//text rsi
+WriteIf(B_RSI,EncodeColor(colorGreen)+"BUY("+RSI_BUY+")",WriteIf (S_RSI,EncodeColor(colorRed)
+"SELL("+RSI_SELL+")","Netral"))
//text trend
//text gap
+"\n"+EncodeColor(colorBlack)+"GAP = "
+WriteIf(GAP_UP,EncodeColor(colorGreen)+"UP (1)",WriteIf(GAP_DW,EncodeColor(colorRed)
+"DOWN (1)", EncodeColor(colorBlack)+"Netral"))
+"\n"+EncodeColor(colorBlack) +"======================"
+"\n"+EncodeColor((colorGreen))+"BUY = "+EncodeColor(colorGreen)+Total_Buy
+"\n"+EncodeColor((colorRed))+"SELL = "+EncodeColor(colorRed)+Total_Sell
+"\n"+EncodeColor(colorBlack) +"======================";
_SECTION_BEGIN("TEXTSCS");
SetChartOptions(0,chartShowArrows|chartShowDates);
GfxSetOverlayMode(1);
GfxSetBkMode(0); // transparent
GfxSelectFont("Tahoma", Status("pxheight")/20 );
GfxSetBkMode(0); // transparent
_SECTION_END();