Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///////////////////////////////////
- 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("Heiken Ashi Smoothed");
- SetChartBkGradientFill( ParamColor("BgTop", colorBlack),ParamColor("BgBottom", colorBlack),ParamColor("Titleblock",colorBlack ));
- SetChartOptions(0,chartShowArrows|chartShowDates);
- GraphXSpace=5;
- p=Param("Period",8,2,30,1);
- Om=MA(O,p);
- hm=MA(H,p);
- lm=MA(L,p);
- Cm=MA(C,p);
- HACLOSE=(Om+Hm+Lm+Cm)/4;
- HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
- HaHigh = Max( Hm, Max( HaClose, HaOpen ) );
- HaLow = Min( Lm, Min( HaClose, HaOpen ) );
- PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "" + Name(), colorWhite, styleCandle | styleNoLabel );
- _SECTION_END();
- a=LinearReg(HaClose, 5 ) ;
- b=LinearReg( HaClose, 5 ) ;
- Plot( IIf(HaHigh>HaOpen,a,b), _DEFAULT_NAME(), colorRed, ParamStyle("Style") );
- Plot( LinearReg( HaOpen, 5 ), _DEFAULT_NAME(), colorWhite, ParamStyle("Style") );
- _SECTION_BEGIN("kgs 12 26 ma buy sell");
- a=MA(C,3) ;
- b=MA(C,15) ;
- Buy = Cross( a,b );
- Sell = Cross( b,a );
- //Short = Sell;
- //Cover = Buy;
- //AlertIf( Buy, "", "MA cross BUY", 1,1+2 );
- //AlertIf( Sell, "", "MA cross SELL", 2 ,1+2)
- AlertIf( Buy, "SOUND C:\\Windows\\Media\\Ding.wav", "Audio alert", 2 );
- AlertIf( Sell, "SOUND C:\\Windows\\Media\\Ding.wav", "Audio alert", 2 );
- _SECTION_END();
- _SECTION_BEGIN("TSKPMoMo");
- blsLong = 0;
- KPStopLine = E_TSKPSTOPLINE(High,Low,Close);
- // tskp_upsell, tskp_triggerline, tskp_triggerlinevma
- sw = E_TSKPUPSELL(Open,High,Low,Close,Volume);
- KPTriggerLine = tskp_triggerline;
- KPFast3Val = IIf((E_TSKPFAST3(Open,High,Low,Close,Volume)> 0),1, -1);
- //tskp_fast2val1, tskp_fast2val2
- dummy = E_TSKPFAST2(Open,High,Low,Close,Volume);
- KPFast2Val = IIf ((tskp_fast2val1 > 0),1,-1);
- Ctmpl = E_TSKPCOLORTMPL(Open,High,Low,Close,Volume);
- sctotal = 0;
- sctotal = sctotal + IIf(tskp_colortmplcnd0 > 0, 1, -1);
- sctotal = sctotal + IIf(tskp_colortmplcnd1 > 0, 1, -1);
- sctotal = sctotal + IIf(tskp_colortmplcnd2 > 0, 1, -1);
- sctotal = sctotal + IIf(tskp_colortmplcnd3 > 0, 1, -1);
- sctotal = sctotal + IIf(tskp_colortmplcnd4 > 0, 1, -1);
- sctotal = sctotal + IIf(tskp_colortmplcnd5 > 0, 1, -1);
- sctotal = sctotal + IIf(tskp_colortmplcnd6 > 0, 1, -1);
- sctotal = sctotal + IIf(tskp_colortmplcnd7 > 0, 1, -1);
- sctotal = sctotal + IIf(tskp_colortmplcnd8 > 0, 1, -1);
- // tskp_mediumma,tskp_mediumup,tskp_mediumdown
- dummy = E_TSKPMEDIUM(Close);
- KPMediumUP = tskp_mediumup;
- KPMediumDwn = tskp_mediumdown;
- KPMediumMA = tskp_mediumma;
- // -- Create 0-initialized arrays the size of barcount
- aHPivs = H - H;
- aLPivs = L - L;
- aHiVal = H - H;
- aLoVal = L - L;
- for (curBar=5; curBar < BarCount-1; curBar++)
- {
- if( (blsLong == -1) OR (blsLong == 0))
- {
- if ((sctotal[CurBar] >= 5) AND (KPMediumUP[CurBar] > KPMediumMA[CurBar] ) AND (KPFast3Val[CurBar] == 1) AND
- (KPFast2Val[CurBar] == 1) AND (KPTriggerLine[CurBar] >= KPStopLine[CurBar] ))
- {
- blsLong = 1;
- aLPivs[CurBar] = 1;
- aLoVal[CurBar] = Low[CurBar];
- }
- }
- if( (blsLong == 1) OR (blsLong == 0))
- {
- if ((sctotal[CurBar] <= -5) AND (KPMediumDwn[CurBar] < KPMediumMA[CurBar] ) AND (KPFast3Val[CurBar] == -1) AND
- (KPFast2Val[CurBar] == -1) AND (KPTriggerLine[CurBar] <= KPStopLine[CurBar] ))
- {
- blsLong = -1;
- aHPivs[Curbar] = 1;
- aHiVal[Curbar] = High[Curbar];
- }
- }
- if ((blsLong == 1) AND ((sctotal[CurBar] < 5) OR (KPMediumUP[CurBar] < KPMediumMA[CurBar] ) OR
- (KPFast2Val[CurBar] < 1) OR (KPFast3Val[CurBar] < 1) OR (KPTriggerLine[CurBar] < KPStopLine[CurBar] )) )
- {
- blsLong= 0;
- }
- if ((blsLong == -1) AND ((sctotal[CurBar] > -5) OR (KPMediumDwn[CurBar] > KPMediumMA[CurBar] ) OR
- (KPFast2Val[CurBar] > -1) OR (KPFast3Val[CurBar] > -1) OR
- (KPTriggerLine[CurBar] > KPStopLine[CurBar] )) )
- {
- blsLong = 0;
- }
- }
- PlotShapes (IIf(aHPivs == 1, shapeSmallCircle, shapeNone) ,colorRed, layer = 0, yposition = haHigh, offset = 17 );
- PlotShapes (IIf(aLPivs == 1, shapeSmallCircle, shapeNone) ,colorGreen, layer = 0, yposition = haLow, offset = -8 );
- AlertIf( Buy, "SOUND C:\\Windows\\Media\\Ding.wav", "Audio alert", 2 );
- AlertIf( Sell, "SOUND C:\\Windows\\Media\\Ding.wav", "Audio alert", 2 );
- _SECTION_END();
- _SECTION_BEGIN("Isfandi Technical Viewer");
- //Plot(C,"",ParamColor( "Color", colorBlue ),ParamStyle("Style") );
- //---- pivot points
- GfxSetBkColor(colorBlack);
- GfxSetTextColor( colorGrey50 );
- GfxSelectFont("Edwardian Script ITC", 25, 500, True );
- DayH = TimeFrameGetPrice("H", inDaily, -1);// yesterdays high
- DayL = TimeFrameGetPrice("L", inDaily, -1);//low
- DayC = TimeFrameGetPrice("C", inDaily, -1);//close
- DayO = TimeFrameGetPrice("O", inDaily);// current day open
- HiDay = TimeFrameGetPrice("H", inDaily);
- LoDay = TimeFrameGetPrice("L", inDaily);
- PP = (DayH + DayL + DayO + DayO) / 4 ;
- R1 = (2 * PP) - DayL;
- S1 = (2 * PP) - DayH;
- R2 = PP + R1 - S1;
- S2 = PP + S1 - R1;
- R3 = R2 + (R1 - PP);
- S3 = S2 - (PP - S1);
- radius = 0.1 * Status("pxheight"); // get pixel height of the chart and use 45% for pie chart radius
- textoffset = 0.1 * radius;
- //====================
- GfxSetOverlayMode(0);
- //-Paint Background
- GfxSelectSolidBrush( colorBlack);
- GfxSelectPen( colorPink);
- GfxRoundRect( 2, 15, 109, 259, 132, 32 );
- GfxSetBkMode( 1 );
- GfxSelectFont("Arial", 8, 900);
- // OTHER INDICATOR
- MOMETUM =RSI(14);
- radius = 0.1 * Status("pxheight"); // get pixel height of the chart and use 45% for pie chart radius
- textoffset = 0.1 * radius;
- GfxSelectFont("Arial", 9, 500, True );
- GfxSelectFont("Arial", 9 );
- GfxSetTextColor( colorLime);
- GfxTextOut( "R1 =" + R1, textoffset + 1, 170 );
- GfxSetTextColor( colorLime );
- GfxTextOut( "R2 = " +R2, textoffset + 1, 150 );
- GfxSetTextColor( colorWhite );
- GfxTextOut( "PP = " +PP, textoffset + 1, 190 );
- GfxSetTextColor( colorOrange );
- GfxTextOut( "S1 = " +S1, textoffset + 1, 210 );
- GfxSetTextColor( colorRed );
- GfxTextOut( "S2 = " +S2, textoffset + 1, 230 );
- GfxSelectFont("Arial", 9 );
- _SECTION_END();
- //////////////////////////////////////////////////////////////////////
- _SECTION_BEGIN("Elder Impulse");
- GfxSelectFont("Arial", 9, 500, True );
- ///////////////////////////////////////////////////
- SetChartOptions(0,chartShowArrows|chartShowDates);
- EnableTextOutput(False);
- // User-defined parameter for EMA periods
- EMA_Type = Param("EMA-1, TEMA-2, JMA-3", 2, 1, 3, 1);
- EMA_prds = Param("EMA_periods", 7, 1, 30, 1);
- Std_MACD = Param("Standard MACD? No-0, Yes-1", 1, 0, 1, 1);
- Plot_fashion = Param("Bar+Arrows-1, Impulse Bars-2", 2, 1, 2, 1);
- // Allow user to define Weekly and Monthly Ribbon Location and Height
- WR_P1 = Param("Weekly Ribbon Location", 5.2, -1000, 1000, 0.1);
- WR_P2 = Param("Weekly Ribbon Height", 199, -0.001, 500, 0.1);
- //MR_P1 = Param("Monthly Ribbon Location", 5.2, -1000, 1000, 0.1);
- //MR_P2 = Param("Monthly Ribbon Height", 199, -0.001, 500, 0.1);
- // Compute EMA and MACD Histogram
- if(EMA_Type == 1)
- {
- DayEMA = EMA(Close, EMA_prds);
- }
- if (EMA_Type == 2)
- {
- DayEMA = TEMA(Close, EMA_prds);
- }
- Histogram = MACD() - Signal();
- // Determine if we have an Impulse UP, DOWN or None
- Impulse_Up = DayEMA > Ref(DayEMA, -1) AND Histogram > Ref(Histogram, -1);
- Impulse_Down = DayEMA < Ref(DayEMA, -1) AND Histogram < Ref(Histogram, -1);
- Impulse_None = (NOT Impulse_UP) AND (NOT Impulse_Down);
- // Compute Weekly MACD and determine whether rising or falling
- TimeFrameSet(inWeekly);
- if (Std_MACD == 0)
- {
- MACD_val = MACD(5, Cool);
- Signal_val = Signal(5, 8, 5);
- }
- else
- {
- MACD_val = MACD(12, 26);
- Signal_val = Signal(12, 26, 9);
- }
- Hist_in_w = MACD_val - Signal_val;
- wh_rising = Hist_in_w > Ref(Hist_in_w, -1);
- wh_falling = Hist_in_w < Ref(Hist_in_w, -1);
- wh_none = (NOT wh_rising) AND (NOT wh_falling);
- TimeFrameRestore();
- // Now get Monthly MACD Histogram....
- TimeFrameSet(inMonthly);
- MACD_val = MACD(5, 8);
- Signal_val = Signal(5, 8, 5);
- Hist_in_m = MACD_val - Signal_val;
- mh_rising = Hist_in_m > Ref(Hist_in_m, -1);
- mh_falling = Hist_in_m < Ref(Hist_in_m, -1);
- TimeFrameRestore();
- wh_rising = TimeFrameExpand( wh_rising, inWeekly, expandLast );
- wh_falling = TimeFrameExpand( wh_falling, inWeekly, expandLast);
- wh_none = TimeFrameExpand( wh_none, inWeekly, expandLast);
- mh_rising = TimeFrameExpand(mh_rising, inMonthly, expandLast);
- mh_falling = TimeFrameExpand(mh_falling, inMonthly, expandLast);
- kol = IIf( wh_rising, colorBrightGreen, IIf(wh_falling, colorRed, IIf(wh_none, colorCustom11, colorLightGrey)));
- mkol = IIf( mh_rising, colorBlue, IIf(mh_falling, colorYellow, colorLightGrey));
- if (Plot_fashion == 1)
- {
- }
- else
- {
- bar_kol = IIf(impulse_UP, colorBrightGreen, IIf(impulse_Down, colorRed, colorCustom11));
- }
- Impulse_State = WriteIf(Impulse_Up, "Bulllish", WriteIf(Impulse_Down, "Bearish", "Neutral"));
- GfxSetTextColor( colorYellow );
- GfxTextOut( "IMPULSE STATE = " +Impulse_State, textoffset + 162, 45 );
- // Set the background color for Impulse Status Column
- Impulse_Col = IIf(Impulse_Up, colorGreen, IIf(Impulse_Down, colorRed, colorGrey40));
- // Determine Weekly Trend. Display as Text Column
- Weekly_Trend = WriteIf(wh_rising, "Rising", WriteIf(wh_falling, "Falling", "Flat!"));
- Weekly_Col = IIf(wh_rising, colorGreen, IIf(wh_falling, colorRed, colorLightGrey));
- GfxSetTextColor( colorPink );
- GfxTextOut( "WEEKLT TREND = " +Weekly_Trend, textoffset + 162, 60 );
- // Determine Monthly Trend. Display as Text Column
- Monthly_Trend = WriteIf(mh_rising, "Rising", WriteIf(mh_falling, "Falling", "Flat!"));
- Monthly_Col = IIf(mh_rising, colorGreen, IIf(mh_falling, colorRed, colorLightGrey));
- GfxSetTextColor( colorOrange );
- GfxTextOut( "MONTHLY TREND = " +Monthly_Trend, textoffset + 151, 75 );
- // Determine how many bars has the current state existed
- bars_in_bull = Min(BarsSince(impulse_none), BarsSince(impulse_down));
- bars_in_bear = Min(BarsSince(impulse_up), BarsSince(impulse_none));
- bars_in_neut = Min(BarsSince(impulse_down), BarsSince(impulse_up));
- // Set a single variable to show number of bars in current state depending upon
- // actual Impulse Status - Bullish, Bearish or Neutral
- bars_in_state = IIf(Impulse_Up, bars_in_bull, IIf(Impulse_down, bars_in_bear, bars_in_neut));
- //weekly pivot
- k1=-1;
- SetChartBkColor(16 ) ;
- k=IIf(ParamList("select type","daily|next day")=="daily",-1,0);
- k1=-1;
- TimeFrameSet(inDaily);
- day_h= LastValue(Ref(H,K));
- day_l= LastValue(Ref(L,K));
- day_c= LastValue(Ref(C,K));
- TimeFrameRestore();
- // day
- DH=Day_h;
- DL=Day_L;
- DC=Day_C;
- // DAY PIVOT Calculation
- pd = ( DH+ DL + DC )/3;
- sd1 = (2*pd)-DH;
- sd2 = pd -(DH - DL);
- sd3 = Sd1 - (DH-DL);
- rd1 = (2*pd)-DL;
- rd2 = pd +(DH -DL);
- rd3 = rd1 +(DH-DL);
- WriteVal( StochK(39) - StochK(12) );
- GfxSelectFont("Arial", 8 );
- _SECTION_END();
- _SECTION_BEGIN("STOCHASTIC");
- GfxSelectFont("Arial", 9, 500, True );
- periods = Param( "Periods", 15, 1, 200, 1 );
- Ksmooth = Param( "%K avg", 3, 1, 200, 1 );
- a = StochK( periods , Ksmooth);
- Dsmooth = Param( "%D avg", 3, 1, 200, 1 );
- b = StochD( periods , Ksmooth, DSmooth );
- Buy = Cross( a, b );
- Sell = Cross( b, a );
- STOCH =WriteIf(a>b , "Up","Down");
- GfxSetTextColor( colorYellow );
- GfxTextOut( "Stochastic = " +STOCH, textoffset + 200, 30 );
- GfxSelectFont("Arial", 8 );
- _SECTION_BEGIN("Van K Tharp Efficient Stocks");
- // Mark Keitel 12-05
- // Van K Tharp Efficient Stocks
- GfxSelectFont("Arial", 9, 500, True );
- ATRD180 = ATR(180);
- ATRD90 = ATR(90);
- ATRD45 = ATR(45);
- ATRD20 = ATR(20);
- ATRD5 = ATR(5);
- DifferenceD180 = Close - Ref(Close,-180);
- DifferenceD90 = Close - Ref(Close,-90);
- DifferenceD45 = Close - Ref(Close,-45);
- DifferenceD20 = Close - Ref(Close,-20);
- DifferenceD5 = Close - Ref(Close,-5);
- EfficiencyD180 = IIf(ATRD180!=0,DifferenceD180/ATRD180,1);
- EfficiencyD90 = IIf(ATRD90!=0,DifferenceD90/ATRD90,1);
- EfficiencyD45 = IIf(ATRD45!=0,DifferenceD45/ATRD45,1);
- EfficiencyD20 = IIf(ATRD20!=0,DifferenceD20/ATRD20,1);
- EfficiencyD5 = IIf(ATRD5!=0,DifferenceD5/ATRD5,1);
- Averageeff = (EfficiencyD180 + EfficiencyD90 + EfficiencyD45 +
- EfficiencyD20 ) / 4;
- //Plot( averageeff, "AvgEff", colorLightBlue, styleLine );
- x = Param ( "Add Results to a Watchlist? Yes = 1, No = 2" , 2 , 1 , 2 , 1 ) ; // select whether to add results to watchlist or not
- y = Param("Set Watchlist Number", 25, 2, 60,1); // sets the watchlist number, but reserves the first 2 and last 4 watchlists
- // -------- Parameter Variables for Exploration --------------------------------
- TCH = Param("High close value ", 20, 5, 300, 0.5);
- TCL = Param("Low close value " , 5, 1, 10, 0.25);
- AVP = Param("Period for Avg Vol " , 21, 10, 240, 1);
- SV = Param("Stock minimum Avg Vol " , 125000, 50000, 1000000, 500000);
- // -------------- Organize the exploration results ------------------------------------
- P = Param("Period for Price Delta Comparisons", 1, 1, 120, 1);
- P1 = Param("Period for Other Delta Comparisons", 3, 1, 120, 1);
- PATR = Param("Period for ATR", 5,1,21,1);
- PADX = Param("Period for ADX", 14, 3, 34,1);
- PRSI = Param("Period for RSI", 13, 3, 34,1);
- ADX_TREND =WriteIf(PDI(PADX)>MDI(PADX),"_ TREND UP","_TREND DOWN");
- GfxSetTextColor( colorYellow );
- GfxTextOut( "RSI(14) = " + MOMETUM + ADX_TREND , textoffset + 650,30);
- ADX_14 = ADX(14);
- GfxSetTextColor( colorYellow );
- GfxTextOut( "ADX_TREND = " +ADX_14+ ADX_TREND, textoffset + 380, 30 );
- _SECTION_END();
- _SECTION_BEGIN("Price Line");
- PriceLineColor=ParamColor("PriceLineColor",colorRed);
- PriceLevel = ParamField("PriceField", field = 3 );
- Daysback = Param("Bars Back",500,10,900,1);
- FirstBar = BarCount - DaysBack;
- YY = IIf(BarIndex() >= Firstbar,EndValue(PriceLevel),Null);
- Plot(YY,"Current Price",PriceLineColor,ParamStyle("LineStyle",styleLine|styleDashed|styleNoTitle|styleNoLabel|styleThick,maskAll));
- side = Param("side",1,1,1000,2);
- dist = 0;
- for( i = 0; i < BarCount; i++ )
- {
- if(i+side== BarCount) PlotText( "\n " + PriceLevel[ i ], i, YY[ i ]-dist[i], colorRed );
- }
- _SECTION_END();
- _SECTION_BEGIN("Ribbon");
- uptrend=PDI()>MDI()AND Signal()<MACD();
- downtrend=MDI()>PDI()AND Signal()>MACD();
- Plot( 1, /*efines the height of the ribbon in percent of pane width */"ribbon",
- IIf( uptrend, colorLime, IIf( downtrend, colorRed,IIf(Signal()<MACD(), colorWhite, colorWhite ))), /* choose color */
- styleOwnScale|styleArea|styleNoLabel, -0, 20 );
- _SECTION_END();
- // Supertrend - Translated from Kolier MQ4
- // see: http://kolier.li/indicator/kolier-supertrend-indi
- // translation in Amibroker AFL code by E.M.Pottasch, 2011
- procedure calcTrend_proc(ATR_Period,tr,ATR_Multiplier,TrendMode,CalcPrice)
- {
- global buffer_line_down;
- global buffer_line_up;
- buffer_line_down = Null;
- buffer_line_up = Null;
- PHASE_NONE = 0;
- PHASE_BUY = 1;
- PHASE_SELL = -1;
- phase=PHASE_NONE;
- band_upper = 0;
- band_lower = 0;
- for(i = ATR_Period + 1; i < BarCount; i++)
- {
- band_upper = CalcPrice[i] + ATR_Multiplier * tr[i];
- band_lower = CalcPrice[i] - ATR_Multiplier * tr[i];
- if(phase==PHASE_NONE)
- {
- buffer_line_up[i] = CalcPrice[i];
- buffer_line_down[i] = CalcPrice[i];
- }
- if(phase!=PHASE_BUY && Close[i]>buffer_line_down[i-1] && !IsEmpty(buffer_line_down[i-1]))
- {
- phase = PHASE_BUY;
- buffer_line_up[i] = band_lower;
- buffer_line_up[i-1] = buffer_line_down[i-1];
- }
- if(phase!=PHASE_SELL && Close[i]<buffer_line_up[i-1] && !IsEmpty(buffer_line_up[i-1]))
- {
- phase = PHASE_SELL;
- buffer_line_down[i] = band_upper;
- buffer_line_down[i-1] = buffer_line_up[i-1];
- }
- if(phase==PHASE_BUY && ((TrendMode==0 && !IsEmpty(buffer_line_up[i-2])) || TrendMode==1) )
- {
- if(band_lower>buffer_line_up[i-1])
- {
- buffer_line_up[i] = band_lower;
- }
- else
- {
- buffer_line_up[i] = buffer_line_up[i-1];
- }
- }
- if(phase==PHASE_SELL && ((TrendMode==0 && !IsEmpty(buffer_line_down[i-2])) || TrendMode==1) )
- {
- if(band_upper<buffer_line_down[i-1])
- {
- buffer_line_down[i] = band_upper;
- }
- else
- {
- buffer_line_down[i] = buffer_line_down[i-1];
- }
- }
- }
- }
- SetBarsRequired(sbrAll,sbrAll);
- TrendMode = ParamToggle("TrendMode","Off|On",0);
- ATR_Multiplier = Param("ATR_Multiplier",3,0.1,10,0.1);
- ATR_Period = Param( "ATR_Period",5,1,20,1);
- tr = ATR(ATR_Period);
- CalcPrice = (H+L)/2;
- calcTrend_proc(ATR_Period,tr,ATR_Multiplier,TrendMode,CalcPrice);
- SetChartOptions(0,chartShowDates);
- Plot( 2,"",IIf(buffer_line_up,colorBrightGreen,colorRed),styleOwnScale|styleArea|styleNoLabel, -10, 100 );
- Plot( 4,"",IIf(buffer_line_down,colorRed,colorBrightGreen),styleOwnScale|styleArea|styleNoLabel, -5, 100 );
- #include <T3_include.AFL>;
- //************************************************** ********************************
- // Plot price horizontal line *
- //************************************************** ********************************/
- ///********************************************//
- 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.AFL>;
- _SECTION_BEGIN("Trendslong");
- //CT=ParamColor("CT", colorRed );
- UpTrendCond3 = Cross ( T3( flowerclose, 7), T3( flowerclose, 9) );
- dnTrendCond3 = Cross ( T3( flowerclose, 9),T3( flowerclose, 7) );
- upt3= T3( flowerclose, 7)> T3( flowerclose, 9) ;
- dnTrend3 = T3( flowerclose, 9)>T3( flowerclose, 7) ;
- //for Trend1
- Trendslongup= WriteIf(upt3,"trendlongup", "");
- Trendslongdown= WriteIf( dnTrend3,"trendlongdn", "");
- //Trendslongcon= WriteIf( UpTrendCond3,"trendlongcon", "");
- if ( Trendslongup =="trendlongup")
- {
- GfxSelectSolidBrush(34 ); //ColorRGB(0,90,0)
- }
- else
- if (Trendslongdown =="trendlongdn")
- {
- GfxSelectSolidBrush(25 ); //ColorRGB(90,0,0)
- }
- else
- if (Trendslongdown =="")
- {
- GfxSelectSolidBrush( colorYellow );
- }
- GfxSelectFont( "Arial", 10, 100 );
- GfxSetBkMode( 1 );
- GfxSetTextColor( colorBlack );
- GfxSelectPen( colorBlack, 1 ); // broader color
- GfxRectangle( 15,109,95,119 );
- _SECTION_END();
- _SECTION_BEGIN("Trendsmid");
- //DT=ParamColor("DT", colorRed );
- UpTrendCond2 = Cross ( T3( flowerclose, 5), T3( flowerclose, 7) );
- dnTrendCond2 = Cross (T3( flowerclose, 7), T3( flowerclose, 5) );
- upt2= T3( flowerclose, 5)> T3( flowerclose, 7) ;
- dnTrend2 = T3( flowerclose, 7)>T3( flowerclose, 5) ;
- //for trend2
- Trendmidup= WriteIf(upt2,"trendmidup", "");
- Trendmiddown= WriteIf( dnTrend2,"trendmiddn", "");
- Trendmidcon= WriteIf( UpTrendCond2,"trendmidcon", "");
- 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
- }
- GfxSelectFont( "Arial", 10, 100 );
- GfxSetBkMode( 1 );
- GfxSetTextColor( colorBlack );
- GfxSelectPen( colorBlack, 1 ); // broader color
- GfxRectangle( 15,97,95,107 );
- _SECTION_END();
- _SECTION_BEGIN("Trendsshort");
- //ET=ParamColor("ET", colorRed );
- UpTrendCond1 = Cross( flowerClose, T3( flowerClose, 5 ) );
- dnTrendCond1 = Cross( T3( flowerClose, 5 ),flowerClose );
- upt1=flowerClose > T3( flowerClose, 5 ) ;
- dnTrend1 = flowerClose< T3( flowerClose, 5 );
- //for Trend1
- Trendshortup= WriteIf(upt1,"trendup", "");
- Trendshortdown= WriteIf( dnTrend1,"trenddn", "");
- Trendshortcon= WriteIf( UpTrendCond1,"trendcon", "");
- 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 );
- }
- GfxSelectFont( "Arial", 10, 100 );
- GfxSetBkMode( 1 );
- GfxSetTextColor( colorBlack );
- GfxSelectPen( colorBlack, 1 ); // broader color
- GfxRectangle( 15,85,95,95 );
- _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);
- AtrupTrendCond1 = flowerClose> CS33 ;
- AtrdnTrendCond1 =CS33>flowerClose ;
- ATRup = WriteIf(AtrupTrendCond1,"atrup", "");
- ATRdown= WriteIf( AtrdnTrendCond1,"atrdn", "");
- if ( ATRup =="atrup")
- {
- GfxSelectSolidBrush( 34 ); //ColorRGB(0,180,0)
- }
- else
- if (ATRdown =="atrdn")
- {
- GfxSelectSolidBrush( 25); //ColorRGB(180,0,0)
- }
- else
- if ( ATRdown =="")
- {
- GfxSelectSolidBrush( colorGrey40 );
- }
- GfxSelectFont( "Arial", 10, 100 );
- GfxSetBkMode( 1 );
- GfxSetTextColor( colorBlack );
- GfxSelectPen( colorBlack, 1 ); // broader color
- GfxRectangle( 15,73,95,83 );
- _SECTION_END();
- _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 );
- EntryB = WriteIf( EntrySig,"eu", "");
- ExitB = WriteIf( ExitSig,"ed", "");
- if ( EntryB =="eu")
- {
- GfxSelectSolidBrush( 34 ); //ColorRGB(0,210,0)
- }
- else
- if ( ExitB =="ed")
- {
- GfxSelectSolidBrush( 25); //ColorRGB(210,0,0)
- }
- else
- if ( ExitB =="")
- {
- GfxSelectSolidBrush( colorGrey40 );
- }
- GfxSelectFont( "Arial", 10, 100 );
- GfxSetBkMode( 1 );
- GfxSetTextColor( colorBlack );
- GfxSelectPen( colorBlack, 1 ); // broader color
- GfxRectangle( 15,61,95,71 );// changing the value of x,y,rad x-70, y-90, rad-24
- _SECTION_END();
- _SECTION_BEGIN("CCI9-2");
- //HT=ParamColor("HT", colorRed );
- ccidn=CCI(8) < 0;
- cciup=CCI(9) > 0;
- ccresult1 = WriteIf( cciup,"cu", "");
- ccresult2 = WriteIf( ccidn,"cd", "");
- 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 );
- }
- GfxSelectFont( "Arial", 10, 100 );
- GfxSetBkMode( 1 );
- GfxSetTextColor( colorBlack );
- GfxSelectPen( colorBlack, 1 ); // broader color
- GfxRectangle( 15,49,95,59 );
- _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;
- bbresult1 = WriteIf( bbup,"bu", "");
- bbresult2 = WriteIf( bbdown,"bd", "");
- bbresult3 = WriteIf( C,"bearishrevers", "");
- 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 );
- }
- GfxSelectFont( "Arial", 10, 100 );
- GfxSetBkMode( 1 );
- GfxSetTextColor( colorBlack );
- GfxSelectPen( colorBlack, 1 ); // broader color
- GfxRectangle( 15,37,95,47 );//
- _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();
- A=C>TM3 AND C<TM4;
- B=C>TM3 AND C>TM4;
- C=C<TM3 AND C>TM4;
- D=C<TM3 AND C<TM4;
- result1 = WriteIf( A,"bullrevers", "");
- result2 = WriteIf( B,"bull", "");
- result3 = WriteIf( C,"bearishrevers", "");
- result4 = WriteIf( D,"bear", "");
- 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";
- }
- GfxSelectFont( "Arial", 10, 100 );
- GfxSetBkMode( 1 );
- GfxSetTextColor( colorWhite );//text color black to white
- GfxSelectPen( colorBlack,1); // broader color
- GfxRectangle( 15,25,95,35 );// rectangle instead circle
- //GfxTextOut( OP ,92,235) ;// this line added
- _SECTION_END();
- _SECTION_BEGIN("system Ticker");
- function GetSecondNum()
- {
- Time = Now( 4 );
- Seconds = int( Time % 100 );
- Minutes = int( Time / 100 % 100 );
- Hours = int( Time / 10000 % 100 );
- SecondNum = int( Hours * 60 * 60 + Minutes * 60 + Seconds );
- return SecondNum;
- }
- RequestTimedRefresh( 1 );
- //----------------------------------------------------------------------------
- //----------------------------------------------------------------------------
- TimeFrame = Interval();
- SecNumber = GetSecondNum();
- Newperiod = SecNumber % TimeFrame == 0;
- SecsLeft = SecNumber - int( SecNumber / TimeFrame ) * TimeFrame;
- SecsToGo = TimeFrame - SecsLeft;
- x=Param(" xposn",880,100,1000,1000);
- y=Param(" yposn",0,40,1000,1);
- GfxSelectSolidBrush( colorPink );
- GfxSelectPen( colorBlack, 2 );
- if ( NewPeriod )
- {
- GfxSelectSolidBrush( colorBlack );
- GfxSelectPen( colorBlack, 2 );
- Say( "New candle" );
- }
- GfxRoundRect( x+55, y+17, x-4, y-2, 0, 0 );
- GfxSetBkMode(1);
- GfxSelectFont( "Arial", 9, 700, False );
- GfxSetTextColor( colorBlack );
- GfxTextOut( "" +SecsToGo+" / "+NumToStr( TimeFrame, 1.0 ), x, y );
- _SECTION_END();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement