[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: SUPER PIVOT POINTS


  • Date: Fri, 04 Dec 2009 14:34:03 -0000
  • From: "wooziwog" <xcitemint@xxxxxxx>
  • Subject: [amibroker] Re: SUPER PIVOT POINTS

PureBytes Links

Trading Reference Links

Hi Reinsley,

I see your post "Many variables not initialized" but don't understand what arrays / values your are referring to.
I would appreciate additional details.

Thanks,

David K.

--- In amibroker@xxxxxxxxxxxxxxx, reinsley <reinsley@xxx> wrote:
>
> 
> Woozi, Thanks for sharing
> 
> Many variables not initialized...
> 
> Best regards
> 
> 
> wooziwog a écrit :
> >  
> > 
> > Tim,
> > 
> > The following uses AB functions for plotting intraday pivots.
> > You can modify it to suit your needs.
> > I am using version 5.2.9.2. If you have any problems with it check for 
> > line wrapping, I copied it from my intraday chart and tested it.
> > 
> > David K.
> > 
> > //======================
> > _SECTION_BEGIN("Chart Settings");
> > //======================
> > SetChartOptions(0, chartShowDates);
> > SetChartBkColor(1);
> > GraphXSpace=Param("GraphXSpace",15,0,300,1);
> > dec= IIf(StrRight(Name(),3) == "", 3.2, 3.2);
> > bc = BarCount-1;
> > bi = BarIndex();
> > Lbi = LastValue(bi);
> > sbi = SelectedValue(BarIndex());
> > tn = TimeNum();
> > Plot(C,"",IIf(C>O,34,IIf(C<O,32,55)),128,4);
> > //======================
> > pxchartright = Status("pxChartRight");//returns y-coordinate of top-left 
> > corner
> > //======================
> > _SECTION_BEGIN("GFX X Conversion");
> > function tpX(bar) {
> > lvb = Status("LastVisibleBar");
> > fvb = Status("FirstVisibleBar");
> > pxchartleft = Status("pxChartLeft");
> > pxchartright = Status("pxChartRight");
> > pxheight = Status("pxheight");
> > pxchartwidth = Status("pxChartWidth");
> > return pxchartleft+(bar-fvb)*pxchartwidth/(Lvb-fvb+1); }
> > _SECTION_END();
> > //======================
> > _SECTION_BEGIN("GFX Y Conversion");
> > function tPY(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)); }
> > _SECTION_END();
> > //======================
> > _SECTION_BEGIN("GFX Text+Label, GFX Y, Std X");
> > //======================
> > dec=0; ha=0;
> > procedure gtx(val,color,string,xpos) {
> > GfxSetTextColor(color);
> > gtext=GfxDrawText(NumToStr(val,dec)+"-"+
> > StrExtract(string,0)+" ",xpos,tpY(SelectedValue(val))+ha,0,0,256);
> > return gtext; }
> > _SECTION_END();
> > //======================
> > _SECTION_BEGIN("Plot Shapes");
> > //======================
> > procedure plshp(x,y,shape,color,shift)
> > { PlotShapes(IIf(BarIndex()==x,shape,0),color,0,y,shift); }
> > //======================
> > lls=0; sln=0;
> > procedure hrplt(tf,value,color,sty,shf) {
> > Lin=LineArray(Lbi-lls-shf,LastValue(value),
> > Lbi+shf,LastValue(value),1);
> > Plot(IIf(tf AND sln==0,value,Null),"",color,sty,0,0,shf);
> > Plot(IIf(sln==1,Lin,Null),"",color,sty,0,0,shf); }
> > //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> > _SECTION_BEGIN("Intraday Time Pivots");
> > //===============================
> > ipv = ParamList("Sup Res Pivots","Off|All|Calculate||OHLC|Lines|Labels",3);
> > psh= ParamToggle("Plot Shapes", "Off|On",0);
> > htx = Param("Text Shift",18,-200,150,1);
> > sln= ParamToggle("Short Lines", "Off|On",1);
> > lls = Param("Short Line Length",3,0,500,1)*10;
> > shf = Param("Shift Line Right",2,0,50,1);
> > rsc = ParamToggle("No Rescale","Off|On",1);
> > sty = ParamStyle("Style",4096);
> > optn= Param("Market Open",93000,00000,235959,000500);
> > cltn= Param("Market Close",161500,00000,235959,000500);
> > plsi= Param("Start Plotting",083000,00000,240000,000500);
> > plei= Param("End Plotting",161500,00000,240000,000500);
> > //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> > //Time and Dates
> > begD = DateNum() != Ref(DateNum(),-1);//Begin New Day
> > fboD = LastValue(ValueWhen(begD,bi,1));//First Bar of Day
> > endD = DateNum() != Ref(DateNum(), 1);//End of Day
> > lboD = LastValue(ValueWhen(endD,bi,1));//Last Bar of Day
> > lbpd = LastValue(ValueWhen(begD,bi,2)-1);//Last Bar of Previous Day
> > tday = DateNum()==LastValue(DateNum(),1);//Includes current fbod to 
> > future lbod
> > pdaz= ValueWhen(begD,Ref(DateNum(),-1),1);//All bars prior to existing lbod
> > prdaz=pdaz AND NOT tday;
> > notda= NOT tday;
> > //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> > function tvy(tstart,tframe,array) {
> > if(array==1)y = ValueWhen(tframe,HighestSince(Cross(tn,tstart),H),1);
> > if(array==2)y = ValueWhen(tframe,LowestSince(Cross(tn,tstart),L),1);
> > y0=IIf(y>0,y,Null);
> > return y0; }
> > //======================
> > function xbar(tstart,tframe,array) {
> > if(array==1) {
> > y=ValueWhen(tframe,HighestSince(Cross(tn,tstart),H),1);
> > x=BarIndex()==ValueWhen(tframe AND H==y,bi);
> > x0=bc-LastValue(BarsSince(x>0),1); }
> > if(array==2) {
> > y=ValueWhen(tframe,LowestSince(Cross(tn,tstart),L),1);
> > x=bi==ValueWhen(tframe AND L==y,bi);
> > x0=bc-BarsSince(x>0); }
> > return x0; }
> > //==============
> > if(ipv=="All" OR ipv=="Calculate" OR ipv=="Lines" OR ipv=="Labels" OR 
> > ipv=="OHLC") {
> > pmtn = optn-010000; premkt = tn >= pmtn AND tn <= optn;
> > mk05 = optn+000500; tfrm05 = tn>=optn AND tn<= mk05;
> > mk15 = optn+001500; tfrm15 = tn>=optn AND tn<= mk15;
> > mk30 = optn+003000; tfrm30 = tn>=optn AND tn<= mk30;
> > mk45 = optn+004500; tfrm45 = tn>=optn AND tn<= mk45;
> > mk60 = optn+010000; tfrm60 = tn>=optn AND tn<= mk60;
> > mkss = 110000;
> > mkse = 133000; tfrslo = tn>=mkss AND tn<= mkse;
> > va30 = 154500; tfva30 = tn>=va30 AND tn<= cltn;
> > va2h = cltn-020000; tf2hrs = tn>=va2h AND tn<= cltn;
> > mktHrs = tn>=optn AND tn<= cltn;
> > pltval = tn>=plsi AND tn<= va2h;
> > //======================
> > 
> > cyHi = HighestSince(bi==fbod,H);
> > cxHi = ValueWhen(tday AND H==cyHi,bi);
> > cyLo = LowestSince(bi==fbod,L);
> > cxLo = ValueWhen(tday AND L==cyLo,bi);
> > pyHi = ValueWhen(prdaz,HighestSince(bi==lbpd,H),1);
> > pxHi = ValueWhen(H==pyHi AND NOT tday ,bi);
> > pyLo = ValueWhen(prdaz,LowestSince(bi==lbpd,L),1);
> > pxLo = ValueWhen(L==pyLo AND NOT tday,bi);
> > mkOp = ValueWhen(Cross(tn,cltn),O,1);
> > xmOp = bc-BarsSince(Cross(tn,optn)>0);
> > mkCl = ValueWhen(Cross(TimeNum(),160000),C);
> > xmCL = bc-BarsSince(Cross(TimeNum(),160000)>0);
> > xpmk = bc-BarsSince(Cross(tn,optn)>0);
> > //======================
> > poHi=tvy(pmtn,premkt,1); poLo=tvy(pmtn,premkt,2);
> > mkHi=tvy(optn,mktHrs,1); mkLo=tvy(optn,mktHrs,2);
> > Hi05=tvy(optn,tfrm05,1); Lo05=tvy(optn,tfrm05,2);
> > Hi15=tvy(optn,tfrm15,1); Lo15=tvy(optn,tfrm15,2);
> > Hi30=tvy(optn,tfrm30,1); Lo30=tvy(optn,tfrm30,2);
> > Hi60=tvy(optn,tfrm60,1); Lo60=tvy(optn,tfrm60,2);
> > vH2h=tvy(va2h,tf2hrs,1); vL2h=tvy(va2h,tf2hrs,2);
> > vH30=tvy(va30,tfva30,1); vL30=tvy(va30,tfva30,2);
> > ACDos = (Hi15- Lo15) * 0.50;
> > ACDHi=Hi15+ACDos; ACDLo=Lo15-ACDos;
> > dRange = cyHi - cyLo;
> > mRange = mkHi - mkLo;
> > }
> > //===================
> > sty1=8|sty|rsc*2048; sty2=32|sty|rsc*2048;
> > tfplt = TimeNum()>=plsi AND TimeNum()<=plei;
> > if(ipv=="All" OR ipv=="Lines" OR ipv=="OHLC") {
> > hrplt(tfplt,mkOp,29,sty1,shf); hrplt(tfplt,mkCl,55,sty1,shf);
> > hrplt(tfplt,poHi,10,sty1,shf); hrplt(tfplt,poLo,10,sty1,shf);
> > hrplt(tfplt,mkHi,32,sty1,shf); hrplt(tfplt,mkLo,34,sty1,shf);
> > hrplt(tfplt,pyHi,25,sty1,shf); hrplt(tfplt,pyLo,51,sty1,shf);
> > }
> > if(ipv=="All" OR ipv=="Lines") {
> > hrplt(tfplt,Hi05,27,sty2,shf); hrplt(tfplt,Lo05,27,sty2,shf);
> > hrplt(tfplt,Hi15,42,sty2,shf); hrplt(tfplt,Lo15,42,sty2,shf);
> > hrplt(tfplt,Hi30,11,sty2,shf); hrplt(tfplt,Lo05,11,sty2,shf);
> > hrplt(tfplt,Hi60,36,sty2,shf); hrplt(tfplt,Lo60,36,sty2,shf);
> > hrplt(tfplt,vH2h,33,sty2,shf); hrplt(tfplt,vL2h,34,sty2,shf);
> > hrplt(tfplt,vH30,25,sty2,shf); hrplt(tfplt,vL30,51,sty2,shf);
> > hrplt(tfplt,ACDHi,42,sty1,shf); hrplt(tfplt,ACDLo,42,sty1,shf);
> > }
> > //===================
> > GfxSelectFont("Tahoma",10,400); GfxSetBkColor(16); GfxSetOverlayMode(1); 
> > GfxSetBkMode(2);
> > xp=Min(tpX(htx+sbi),pxchartright-80); ha=-5;
> > if(ipv=="All" OR ipv=="Labels" OR ipv=="OHLC") {
> > gtx(vH2h,33,"vH2h",xp); gtx(vL2h,34,"vL2h",xp); gtx(vH30,25,"vH30",xp); 
> > gtx(vL30,51,"vL30",xp);
> > gtx(mkOp,10,"mkOp",xp); gtx(mkCl,55,"mkCl",xp); gtx(pyHi,25,"prHi",xp); 
> > gtx(pyLo,51,"prLo",xp);
> > }
> > if(ipv=="All" OR ipv=="Labels") {
> > gtx(poHi,10,"preH",xp); gtx(poLo,10,"PreL",xp); gtx(mkHi,32,"mkHi",xp); 
> > gtx(mkLo,34,"mkLo",xp);
> > gtx(Hi05,27,"Hi05",xp); gtx(Lo05,27,"Lo05",xp); gtx(Hi15,42,"Hi15",xp); 
> > gtx(Hi30,11,"Hi30",xp);
> > gtx(Lo30,11,"Lo30",xp); gtx(Hi60,36,"Hi60",xp); gtx(Lo60,36,"Lo60",xp);
> > }
> > //===========================
> > up=shapeStar; dn=shapeStar; shp=shapeNone;
> > os=30;
> > //======================
> > if(psh==1) {
> > xoHi=xbar(pmtn,premkt,1); plshp(xoHi,preH,dn,10, os);
> > xoLo=xbar(pmtn,premkt,2); plshp(xoLo,preL,up,10,-os);
> > xmHi=xbar(optn,mktHrs,1); plshp(xmHi,mkHi,dn,32, os+10);
> > xmLo=xbar(optn,mktHrs,2); plshp(xmLo,mkLo,up,34,-os+10);
> > xH05=xbar(optn,tfrm05,1); plshp(xH05,Hi05,dn,51, os);
> > xL05=xbar(optn,tfrm05,2); plshp(xL05,Lo05,dn,34,-os);
> > xH15=xbar(optn,tfrm15,1); plshp(xH15,Hi15,up,42, os+15);
> > xL15=xbar(optn,tfrm15,2); plshp(xL15,Lo15,up,42,-os+15);
> > xH30=xbar(optn,tfrm30,1); plshp(xH30,Hi30,dn,11, os+10);
> > xL30=xbar(optn,tfrm30,2); plshp(xL30,Lo30,up,11,-os+10);
> > xH60=xbar(optn,tfrm60,1); plshp(xH60,Hi60,dn,36, os);
> > xL60=xbar(optn,tfrm60,2); plshp(xL60,Lo60,up,36,-os);
> > xvH2=xbar(va2h,tf2hrs,1); plshp(xvH2,vH2h,dn,34, os);
> > xvL2=xbar(va2h,tf2hrs,2); plshp(xvL2,vL2h,up,33,-os);
> > xvH3=xbar(va30,tfva30,1); plshp(xvH3,vH30,dn,43, os);
> > xvL3=xbar(va30,tfva30,2); plshp(xvL3,vL30,up,25,-os);
> > }
> > //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> > _SECTION_BEGIN("Market Markers");
> > //===============================
> > mkrs= ParamToggle("Plot Markers", "Off|On",0);
> > if(mkrs==1) {
> > VbarO = Cross(TimeNum(),optn);
> > VbarC = Cross(TimeNum(),cltn);
> > Plot(VbarO,"",10,2|32|styleOwnScale|4096|4);
> > Plot(VbarC,"",55,2|32|styleOwnScale|4096|4);
> > }
> > _SECTION_END();
> > //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> > Title = EncodeColor(55)+ Title = Name() + " " + EncodeColor(32) + Date() 
> > + " " + EncodeColor(5) + "{{INTERVAL}} " +
> > //Title = EncodeColor(55)+ Date() + " Tick = " + 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.0) +
> > EncodeColor(55)+ " bi= "+EncodeColor(42)+ WriteVal(sbi,1) +
> > EncodeColor(55)+ " Bar to End = "+ EncodeColor(10)+ WriteVal(Lbi-sbi,1.0);
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx <mailto:amibroker%40yahoogroups.com>, 
> > "Tim" <timkthung@> wrote:
> >  >
> >  > Thanks de again. Let me try to figure out something.
> >  >
> >  >
> >  > From: de_techneut
> >  > Sent: Friday, December 04, 2009 6:50 AM
> >  > To: amibroker@xxxxxxxxxxxxxxx <mailto:amibroker%40yahoogroups.com>
> >  > Subject: [amibroker] Re: SUPER PIVOT POINTS
> >  >
> >  >
> >  >
> >  > Hi Tim, I am also just getting to know Amibroker and AFL, the .dll 
> > was not written by me. I would like to ask more experienced users to 
> > help a hand here. I can tell you the logic in the code but implementing 
> > it and getting nothing but green (no errors ) is a bridge to far for me 
> > now. the logic to be used could be : determine the highest high of a 
> > period the lowest low and the close. calculate your pivots
> >  >
> >  >
> >  >
> >  > use deFlagTimeRange( starttime, endtime) to mark your market open and 
> > you market close
> >  >
> >  >
> >  > then something like
> >  >
> >  >
> >  > openmarket=deFlagTimeRange( starttime, endtime);
> >  >
> >  >
> >  > highofmarket=null;//initialisation
> >  > lowofmarket=null;//initialisation
> >  > if (openmarket)
> >  > {
> >  > highofmarket=iif(h>highofmarket,h,highofmarket);
> >  > lowofmarket=iif(l<lowofmarket,l,lowofmarket);
> >  > marketpivot= (highofmarket+ lowofmarket+c)/3;
> >  > suport1=(marketpivot*2)-highofmarket;
> >  > resistance1=(marketpivot*2)-lowofmarket;
> >  > /* and so on */
> >  > }
> >  > this is just of the top of my head, i haven't tested this code ( i 
> > doubt it works but maybe you get the idea and can take it further.
> >  >
> >  >
> >  > Kind regards
> >  > Marc
> >  >
> >  >
> >  >
> >  >
> >  >
> >  >
> >  > --- In amibroker@xxxxxxxxxxxxxxx 
> > <mailto:amibroker%40yahoogroups.com>, "Tim" <timkthung@> wrote:
> >  >
> >  >
> >  > >
> >  > > Thanks de. I had downloaded it. Would you please show me how to use 
> > it.
> >  > >
> >  > >
> >  > > From: de_techneut
> >  > > Sent: Thursday, December 03, 2009 11:29 PM
> >  > > To: amibroker@xxxxxxxxxxxxxxx <mailto:amibroker%40yahoogroups.com>
> >  > > Subject: [amibroker] Re: SUPER PIVOT POINTS
> >  > >
> >  > >
> >  > >
> >  > > Hi Tim, it is possible to do that with the use of a plugin called 
> > deDATETIME. it has functions which enables you to define your own time 
> > interval hope this helps. Marc
> >  > > --- In amibroker@xxxxxxxxxxxxxxx 
> > <mailto:amibroker%40yahoogroups.com>, "Tim" timkthung@ wrote:
> >  > > >
> >  > > > Hello everybody,
> >  > > > Would anyone please tell me whether we could define the cutting 
> > time in calculating the daily pivots for the next day.
> >  > > > I raise this issue because of my time-zone difference from the NY 
> > stock exchange.
> >  > > > Much appreciate if anyone could help.
> >  > > >
> >  > > > Tim
> >  > > >
> >  > >
> >  >
> > 
> >
>




------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    amibroker-digest@xxxxxxxxxxxxxxx 
    amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/