Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TimeFrameSet(inDaily);
- DayHigh = LastValue(H);
- DayLow = LastValue(L);
- TimeFrameRestore();
- prev=AMA2(C,1,0);
- d=IIf(C>Ref(Max(Max(H,Ref(H,-20)),Max(Ref(H,-10),Ref(H,-15))),-1),Min(Min(L,Ref(L,-20)),Min(Ref(L,-10),Ref(L,-15))),
- IIf(C<Ref(Min(Min(L,Ref(L,-20)),Min(Ref(L,-10),Ref(L,-15))),-1),Max(Max(H,Ref(H,-20)),Max(Ref(H,-10),Ref(H,-15))),PREV));
- a=Cross(Close,d);
- b=Cross(d,Close);
- state=IIf(BarsSince(a)<BarsSince(b),1,0);
- s=state>Ref(state,-1);
- ss=state<Ref(state,-1);
- sss=state==Ref(state,-1);
- col=IIf(state == 1 ,51,IIf(state ==0,4,1));
- Buy = s;
- Sell = ss;
- shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
- PlotShapes( shapeUpArrow * s ,colorBlue,0,L, Offset=s);
- PlotShapes( shapeHollowCircle * s ,colorOrange,0,L, Offset=s-12);
- PlotShapes( shapeHollowCircle *ss ,colorPink,0,H, Offset=s);
- PlotShapes( shapeDownArrow *ss ,colorBlack,0,H, Offset=s+12);
- PlotShapes(shape, IIf(Buy,colorGreen,colorRed), 0, IIf(Buy,Low,High));
- PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-10);
- PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-20);
- PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-15);
- PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=20);
- PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=30);
- PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-25);
- //WriteIf(s,"EXIT all Short positions\nif trading long positions, enter long Now-\nOR at the market price on tomorrow's Open with stop="+EncodeColor(4)+WriteVal(L+.75*ATR(5),1.4)+" ,","");
- //WriteIf(ss,"exit all long positions today with a Market On Close (MOC) order\nOR at the market price on tomorrow's Open with stop="+EncodeColor(4)+WriteVal(Ref(H+.75*ATR(5), -1),1.4)+",","");
- //WriteIf( sss ,"No trading signals today.","") ;
- dist = 0.8*ATR(10);
- dist1 = 2*ATR(10);
- for( i = 0; i < BarCount; i++ )
- {
- if( Buy[i] )
- {
- }
- if( Sell[i] )
- {
- }
- }
- Filter = s OR sss OR sss ;
- AddColumn(C,"close",1.2);
- AddColumn( IIf( s, 66,1 ), "buy", formatChar, 1, bkcolor =IIf (s,colorYellow, colorPink ));
- AddColumn( IIf( Ss, 83,1 ), "sell", formatChar, 1, bkcolor =IIf (Ss,colorPink, colorWhite ));
- AddColumn( IIf( sss, 87,1 ), "wait", formatChar, 1, bkcolor =IIf (sss,colorYellow, colorRed ));
- _SECTION_BEGIN("2 Timeframes Candlestick Bar Chart");
- // Specially designed for use in day trading and to save chart space. This chart will displays 2 sets
- // of candlestick bars. One for the time interval set for your chart- for example 1 minute.
- // The higher timeframe candlestick bars are created by using gfx low-level graphics and will display
- // according to the parameters you set- for example 5 minutes.
- // I got the idea from David's (dbwyatt_1999) 2 Timeframe chart code which was shared by him on the AmiBroker List.
- // It uses TimeFrame functions with the PlotOHLC function using styleCloud. So I was thinking it would look
- // very nice using low-level graphics instead. Little bit more complicated, but I got a few great pointers from Herman!
- // If your chart background turns pink- please read the error message in the upper left corner of the chart.
- // Then please observe this AFL code uses ColorBlend(ColorFrom, ColorTo, Factor) which was introduced in version 5.21 beta.
- // The rules are simple- time frames from 1 up to 60 minutes AND Lower time frame must be smaller than the Higher time frame.
- _SECTION_BEGIN("Background text");
- SetChartBkColor(colorWhite);
- strWeekday = StrMid("---sunday---Monday--TuesdayWednesday-Thursday--Friday--Saturday", SelectedValue(DayOfWeek())*9,9);
- GraphXSpace=Param("GraphXSpace",0,-55,200,1);
- C13=Param("fonts",20,10,30,1 );
- C14=Param("left-right",2.1,1.0,5.0,0.1 );
- C15=Param("up-down",12,1,20,1 );
- Miny = Status("axisminy");
- Maxy = Status("axismaxy");
- lvb = Status("lastvisiblebar");
- fvb = Status("firstvisiblebar");
- pxwidth = Status("pxwidth");
- pxheight = Status("pxheight");
- GfxSetBkMode(transparent=1);
- GfxSetOverlayMode(1);
- GfxSelectFont("Candara", Status("pxheight")/C13 );
- GfxSetTextAlign( 6 );
- GfxSetTextColor( ColorRGB (217,217,213));
- GfxTextOut( Name(), Status("pxwidth")/C14, Status("pxheight")/C15 );
- GfxSelectFont("Tahoma", Status("pxheight")/C13*0.5 );
- GfxSetTextColor( ColorRGB (103,103,103));
- GfxTextOut( "By", Status("pxwidth")/C14, Status("pxheight")/C15*2.5 );
- GfxSelectFont("Candara", Status("pxheight")/C13*0.5 );
- GfxSetTextColor( ColorRGB (103,103,103));
- GfxTextOut( "Saisri2320", Status("pxwidth")/C14, Status("pxheight")/C15*4 );
- GfxSelectFont("MS Sans Serif", 10, 500, False, False, 0);
- _SECTION_END();
- _SECTION_BEGIN("Title");
- DODay = TimeFrameGetPrice("O", inDaily);
- DHiDay = TimeFrameGetPrice("H", inDaily);
- DLoDay = TimeFrameGetPrice("L", inDaily);
- Title = EncodeColor(colorBlue)+"* SAISRI2320 * "+EncodeColor(colorGreen)+ Name() + ", " + Interval(2) + ", " + Date() + " - "+strWeekday + " - " +
- EncodeColor(colorBlue) + "\nO " + EncodeColor(colorRed) + O +
- ", H : " + H +
- ", L : " + L +
- ", C : " + C +
- "\n"+EncodeColor(colorBlue)+ " Day-Open : " +DODay + " Day-High : " +DHiDay + " Day-Low : " + DLoDay
- ;
- _SECTION_END();
- //XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
- // PARAMETERS AND SETTINGS:
- //XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
- ChartLum = Param("Chart Background Color Intensity", 0.40, 0, 1, 0.01);
- TFMinShort = Param("Short Timeframe (Minutes)", 5, 1, 1440, 1);
- TFMinLong = Param("Long Timeframe (Minutes)", 15, 1, 1500, 1);
- OnSTFBars = ParamToggle("Short TF Bars", "Off, On", 1);
- OnLTFBars = ParamToggle("Long TF Bars", "Off, On", 1);
- BarLum1 = Param("Short TF Bar Color Intensity", 0, 0, 1, 0.01);
- BarLum2 = Param("Long TF Bar Color Intensity", 0.70, 0, 1, 0.01);
- SetChartBkColor(ColorBlend(colorWhite, colorWhite, ChartLum));
- // Bar Colors for the Short Timeframe candlestick bars:
- LineColor = ColorBlend(colorBlack, colorWhite, BarLum1);
- UpBarColor = ColorBlend(colorBrightGreen, colorWhite, BarLum1);
- DnBarColor = ColorBlend(colorRed, colorWhite, BarLum1);
- // Bar Colors For The Long Timeframe candlestick bars:
- TFLineColor = ColorBlend(colorBlack, colorWhite, BarLum2 - 0.1);
- TFUpBarColor = ColorBlend(colorBrightGreen, colorWhite, BarLum2);
- TFDnBarColor = ColorBlend(colorRed, colorWhite, BarLum2);
- //XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
- // FUNCTIONS:
- //XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
- function GetVisibleBarCount()
- {
- lvb = Status("lastvisiblebar");
- fvb = Status("firstvisiblebar");
- return Min( Lvb - fvb, BarCount - fvb );
- }
- function GfxConvertBarToPixelX( bar )
- {
- lvb = Status("lastvisiblebar");
- fvb = Status("firstvisiblebar");
- pxchartleft = Status("pxchartleft");
- pxchartwidth = Status("pxchartwidth");
- return pxchartleft + bar * pxchartwidth / ( Lvb - fvb + 1 );
- }
- function GfxConvertValueToPixelY( Value )
- {
- local Miny, Maxy, pxchartbottom, pxchartheight;
- Miny = Status("axisminy");
- Maxy = Status("axismaxy");
- pxchartbottom = Status("pxchartbottom");
- pxchartheight = Status("pxchartheight");
- return pxchartbottom - floor( 0.5 + ( Value - Miny ) * pxchartheight/ ( Maxy - Miny ) );
- }
- StaticVarKey = Name();
- procedure xStaticVarSet(SName, SValue)
- {
- global StaticVarKey;
- if (StaticVarKey != "")
- StaticVarSet(Sname + StaticVarKey, Svalue);
- }
- //XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
- // MAIN PROGRAM:
- //XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
- if(Interval() != TFMinShort * 60)
- {
- Title = Title + "\n" + "\n" + "ALERT, ALERT, ALERT!!!" + "\n" + "Set the chart time interval to: " + NumToStr(TFMinShort, 1.0, 1) +
- " Minute(s) or change the Short Timeframe Parameter setting.";
- OnSTFBars = 0;
- OnLTFBars = 0;
- SetChartBkColor(colorRose);
- }
- if(TFMinShort >= TFMinLong)
- {
- Title = Title + "\n" + "\n" + "ALERT, ALERT, ALERT!!!" + "\n" + "The Long Timeframe setting must be longer than the Short Timeframe!";
- OnSTFBars = 0;
- OnLTFBars = 0;
- SetChartBkColor(colorRose);
- }
- if(OnSTFBars)
- {
- BarColor = IIf(Close > Open, UpBarColor, DnBarColor);
- SetBarFillColor(BarColor);
- Plot(Close, "", LineColor, styleCandle);
- }
- else
- Plot(Close, "", colorBlack, styleCandle | styleNoDraw);
- TFSec = in1Minute * TFMinLong;
- TimeFrameSet(TFSec);
- TFOpen = Open;
- TFHigh = High;
- TFLow = Low;
- TFClose = Close;
- TFBarIndex = BarIndex();
- TFLastBarIndex = LastValue(BarIndex());
- TimeFrameRestore();
- TFOpen = TimeFrameExpand(TFOpen, TFSec, expandFirst);
- TFHigh = TimeFrameExpand(TFHigh, TFSec, expandFirst);
- TFLow = TimeFrameExpand(TFLow, TFSec, expandFirst);
- TFClose = TimeFrameExpand(TFClose, TFSec, expandFirst);
- TFBarIndex = TimeFrameExpand(TFBarIndex, TFSec, expandLast + 1);
- TFLastBarIndex = TimeFrameExpand(TFLastBarIndex, TFSec, expandLast + 1);
- CandleTop = Max(TFOpen, TFClose);
- CandleBottom = Min(TFOpen, TFClose);
- //================================================== ==========================
- // GFX LOW-LEVEL GRAPHICS SECTION.
- // DRAWING THE LONG TIMEFRAME CANDLESTICK BARS:
- //================================================== ==========================
- if(OnLTFBars)
- {
- GfxSetOverlayMode(1);
- AllVisibleBars = GetVisibleBarCount();
- fvb = Status("firstvisiblebar");
- ChartWidth = GfxConvertBarToPixelX(AllVisibleBars );
- PixBar = ChartWidth / AllVisibleBars;
- Adjust = Pixbar * 0.35;
- TFMinutes = TFMinLong / TFMinShort;
- NewTFBar = IIf(TFBarIndex != Ref(TFBarIndex, -1), 1, 0);
- BarInd = BarIndex();
- TFLastBarIndex = LastValue(TFLastBarIndex);
- // DRAW BAR HISTORY AND THE CURRENT BAR:
- for(i = 0; i < AllVisibleBars; i++)
- {
- x1 = GfxConvertBarToPixelX(i) * NewTFBar[i + fvb] - Adjust;
- if(BarInd[i + fvb] < TFLastBarIndex AND NewTFBar[i + fvb] == 1)
- {
- Counter = 0;
- for(n = i + 1; NewTFBar[n + fvb] == 0 AND n + fvb < BarCount-1; n++)
- Counter++;
- x2 = GfxConvertBarToPixelX(i + Counter) * NewTFBar[i + fvb] + 1 + Adjust;
- }
- if(TFBarIndex[i + fvb] == TFLastBarIndex)
- x2 = GfxConvertBarToPixelX(i + TFMinutes - 1) * NewTFBar[i + fvb] + 1 + Adjust;
- y1 = GfxConvertValueToPixelY(CandleTop[i + fvb]);
- y2 = GfxConvertValueToPixelY(CandleBottom[i + fvb]);
- yH = GfxConvertValueToPixelY(TFHigh[i + fvb]);
- yL = GfxConvertValueToPixelY(TFLow[i + fvb]);
- // Candle Body:
- GfxSelectPen(TFLineColor, 0);
- FillColor = IIf(TFOpen[i + fvb] < TFClose[i + fvb], TFUpBarColor, TFDnBarColor);
- GfxSelectSolidBrush(FillColor);
- if(y1 == y2){y1 = y1 - Adjust; y2 = y2 + Adjust; GfxSelectSolidBrush(TFLineColor);}
- if(x1 > 0){
- GfxRectangle( x1, y1, x2, y2);
- // Candle High and Low:
- GfxSelectPen(TFLineColor, 2);
- GfxMoveTo(x2+(x1-x2)/2, y1);
- GfxLineTo(x2+(x1-x2)/2, yH);
- GfxMoveTo(x2+(x1-x2)/2, y2);
- GfxLineTo(x2+(x1-x2)/2, yL);
- RequestTimedRefresh(0);
- }
- }
- }
- _SECTION_END();
- _SECTION_BEGIN("Parameters");
- LB1= Param("Long LookBack Periods",42,1,60,1);
- LB3= Param("Mid LookBack Periods",18,1,30,1);
- LB2= Param("Short LookBack Periods",6,1,30,1);
- _SECTION_END();
- _SECTION_BEGIN("ResistanceLong");
- RsColor=ParamColor("LongResColor",colorRed);
- BrCount=Param("LongBarLength",65,1,500,1);
- for (i=0;i<BarCount-BrCount;i++) //hide the line except most recent 10 bars
- {
- RsColor[i] = colorBlack;
- }
- 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);
- R=ValueWhen(Cross(MA(flowerClose,LB1),C),HHV(flowerHigh,LB1),-1);
- Plot(R,"Resistance",RsColor,ParamStyle("LongResStyle",styleNoTitle|styleLine|styleDots|styleStaircase|styleThick,maskAll));
- _SECTION_END();
- _SECTION_BEGIN("ResistanceMid");
- Rs3Color=ParamColor("MidResColor",colorOrange);
- BrCount3=Param("MidBarLength",40,1,500,1);
- for (i=0;i<BarCount-BrCount3;i++) //hide the line except most recent 10 bars
- {
- Rs3Color[i] =colorBlack;
- }
- 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);
- RM2=ValueWhen(Cross(EMA(flowerClose,LB3),C),HHV(flowerHigh,LB3),-1);
- Plot(RM2,"MidRes",Rs3Color,ParamStyle("MidResStyle",styleLine|styleStaircase|styleNoTitle,maskAll));
- _SECTION_END();
- _SECTION_BEGIN("ResistanceShort");
- Rs2Color=ParamColor("ShortResColor",colorCustom12);
- BrCount2=Param("ShortResLength",12,1,500,1);
- for (i=0;i<BarCount-BrCount2;i++) //hide the line except most recent 10 bars
- {
- Rs2Color[i] = colorBlack;
- }
- 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);
- RM=ValueWhen(Cross(TEMA(flowerClose,LB2),C),HHV(flowerHigh,LB2),-1);
- Plot(RM,"ShortRes",Rs2Color,ParamStyle("ShortResStyle",styleDashed|styleThick|styleNoTitle|styleStaircase,maskAll));
- _SECTION_END();
- _SECTION_BEGIN("SupportLong");
- Sup1Color=ParamColor("LongSupColor",colorGreen);
- BrCount4=Param("LongSupBarLength",65,1,500,1);
- for (i=0;i<BarCount-BrCount4;i++) //hide the line except most recent 10 bars
- {
- Sup1Color[i] =colorBlack;
- }
- 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);
- S=ValueWhen(Cross(MA(flowerClose,LB1),C),LLV(flowerLow,LB1),-1);
- Plot(s,"Support",Sup1Color,ParamStyle("SupStyle",styleLine|styleDots|styleStaircase|styleThick|styleNoTitle,maskAll));
- _SECTION_END();
- _SECTION_BEGIN("SupportMid");
- Sup3Color=ParamColor("MidSupColor",colorBlue);
- BrCount6=Param("MidBarLength",40,1,500,1);
- for (i=0;i<BarCount-BrCount6;i++) //hide the line except most recent 10 bars
- {
- Sup3Color[i] =colorBlack;
- }
- 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);
- SM2=ValueWhen(Cross(EMA(flowerClose,LB3),C),LLV(flowerLow,LB3),-1);
- Plot(SM2,"MidSup",Sup3Color,ParamStyle("MidSupStyle",styleLine|styleStaircase|styleNoTitle,maskAll));
- _SECTION_END();
- _SECTION_BEGIN("SupportShort");
- Sup2Color=ParamColor("ShortSupColor",colorPink);
- BrCount5=Param("ShortSupBarLength",12,1,500,1);
- for (i=0;i<BarCount-BrCount5;i++) //hide the line except most recent 10 bars
- {
- Sup2Color[i] =colorBlack;
- }
- 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);
- SM=ValueWhen(Cross(TEMA(flowerClose,LB2),C),LLV(flowerLow,LB2),-1);
- Plot(SM,"ShortSup",Sup2Color,ParamStyle("ShortSupStyle",styleDashed|styleThick|styleNoTitle|styleStaircase,maskAll));
- _SECTION_END();
- _SECTION_BEGIN("Isfandi Technical Viewer");
- 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);
- //-Paint Background
- GfxSelectSolidBrush( colorWhite);
- GfxSelectPen( colorRed);
- GfxRoundRect( 2, 0, 930, 51, 30, 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 + 740, 32 );
- GfxSetTextColor( colorLime );
- GfxTextOut( "R2 = " +R2, textoffset + 820, 32);
- GfxSetTextColor( colorBlue );
- GfxTextOut( "PP = " +PP, textoffset + 660, 32);
- GfxSetTextColor( colorOrange );
- GfxTextOut( "S1 = " +S1, textoffset + 500, 32);
- GfxSetTextColor( colorRed );
- GfxTextOut( "S2 = " +S2, textoffset + 580, 32);
- GfxSelectFont("Arial", 9 );
- _SECTION_END();
- //-Paint Background
- GfxSelectSolidBrush( colorWhite);
- GfxSelectPen( colorPink);
- GfxRoundRect( 500, 1, 930, 27, 32, 32 );
- GfxSetBkMode( 1 );
- GfxSelectFont("Arial", 8, 900);
- _SECTION_BEGIN("Magnified Market Price");
- FS=Param("Font Size",12,30,100,1);
- GfxSelectFont("Arial", FS, 700, italic = False, underline = False, True );
- GfxSetBkMode( colorGreen );
- GfxSetTextColor( ParamColor("Color",colorGreen) );
- Hor=Param("Horizontal Position",650,800,800,800);
- Ver=Param("Vertical Position",5,27,27,27);
- GfxTextOut("CMP: "+C,Hor , Ver );
- YC=TimeFrameGetPrice("C",inDaily,-1);
- DD=Prec(C-YC,2);
- xx=Prec((DD/YC)*100,2);
- GfxSelectFont("Arial", 12, 700, italic = False, underline = False, True );
- GfxSetBkMode( colorGreen );
- GfxSetTextColor(ParamColor("Color",colorGreen) );
- GfxTextOut("change ("+DD+") ("+xx+"%)", Hor+130, Ver+0 );
- _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",540,100,1000,1000);
- y=Param(" yposn",7,40,1000,1);
- GfxSelectSolidBrush( colorWhite );
- GfxSelectPen( colorWhite, 2 );
- if ( NewPeriod )
- {
- GfxSelectSolidBrush( colorWhite );
- GfxSelectPen( colorWhite, 2 );
- }
- GfxRoundRect( x+55, y+17, x-4, y-2, 0, 0 );
- GfxSetBkMode(1);
- GfxSelectFont( "Arial", 9, 700, False );
- GfxSetTextColor( colorBlue );
- GfxTextOut( "" +SecsToGo+" / "+NumToStr( TimeFrame, 1.0 ), x, y );
- _SECTION_END();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement