|
本帖最後由 f29825604 於 13-3-8 14:54 編輯
- //提供一個陽春ScoreCard//from 9 to -9
- // created by chandrakant
- //modified on 120309..credit goes to of Karthik sir
- /*1. Here are some observations to keep in mind that will help assure
- you are in a good trending move which is detrimental to the success
- of the trade moving higher before the inevitable over exhausted trend.
- 2 Consider only going long on the 5M if the 30M (two rows above) is also blue.
- 3 Consider the 1hr row as well being blue since it has an effect too.
- 4 The 15M row has to be blue with NO exceptions
- 5 The 30M row if blue has less effect on the trade as compared to the 15M row
- but keep this in mind. The 30M row being blue helps the 15M row continue to stay blue.
- 6 The 1hr row has even less effect OR importance but it too keeps the 30M
- from weakening to some minor degree.
- */
- // Define label bar (x) position location
- blankRightBars = 5; //insert actual blank right bars specified in Preferences
- barsInView = Status("lastvisiblebarindex") - Status("firstvisiblebarindex") - blankRightBars;
- Offset = Param("Offset Bar", 0.95, 0, 1, 0.01);
- textOffset = BarCount - (Offset * barsInView);
- _SECTION_BEGIN("default");
- HaClose =EMA((O+H+L+C)/4,3);
- HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
- HaHigh = Max( H, Max( HaClose, HaOpen ) );
- HaLow = Min( L, Min( HaClose, HaOpen ) );
- PlotText("Heinkein 4T tf :"+Interval(2), textoffset, 41.01, colorYellow);
- Color = IIf( Haopen > Haclose,4, IIf( Haopen == Haclose,colorYellow, 6));
- Plot(10,"", Color, styleHistogram+styleThick|styleOwnScale|styleNoLabel, 0, 100 );
- Plot( 11,"",colorBlack,styleOwnScale|styleArea|styleNoLabel,0, 100 );
- _SECTION_BEGIN("2");
- Compress2= Param("Compression",2,1,3,1);
- TimeFrameSet(Compress2* Interval());
- HaClose2 =EMA((O+H+L+C)/4,3);
- HaOpen2 = AMA( Ref( HaClose2, -1 ), 0.5 );
- HaHigh2 = Max( H, Max( HaClose2, HaOpen2 ) );
- HaLow2 = Min( L, Min( HaClose2, HaOpen2 ) );
- PlotText("Heinkein 4T tf :"+Interval(2), textoffset, 41.055, colorYellow);
- TimeFrameRestore();
- HAopen2f=TimeFrameExpand( Haopen2, Compress2* Interval());
- Haclose2f=TimeFrameExpand( Haclose2, Compress2* Interval());
- HaHigh2f=TimeFrameExpand( Hahigh2, Compress2* Interval());
- HaLow2f=TimeFrameExpand( Halow2, Compress2* Interval());
- Color2 = IIf( Haopen2f > Haclose2f,4, IIf(Haopen2f == Haclose2f,colorYellow, 6));
- Plot(20,"", Color2, styleHistogram+styleThick|styleOwnScale|styleNoLabel, 0, 100 );
- Plot( 21,"",colorBlack,styleOwnScale|styleArea|styleNoLabel,0, 100 );
- _SECTION_BEGIN("3");
- Compress3= Param("Compression3",4,2,6,1);
- TimeFrameSet(Compress3* Interval());
- HaClose3 =EMA((O+H+L+C)/4,3);
- HaOpen3 = AMA( Ref( HaClose3, -1 ), 0.5 );
- HaHigh3 = Max( H, Max( HaClose3, HaOpen3 ) );
- HaLow3 = Min( L, Min( HaClose3, HaOpen3 ) );
- PlotText("Heinkein 4T tf :"+Interval(2), textoffset,41.10, colorYellow);
- TimeFrameRestore();
- HAopen3f=TimeFrameExpand( Haopen3, Compress3* Interval());
- Haclose3f=TimeFrameExpand( Haclose3, Compress3* Interval());
- HaHigh3f=TimeFrameExpand( Hahigh3, Compress3* Interval());
- HaLow3f=TimeFrameExpand( Halow3, Compress3* Interval());
- color3 = IIf( Haopen3f > Haclose3f,4, IIf( Haopen3f == Haclose3f,colorYellow,6));
- Plot(30,"", Color3, styleHistogram+styleThick|styleOwnScale|styleNoLabel, 0, 100 );
- Plot( 31,"",colorBlack,styleOwnScale|styleArea|styleNoLabel,0, 100 );
- _SECTION_BEGIN("4");
- Compress4= Param("Compression4",8,2,10,1);
- TimeFrameSet(Compress4* Interval());
- HaClose4 =EMA((O+H+L+C)/4,3);
- HaOpen4 = AMA( Ref( HaClose4, -1 ), 0.5 );
- HaHigh4 = Max( H, Max( HaClose4, HaOpen4 ) );
- HaLow4 = Min( L, Min( HaClose4, HaOpen4 ) );
- PlotText("Heinkein 4T tf :"+Interval(2), textoffset, 41.14, colorYellow);
- TimeFrameRestore();
- HAopen4f=TimeFrameExpand( Haopen4, Compress4* Interval());
- Haclose4f=TimeFrameExpand( Haclose4, Compress4* Interval());
- HaHigh4f=TimeFrameExpand( Hahigh4, Compress4* Interval());
- HaLow4f=TimeFrameExpand( Halow4, Compress4* Interval());
- Color4 = IIf( Haopen4f > Haclose4f,4, IIf( Haopen4f == Haclose4f ,colorYellow, 6));
- Plot(40,"", Color4, styleHistogram+styleThick|styleOwnScale|styleNoLabel, 0, 100 );
- Plot( 41,"",colorBlack,styleOwnScale|styleArea|styleNoLabel,0, 100 );
- _N(Title = "{{NAME}} - {{INTERVAL}} {{DATE}} "+_DEFAULT_NAME()+" : {{OHLCX}} {{VALUES}}" );
- // Define label bar (x) position location
- blankRightBars = 5; //insert actual blank right bars specified in Preferences
- barsInView = Status("lastvisiblebarindex") - Status("firstvisiblebarindex") - blankRightBars;
- Offset = Param("Offset Bar", .99, 0, 1, .01);
- textOffset = BarCount - (Offset * barsInView);
- _SECTION_BEGIN("RSI Color Bar");
- RSIColor = IIf( RSI(14) > 70, colorRed, IIf( RSI(14) < 30, colorGreen, colorYellow));
- rs=RSI(14);
- r1=HHV(rs,200)-LLV(rs,200);
- r2=rs-LLV(rs,200);
- rn=255-((r2/r1)*255);
- rd=(r2/r1)*255;
- Plot( 10, "", ColorRGB(rn,rd,0), styleArea|styleOwnScale|styleNoLabel, 0, 100);
- Plot( 11,"",colorBlack,styleOwnScale|styleArea|styleNoLabel,0, 100 );
- PlotText("RSI-14", textoffset, 41.00, colorBlack);
- printf("\nRSI(14) =" + WriteVal(RSI(14)) );
- _SECTION_END();
- _SECTION_BEGIN("MACD Color Bar");
- m = MACD();
- s = Signal();
- //MACDColor = IIf( m > s, colorGreen, colorRed);
- xx=m-s;
- Hv= HHV(xx,400);
- Lv=LLV(xx,400);
- rng=Hv-Lv;
- Cr=(xx)-Lv;
- m2=255-((Cr/rng)*255);
- m1=(Cr/rng)*255;
- Plot( 20, "", ColorRGB(m2,m1,0), styleArea|styleOwnScale|styleNoLabel, 0, 100);
- Plot( 21,"",colorBlack,styleOwnScale|styleArea|styleNoLabel,0, 100 );
- //Plot( 20, "", MACDColor, styleArea|styleOwnScale|styleNoLabel, 0, 100);
- //Plot( 21,"",colorBlack,styleOwnScale|styleArea|styleNoLabel,0, 100 );
- PlotText("MACD", textoffset, 41.05, colorBlack);
- printf("\n ");
- printf("\nMACD(12,26) =" + WriteVal(m) );
- printf("\nMACD sig =" + WriteVal(s) );
- _SECTION_END();
- _SECTION_BEGIN("21 Day Range Color Bar");
- H21 = HHV(H,21); // Highest High over last 21 days
- L21 = LLV(Low,21); // Lowest Low over last 21 days
- P21DR = ( (Close - L21) / (H21 - L21) ) * 100; // Calculate where the close is in relation to this 21 day range
- R21 = (255 - ( (P21DR/100)*255 ) ); // Red Color component
- G21 = (P21DR/100)*255; // Green Color component
- Plot( 30, "", ColorRGB(R21,G21,0), styleArea|styleOwnScale|styleNoLabel, 0, 100);
- Plot( 31,"",colorBlack,styleOwnScale|styleArea|styleNoLabel,0, 100 );
- PlotText("21Day Range", textoffset, 41.09, colorBlack);
- printf("\n ");
- printf("\nHHV 21 days =" + WriteVal(H21) );
- printf("\nLLV 21 days =" + WriteVal(L21) );
- printf("\n% Range =" + WriteVal(P21DR) );
- _SECTION_END();
- _SECTION_BEGIN("250 Day Range Color Bar");
- sk = StochK(5,3) ; // Highest High over last 250 days
- skr = HHV(sk,200)-LLV(sk,200);
- s1=sk-LLV(sk,200);
- sn=255-((s1/skr)*255);
- sd=255*(s1/skr); // Lowest Low over last 250 days
- // Green Color component
- Plot( 40, "", ColorRGB(sn,sd,0), styleArea|styleOwnScale|styleNoLabel, 0, 100);
- Plot( 41,"",colorBlack,styleOwnScale|styleArea|styleNoLabel,0, 100 );
- PlotText("Stochastic K", textoffset, 41.1325, colorBlack);
- printf("\n ");
- //printf("\nHHV 250 days =" + WriteVal(HH250) );
- //printf("\nLLV 250 days =" + WriteVal(LL250) );
- //printf("\n% Range =" + WriteVal(P250DR) );
- _SECTION_END();
- Title = "Multi Ribbon Indicator - " + "RSI(14) =" + WriteVal(RSI(14)) + ", MACD(12,26) =" + WriteVal(m) + ", 21 Day % Range =" + WriteVal(P21DR) + ", 250 Day % Range =" + WriteVal(sk);
- _SECTION_BEGIN("ABKPScoreCardMap");
- /* KPScoreCard Map
- Plot the individual Compenements of ScoreCard as individual ribbons.
- This indicator is mainly for educational purposes
- */
- parmBullColor = ParamColor("Bull color", ColorRGB(167, 224, 243) );
- parmBearColor = ParamColor("Bear color", ColorRGB(255, 192, 203) );
- parmNeutColor = ParamColor("Neutral color", ColorRGB(255,255,72) );
- parmTextColor = ParamColor("Text color", colorBlack);
- parmYTextOffset = Param("Text Offset (Y)", 0.60, 0.25, 0.90, 0.05);
- SetBarsRequired(350, -1);
- Count = 0;
- GraphXSpace = 0;
- procedure ribbon( Caption, Color ) {
- Count++;
- Plot( 0, "", colorBlack, styleNoDraw );
- Plot( Count, "", colorBlack, styleLine | styleNoLabel );
- Plot( Count, "", Color, styleArea | styleNoLabel );
- PlotText( Caption, BarCount +1, Count - parmYTextOffset, parmTextColor );
- }
- //calculations
- Ctmpl = E_TSKPCOLORTMPL(Open,High,Low,Close,Volume);
- total = 0;
- total = total + IIf(tskp_colortmplcnd0 > 0, 1, -1);
- total = total + IIf(tskp_colortmplcnd1 > 0, 1, -1);
- total = total + IIf(tskp_colortmplcnd2 > 0, 1, -1);
- total = total + IIf(tskp_colortmplcnd3 > 0, 1, -1);
- total = total + IIf(tskp_colortmplcnd4 > 0, 1, -1);
- total = total + IIf(tskp_colortmplcnd5 > 0, 1, -1);
- total = total + IIf(tskp_colortmplcnd6 > 0, 1, -1);
- total = total + IIf(tskp_colortmplcnd7 > 0, 1, -1);
- KPScoreCard = total + IIf(tskp_colortmplcnd8 > 0, 1, -1);
- //Plot
- ribbon( "A900" , IIf(tskp_colortmplcnd0 > 0, parmBullColor, parmBearColor) );
- ribbon( "AutoStop" , IIf(tskp_colortmplcnd1 > 0, parmBullColor, parmBearColor) );
- ribbon( "HighLight" , IIf(tskp_colortmplcnd2 > 0, parmBullColor, parmBearColor) );
- ribbon( "Combo" , IIf(tskp_colortmplcnd3 > 0, parmBullColor, parmBearColor) );
- ribbon( "Fast3" , IIf(tskp_colortmplcnd4 > 0, parmBullColor, parmBearColor) );
- ribbon( "STTB" , IIf(tskp_colortmplcnd5 > 0, parmBullColor, parmBearColor) );
- ribbon( "Trigger/Stop" , IIf(tskp_colortmplcnd6 > 0, parmBullColor, parmBearColor) );
- ribbon( "115Split" , IIf(tskp_colortmplcnd7 > 0, parmBullColor, parmBearColor) );
- ribbon( "Medium" , IIf(tskp_colortmplcnd8 > 0, parmBullColor, parmBearColor) );
- KPSCColor = IIf(KPScoreCard >= 5, parmBullColor , IIf(KPScoreCard <= -5, parmBearColor, parmNeutColor) );
- //Plot(KPScoreCard,"ScoreCard",KPSCColor,ParamStyle("ScoreCardStyle",default=styleStaircase | styleOwnScale | styleArea ,maskAll), -10, 100);
- ribbon("ScoreCard" , KPSCColor);
- Title = "ScoreCard Map ScoreCard = " + NumToStr(SelectedValue(KPScoreCard), 1.0);
- _SECTION_END();
- _SECTION_BEGIN("ABKPMRange");
- /* TSKPMRange as Indicator or as ribbon */
- SetBarsRequired(350, -1);
- //user parameters
- parmUpColor =ParamColor( "MRange Color Up", ColorRGB(167, 224, 243) );
- parmDwnColor =ParamColor( "MRange Color Dn", ColorRGB(255, 192, 203) );
- parmRibbon = ParamToggle("PLot as ribbon", "No|Yes");
- parmRibbonSize = Param("Ribbon Size", 1 , 0.5, 10, 0.5);
- //KP indicators
- tightstop = E_TSKPTIGHTSTOP(High,Low,Close);
- stopline = E_TSKPSTOPLINE(High,Low,Close);
- mp = 0.5 * (High + Low);
- //calculation
- MRangeColor = IIf(mp > StopLine AND mp > tightstop, parmupColor, IIf(mp < stopline AND mp < tightstop, parmDwnColor, colorWhite) );
- //plot
- if(parmRibbon == 0)
- {
- Plot( 0, "MRange0", MRangeColor, styleNoDraw );
- Plot( 1, "MRange1", MrangeColor, styleNoLabel + styleArea + styleHistogram );
- }
- else
- Plot( parmRibbonSize, "MRange", MRangeColor, styleArea | styleNoLabel | styleOwnScale , 0, 10);
- _SECTION_END();
- _SECTION_BEGIN("ADX");
- range = Param("ADX Periods", 7, 2, 200, 1 );
- Col_adx = IIf(ADX(range) > Ref(ADX(range),-1) ,colorBlue, colorGrey40);
- Col_pdi = IIf(PDI(range) > MDI(range) AND ADX(range) > MDI(range),colorBrightGreen,colorDarkGreen);
- Col_Mdi = IIf(MDI(range) > PDI(range) AND ADX(range) > PDI(range),colorRed,colorDarkRed);
- trend = IIf(Col_adx ==colorBlue AND Col_pdi==colorBrightGreen,colorBrightGreen,IIf(Col_adx ==colorBlue AND Col_mdi==colorRed,colorRed,IIf(Col_pdi == colorBrightGreen AND Col_mdi == colorRed,colorYellow, IIf(Col_pdi==colorBrightGreen,colorDarkGreen,IIf(Col_mdi==colorRed,colorDarkRed,colorBlack)))));
- TimeFrameSet(in5Minute);
- Col_adx5 = IIf(ADX(range) > Ref(ADX(range),-1) ,colorBlue, colorGrey40);
- Col_pdi5 = IIf(PDI(range) > MDI(range) AND ADX(range) > MDI(range),colorBrightGreen,colorDarkGreen);
- Col_Mdi5 = IIf(MDI(range) > PDI(range) AND ADX(range) > PDI(range),colorRed,colorDarkRed);
- trend5 = IIf(Col_adx5 ==colorBlue AND Col_pdi5==colorBrightGreen,colorBrightGreen,IIf(Col_adx5 ==colorBlue AND Col_mdi5==colorRed,colorRed,IIf(Col_pdi5 == colorBrightGreen AND Col_mdi5 == colorRed,colorYellow, IIf(Col_pdi5==colorBrightGreen,colorDarkGreen,IIf(Col_mdi5==colorRed,colorDarkRed,colorBlack)))));
- TimeFrameRestore();
- Plot(2, "", trend5, styleOwnScale| styleArea|styleNoLabel,-0.5,100);
- Plot(4, "", Col_adx5, styleOwnScale| styleArea|styleNoLabel,-0.5,100);
- Plot(10, "", trend, styleOwnScale| styleArea|styleNoLabel,-0.5,100);
- _SECTION_END();
複製代碼
|
|