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, 14, 880, 33, 32, 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 + 310, 17 );
- GfxSetTextColor( colorLime );
- GfxTextOut( "R2 = " +R2, textoffset + 410, 17 );
- GfxSetTextColor( colorWhite );
- GfxTextOut( "PP = " +PP, textoffset + 210, 17 );
- GfxSetTextColor( colorOrange );
- GfxTextOut( "S1 = " +S1, textoffset + 10, 17 );
- GfxSetTextColor( colorRed );
- GfxTextOut( "S2 = " +S2, textoffset + 110, 17 );
- GfxSelectFont("Arial", 9 );
- _SECTION_END();
- //-Paint Background
- GfxSelectSolidBrush( colorBlack);
- GfxSelectPen( colorBlue);
- GfxRoundRect( 2, 50, 880, 31, 32, 32 );
- GfxSetBkMode( 1 );
- GfxSelectFont("Arial", 8, 900);
- //////////////////////////////////////////////////////////////////////
- _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 + 10, 33 );
- // 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 + 500, 17 );
- // 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 + 690, 17 );
- // 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, 33 );
- 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,33);
- ADX_14 = ADX(14);
- GfxSetTextColor( colorYellow );
- GfxTextOut( "ADX_TREND = " +ADX_14+ ADX_TREND, textoffset + 380, 33 );
- _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, colorGreen, IIf( downtrend, colorRed,IIf(Signal()<MACD(), colorYellow, colorPink ))), /* choose color */
- styleOwnScale|styleArea|styleNoLabel, -60, 17 );
- _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, -400, 80 );
- Plot( 4,"",IIf(buffer_line_down,colorRed,colorBrightGreen),styleOwnScale|styleArea|styleNoLabel, -390, 92 );
- _SECTION_BEGIN("Price Line");
- PriceLineColor=ParamColor("PriceLineColor",colorWhite);
- 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], colorBrightGreen );
- }
- _SECTION_END();
- no=21;
- res=HHV(H,no);
- sup=LLV(L,no);
- avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
- avn=ValueWhen(avd!=0,avd,1);
- supres=IIf(avn==1,sup,res);
- a=Cross(C,supres);
- b=Cross(supres,C);
- style = a * styleStaircase + b * styleStaircase;
- PlotShapes(a,style, IIf(a,colorGreen,colorRed), 0, IIf(a,Low,High));
- Plot(supres,"Swing",colorYellow,styleStaircase);
- _SECTION_END();
- _SECTION_BEGIN("Magfied Market Price");
- //Magfied Market Price
- FS=Param("Font Size",15,11,100,1);
- GfxSelectFont("Times New Roman", FS, 700, True );
- GfxSetBkMode( colorWhite );
- GfxSetTextColor( ParamColor("Color",colorWhite) );
- Hor=Param("Horizontal Position",500,1,1200,1);
- Ver=Param("Vertical Position",110,1,830,1);
- GfxTextOut(""+C, Hor , Ver );
- YC=TimeFrameGetPrice("C",inDaily,-1);
- DD=Prec(C-YC,2);
- xx=Prec((DD/YC)*100,2);
- GfxSelectFont("Times New Roman", 8, 600, True );
- GfxSetBkMode( colorBlack );
- GfxSetTextColor(ParamColor("Color",colorYellow) );
- GfxTextOut(""+DD+" ("+xx+"%)", Hor , Ver+22 );
- _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();
- // set background gradient colours
- SetChartBkGradientFill( ParamColor("BgTop", colorBlack),ParamColor("BgBottom", colorBlack),ParamColor("titleblock",colorBlack));
- m=IIf(ParamList("select type","Message Board|Message Board1")=="Message Board",-1,0);
- messageboard = ParamToggle("Message Board1","Show|Hide",0);
- showsl = ParamToggle("Stop Loss Line", "Show|Hide", 1);
- m1 = ParamToggle("Message Board1","Show|Hide",0);
- style = a * styleStaircase + b * styleStaircase;
- PlotShapes(a,style, IIf(a,colorGreen,colorRed), 0, IIf(a,Low,High));
- if (showsl == 0) Plot(supres,"Stop Loss",colorCustom14,styleDots);
- exitlong = Cross(supres, H);
- PlotShapes(exitlong * shapeNone, colorBlack,0,H,-10);
- exitshort = Cross(L, supres);
- PlotShapes(exitshort * shapeNone, colorBlack,0,L,-15);
- Buy = exitshort;
- Sell = exitlong;
- //Short = Sell;
- //Cover = Buy;
- Buy = ExRem(Buy,Sell);
- Sell = ExRem(Sell,Buy);
- //Short = ExRem(Short, Cover);
- //Cover = ExRem(Cover, Short);
- AlertIf( Buy, "", "BUY @ " + C, 1 );
- AlertIf( Sell, "", "SELL @ " + C, 2 );
- for (i=BarCount-1; i>1; i--) {
- if (Buy[i] == 1) {
- entry = O[i];
- sig = "BUY";
- sl = supres[1];
- tar1 = entry + (entry * .0090);
- tar2 = entry + (entry * .0150);
- tar3 = entry + (entry * .0250);
- tar4 = entry + (entry * .0350);
- tar5 = entry + (entry * .0450);
- tar6 = entry + (entry * .0550);
- tar7 = entry + (entry * .0650);
- tar8 = entry + (entry * .0750);
- tar9 = entry + (entry * .1000);
- bars = i;
- i = 0;
- }
- if (Sell[i] == 1) {
- sig = "SELL";
- entry = O[i];
- sl = supres[i];
- tar1 = entry - (entry * .0090);
- tar2 = entry - (entry * .0150);
- tar3 = entry - (entry * .0250);
- tar4 = entry - (entry * .0325);
- tar5 = entry - (entry * .0500);
- tar6 = entry - (entry * .0750);
- tar7 = entry - (entry * .0850);
- tar8 = entry - (entry * .0950);
- tar9 = entry - (entry * .1000);
- bars = i;
- i = 0;
- }
- }
- Offset = 20;
- Clr = IIf(sig == "BUY", colorLime, colorRed);
- ssl = IIf(bars == BarCount-1, supres[BarCount-1], Ref(supres, -1));
- sl = ssl[BarCount-1];
- printf("Last " + sig + " Signal came " + (BarCount-bars) + " bars ago");
- printf("\n" + sig + " @ : " + entry + "\nStop Loss : " + sl + " (" + WriteVal(IIf(sig == "SELL",entry-sl,sl-entry), 2.2) + ")"+ "\nTarget_1 : " + tar1 + "\nTarget_2 : " + tar2 + "\nTarget_3 : " + tar3);
- printf("\nCurrent P/L : " + WriteVal(IIf(sig == "BUY",(C-entry),(entry-C)),2.2));
- if (messageboard == 0) {
- GfxSelectFont( "Tahoma", 9, 900 );
- GfxSetBkMode( 1 );
- GfxSetTextColor( colorAqua );
- if (sig =="BUY")
- GfxSelectSolidBrush( colorDarkRed ); // this is the box background color
- else
- GfxSelectSolidBrush( colorRed ); // this is the box background color
- pxHeight = Status( "pxchartheight" ) ;
- xx = Status( "pxchartwidth");
- CENTER = 20;
- width =31;
- x = 7;
- x20 = 180;
- y = Status( "pxchartheight" );
- GfxSelectPen( colorDarkRed, 1); // broader color
- GfxRoundRect( x, y - 280, x, y , 7, 7 ) ;
- GfxTextOut( Name(),13,y-220);
- GfxTextOut( ("" + WriteIf(sig =="BUY",sig + " @ ",sig + " @") + " : " + entry), 73, y-220);
- GfxTextOut( ("Trailing SL : " + sl + " "), 13, y-200);
- GfxTextOut( ("TGT:1 : " + tar1), 213, y -220);
- GfxTextOut( ("TGT:2 : " + tar2), 370,y-220);
- GfxTextOut( ("TGT:3 : " + tar3), 500, y -220);
- GfxTextOut( ("TGT:4 : " + tar4), 630,y-220);
- GfxTextOut( ("Current P/L : " + WriteVal(IIf(sig == "BUY",(C-entry),(entry-C)),2.2)), 800, y-220);;
- }
- /* ------------------------------------------------------------------
- ------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement