Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _SECTION_BEGIN("Chart Settings");
- SetChartOptions(0,chartShowArrows|chartShowDates);
- SetChartBkColor(ParamColor("Outer Panel",colorBlack));
- SetChartBkGradientFill(ParamColor("Upper Chart",colorBlack),ParamColor("Lower Chart",colorBlack));
- GraphXSpace=Param("GraphXSpace",10,0,100,1);
- 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);
- _SECTION_END();
- _SECTION_BEGIN("RSI BB");
- A1=EMA(RSI(5),21);
- BBtop=BBandTop(A1,9,.5);
- BBbot=BBandBot(A1,9,.5);
- Color=IIf(a1 > bbtop, colorBlue,IIf(a1 < bbbot, colorRed,colorYellow));
- bbtop_col = IIf (BBtop > Ref(BBtop,-1),colorBlue,colorRed);
- bbbot_col = IIf (BBbot > Ref(BBbot,-1),colorBlue,colorRed);
- Plot(a1,"",color,styleDots);
- Plot(BBtop,"",BBtop_col,styleDots);
- Plot(BBbot,"",BBbot_col,styleDots);
- Plot(50,"",31,1);
- Buy = a1 > bbtop;
- Sell = a1 < bbbot;
- Buy = ExRem(Buy,Sell);
- Sell = ExRem(Sell,Buy);
- PlotShapes(Buy*shapeHollowSmallUpTriangle,colorYellow);
- PlotShapes(Sell*shapeHollowSmallDownTriangle,colorYellow);
- _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",1);
- ATR_Multiplier = Param("ATR_Multiplier",2,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 );
- _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",850,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