_SECTION_BEGIN("_ChartTemplat_GD-B_dark");
//-------------------------------------------------------------------------
//----Anweisungen abhängig vom Charttyp------------------------------------
dec = (Param("Decimals",2,0,7,1)/10)+1;
bi = BarIndex();
Lbi = LastValue(BarIndex());
sbi = SelectedValue(bi);
x1= BarCount-1;
Title = EncodeColor(55)+ Title = Name() + " " + EncodeColor(32) + Date() +
" " + EncodeColor(5) + "{{INTERVAL}} " +
EncodeColor(55)+ " Open = "+ EncodeColor(52)+ WriteVal(O,dec) +
EncodeColor(55)+ " High = "+ EncodeColor(5) + WriteVal(H,dec) +
EncodeColor(55)+ " Low = "+ EncodeColor(32)+ WriteVal(L,dec) +
EncodeColor(55)+ " Close = "+ EncodeColor(52)+ WriteVal(C,dec)+
EncodeColor(55)+ " Volume = "+ EncodeColor(52)+ WriteVal(V,1);
cs = GetPriceStyle(); // CS == ChartStyle
choose = ParamToggle("Charttypabhängigkeit?", "Yes|No");
if(choose == 0){
if(cs == styleBar){
chartArt = "bar";
}
else if (cs == styleCandle){
chartArt = "candle";
}else{
chartArt = "line";
}
} else {
chartArt = "";
};
//-------------------------------------------------------------------------
//---- ChartFarben --ChartStyle--------------------------------------------
if(!choose )
SetChartBkColor( ParamColor("HintergrundFarbe", ColorRGB( 0, 50, 50 ) ) ); // Hintergrund >> nur wenn ChartTemplet greift
line_color_up = ParamColor("Line_Color_UP", ColorRGB( 46, 139 , 87 ) ); //- UP - DOWN -
line_color_down = ParamColor("Line_Color_DOWN", ColorRGB( 220, 20, 60 ) ); //- UP - DOWN -
bar_color_up = ColorRGB( 44, 138 , 84);
bar_color_down = ColorRGB( 220, 22, 60);
candle_color_up = ColorRGB( 0, 0, 255);
candle_color_down = ColorRGB( 255, 0, 0);
candle_rahmen = ColorRGB( 128, 128 , 128);
spezial_color = ParamColor( "PinBar-Color", ColorRGB( 255, 255 , 0) );
//-------------------------------------------------------------------------
//---- Bedingungen --------------------------------------------------------
// PinBars werden anders coloriert
// Bars/Lines/Candles bei denen open und close dicht beieiander liegen werden anders farbieg dargestellt
// zur Vereinfachung, ist der Abstand Hoch - Tief um Faktor "pinbar_faktor" größer als der Abstand Open-Close, gilt die Bedingung
pinbar_faktor = Param( "Pinbar-Faktor", 5, 1, 10, 0.1);
bedingungOpenNearClose = abs(H-L)/ pinbar_faktor > abs(O-C) ;
bedingungUp = O< C;
style = styleNoTitle | ParamStyle("Style");
if(chartArt == "line"){
Plot( C, "Price", IIf(bedingungOpenNearClose, spezial_color, IIf( bedingungUp, line_color_up, line_color_down) ),style |styleThick | GetPriceStyle()); // |styleThick
}else if (chartArt == "bar"){
Plot( C, "Price", IIf( bedingungOpenNearClose, spezial_color, IIf( bedingungUp, bar_color_up, bar_color_down) ),style | GetPriceStyle());
}else if (chartArt == "candle"){
// bei CandleChart wird hiermit die FüllFarbe definiert
SetBarFillColor( IIf( bedingungUp, candle_color_up, candle_color_down) );
// Color definiert bei CandlChart den Rahmen
Plot( C, "Price", IIf (bedingungOpenNearClose, spezial_color, candle_rahmen ), style | GetPriceStyle());
}else{
// StandartChart
_SECTION_BEGIN("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 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();
}
_SECTION_END();
//-------------------------------------------------------------------------
//---- Indis --------------------------------------------------------------
//---ChartTypAbhängiges
if(chartArt == "line"){
// wenn LinienChart
_SECTION_BEGIN("High_Low_Line");
HighLine = H;
LowLine = L;
farbe_HL = ColorRGB( 65, 65, 65 );
Plot(HighLine, "", farbe_HL,styleLine|styleDashed|styleNoLabel); // styleStaircase
Plot(LowLine, "", farbe_HL,styleLine|styleDashed|styleNoLabel); // styleLine
_SECTION_END();
}
_SECTION_END();
_SECTION_BEGIN("NMA Swing");
SetBarsRequired(200,0);
//GraphXSpace = 5;
//SetChartOptions(0,chartShowArrows|chartShowDates);
k = Optimize("K",Param("K",3,0.25,50,0.25),0.25,50,0.25);
Per= Optimize("atr",Param("atr",4,3,200,1),3,200,1);
HACLOSE=(O+H+L+C)/4;
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
HaHigh = Max( H, Max( HaClose, HaOpen ) );
HaLow = Min( L, Min( HaClose, HaOpen ) );
//PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "" + Name(), colorWhite, styleCandle | styleNoLabel );
j=Haclose;
//Plot(Haclose,"Vinod-cLOSE",IIf(Haclose > Ref(HaClose,-1), colorBrightGreen,
//IIf(Haclose < Ref(HaClose,-1), colorOrange,
//colorOrange)),
//styleLine|styleThick);
//=======================================================================================================================
//=========================Indicator==============================================================================================
f=ATR(10);
rfsctor = WMA(H-L, Per);
revers = k * rfsctor;
Trend = 1;
NW[0] = 0;
for(i = 1; i < BarCount; i++)
{
if(Trend[i-1] == 1)
{
if(j[i] < NW[i-1])
{
Trend[i] = -1;
NW[i] = j[i] + Revers[i];
}
else
{
Trend[i] = 1;
if((j[i] - Revers[i]) > NW[i-1])
{
NW[i] = j[i] - Revers[i];
}
else
{
NW[i] = NW[i-1];
}
}
}
if(Trend[i-1] == -1)
{
if(j[i] > NW[i-1])
{
Trend[i] = 1;
NW[i] = j[i] - Revers[i];
}
else
{
Trend[i] = -1;
if((j[i] + Revers[i]) < NW[i-1])
{
NW[i] = j[i] + Revers[i];
}
else
{
NW[i] = NW[i-1];
}
}
}
}
//===============system================
Plot(NW, "", IIf(Trend == 1, 27, 4), 4);
Buy=Cover=Cross(j,nw);
Sell=Short=Cross(nw,j);
SellPrice=ValueWhen(Sell,C,1);
BuyPrice=ValueWhen(Buy,C,1);
Long=Flip(Buy,Sell);
Shrt=Flip(Sell,Buy );
_SECTION_END();
//=================TITLE================================================================================================
_SECTION_BEGIN("Title");
if( Status("action") == actionIndicator )
(
/*Title = EncodeColor(colorWhite)+ "Vinod TIS Swing System" + " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
" - " + Date() +" - "+"\n" +EncodeColor(colorYellow) +"Op-"+O+" "+"Hi-"+H+" "+"Lo-"+L+" "+
"Cl-"+C+" "+ "Vol= "+ WriteVal(V)+"\n"+ */
Title = EncodeColor(55)+ Title = Name() + " " + EncodeColor(32) + Date() +
" " + EncodeColor(5) + "{{INTERVAL}} " +
EncodeColor(55)+ " Open = "+ EncodeColor(52)+ WriteVal(O,dec) +
EncodeColor(55)+ " High = "+ EncodeColor(5) + WriteVal(H,dec) +
EncodeColor(55)+ " Low = "+ EncodeColor(32)+ WriteVal(L,dec) +
EncodeColor(55)+ " Close = "+ EncodeColor(52)+ WriteVal(C,dec)+
EncodeColor(55)+ " Volume = "+ EncodeColor(52)+ WriteVal(V,1)+
EncodeColor(colorLime)+
WriteIf (Buy , " Go Long Above / Reverse Signal @ "+H+" ","")+
WriteIf (Sell , " Exit Long Below / Reverse Signal @ "+L+" ","")+"\n"+EncodeColor(colorWhite)+
WriteIf(Sell , "Total Profit/Loss for the Last Trade Rs."+(C-BuyPrice)+"","")+
WriteIf(Buy , "Total Profit/Loss for the Last trade Rs."+(SellPrice-C)+"","")+
WriteIf(Long AND NOT Buy, "Trade : Long - Entry price Rs."+(BuyPrice),"")+
WriteIf(shrt AND NOT Sell, "Trade : Short - Entry price Rs."+(SellPrice),"")+"\n"+
WriteIf(Long AND NOT Buy, "Current Profit/Loss Rs."+(C-BuyPrice)+"","")+
WriteIf(shrt AND NOT Sell, "Current Profit/Loss Rs."+(SellPrice-C)+"",""));
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);
_SECTION_END();
_SECTION_BEGIN("ema's");
/*_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " + WriteVal( V, 1.0 ) + " {{VALUES}} ", O, H, L, C));
Title = Name() + "; " + Date() +
"\nEMA-1: " + WriteVal(EMA(C, 1), 1.2) + EncodeColor(colorWhite) +
"\nEMA-2: " + WriteVal(EMA(C, 2), 1.2) + EncodeColor(colorCustom11) +
"\nEMA-3: " + WriteVal(EMA(C, 3), 1.2) + EncodeColor(colorCustom9) +
"\nEMA-5: " + WriteVal(EMA(C, 5), 1.2) + EncodeColor(colorDarkOliveGreen) +
"\nEMA-8: " + WriteVal(EMA(C, 8), 1.2) + EncodeColor(colorGold) +
"\nEMA-13: " + WriteVal(EMA(C, 13), 1.2) + EncodeColor(colorOrange) +
"\nEMA-21: " + WriteVal(EMA(C, 21), 1.2) + EncodeColor(colorRed) +
"\nEMA-44: " + WriteVal(EMA(C, 44), 1.2) + EncodeColor(colorBlue) , 0,H,L,C ));
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} \nOpen %1.2f, Hi %1.2f, Lo %1.2f, Close %1.2f (%.1f%%) Vol " + WriteVal( V, 1.0 ) + // " {{VALUES}} " +
"\nEMA-1: " + WriteVal(EMA(C, 1), 1.2) + EncodeColor(colorWhite) +
"\nEMA-2: " + WriteVal(EMA(C, 2), 1.2) + EncodeColor(colorCustom11) +
"\nEMA-3: " + WriteVal(EMA(C, 3), 1.2) + EncodeColor(colorCustom9) +
"\nEMA-5: " + WriteVal(EMA(C, 5), 1.2) + EncodeColor(colorDarkOliveGreen) +
"\nEMA-8: " + WriteVal(EMA(C, 8), 1.2) + EncodeColor(colorGold) +
"\nEMA-13: " + WriteVal(EMA(C, 13), 1.2) + EncodeColor(colorOrange) +
"\nEMA-21: " + WriteVal(EMA(C, 21), 1.2) + EncodeColor(colorRed) +
"\nEMA-44: " + WriteVal(EMA(C, 44), 1.2) + EncodeColor(colorBlue) , 0,H,L,C ));
_SECTION_BEGIN("Price1");
/*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 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();*/