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

[amibroker] Re: Pivots for Futures



PureBytes Links

Trading Reference Links

This is all you need - I use this myself - just copy and paste:

It is designed for use on Intraday data. The only parameter 
("StartTime") is the start-time for the pivots to display (default = 
130000 = 13:00).

These are the traditional PP,R1,S1,R2,S2 pivots calculated from 
yesterday's daily data and plotted on today's data.

So for 130000, pivot points from 13:00 *yesterday* to 12:59 *today* 
are calculated, and plotted from 13:00 *today* onwards.

Enjoy!


=================================================================

_SECTION_BEGIN("Alex's Pivot Points Code");

// Programmer: Alex Chambers, May 2007
// For Amibroker - just drag and drop

// Please include this and/or any other comment description of any 
changes you make.

SetChartOptions(0,chartShowArrows|chartShowDates|chartWrapTitle);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi
 %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( 
ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | 
ParamStyle("Style") | GetPriceStyle() );

startTime = Param("Start Time",130000,0,240000,500);
ttt = IIf(TimeNum() == startTime,1,0);

Vbar = TimeNum() >= startTime AND TimeNum() < startTime+1;
Plot(Vbar,"",colorBlue,styleHistogram|styleDashed|styleOwnScale|
styleNoLabel|styleThick);

et = Ref(ttt,1);
te = BarsSince(ttt)+1;
aa = IIf(et==1,LLV(L,te),0);
Ll = IIf(ttt==1,Ref(aa,-1),0);
bb = IIf(et==1,HHV(H,te),0); 
Hh = IIf(ttt==1,Ref(bb,-1),0);
pc = IIf(et==1,C,0);

prevL = ValueWhen(ttt==1,Ll);
prevH = ValueWhen(ttt==1,Hh);
prevC = ValueWhen(ttt==1,Ref(pc,-1));

PP = (prevL + prevH + PrevC) / 3;
R1 = (PP * 2) - prevL;
S1 = (PP * 2) - prevH;
R2  = (PP - S1) + R1;
S2  = PP - (R1 - S1);

Plot (PP,"PP",colorTan, styleStaircase);
Plot (R1,"R1",colorTurquoise , styleStaircase);
Plot (S1,"S1",colorTurquoise , styleStaircase);
Plot (R2,"R2",colorLightGrey , styleStaircase);
Plot (S2,"S2",colorLightGrey , styleStaircase);

_SECTION_END();





Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

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

For other support material please check also:
http://www.amibroker.com/support.html
 
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:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto: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/