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

[amibroker] Re: auto plot next day's pivots todays close?



PureBytes Links

Trading Reference Links

Hi,

Take a look at this and see if its suitable. This indicator draws
pivots based on the currently selected bar, so just select the most
recent bar. I coded this some time ago and haven't used it for a
while so please check the calculations against another source in
case its been altered.


SetBarsRequired(LastValue(BarIndex()));
UpCandleColor = colorGreen;
DownCandleColor = colorRed;
colorMagenta = 11;
FlipColor = Flip( Nz( C > Ref( C, -1 ), 1 ), C < Ref( C, -1 ));
CandleColor = IIf( FlipColor == 1, UpCandleColor , DownCandleColor );
Plot( Close, "Close", CandleColor, styleCandle );
PlotStyle = styleNoLine + styleLeftAxisScale + styleOwnScale + styleNoLabel + styleNoDraw;
Plot( Open, "Open", 0, PlotStyle );
Plot( High, "High", 0, PlotStyle );
Plot( Low, "Low", 0, PlotStyle );
Plot( Volume, "Volume", 0, PlotStyle );

function PivotLines( price1, price2 )
{
        Minbars = LastValue(BarIndex()) - 60;

        y0 = LastValue(price1); 
        y1= LastValue(price2);
        x0 = SelectedValue(BarIndex()) + 2 - LastValue(TroughBars(L,10,1));
        x1 = SelectedValue(BarIndex()) + 2;
        if ( x0 < Minbars ) x0 = Minbars;
        Line = LineArray( x0, y0, x1, y1, 0, False );
        return Line;
}
p = (SelectedValue(H)+SelectedValue(L)+SelectedValue(C))/3;
r1 = (2*p)-SelectedValue(L); 
s1 = (2*p)-SelectedValue(H); 
r2 = p +(r1 - s1); 
s2 = p -(r1 - s1);


Plot( PivotLines(p,p), "Pivots", colorBlue, styleDots);
Plot( PivotLines(r1,r1), "R1", colorRed, styleLine );
Plot( PivotLines(r2,r2), "R2", colorMagenta, styleLine );
Plot( PivotLines(s1,s1), "S1", colorGreen, styleLine );
Plot( PivotLines(s2,s2), "S2", colorGold, styleLine );

Title = "Pivots:  " + Name() + "  -  " + WriteVal( DateTime(), formatDateTime ) + "  - " + " Open: " + O + ",   Hi: " + H + ",   Low: " + L + ",   Close: " + C + ",   Volume: " + WriteVal(V,1) + "\n" 
+ EncodeColor(colorMagenta) + "R2: " + r2 + "\n" 
+ EncodeColor(colorRed) + "R1: " + r1 + "\n" 
+ EncodeColor(colorBlue) + "Pivot: " + p + "\n"
+ EncodeColor(colorGreen) + "S1: " + s1 + "\n" 
+ EncodeColor(colorGold) + "S2: " + s2;

GraphXSpace = 4;


Regards,
William Peters
www.amitools.com


Monday, September 13, 2004, 10:08:17 PM, you wrote:


YR> I'm referring to pivots based on todays price for tomorrow's 
YR> trading. These are provided on numerous websites. Surely it wasn't
YR> that difficult to understand what I was writing that it required 
YR> that sort of response. 


YR> --- In amibroker@xxxxxxxxxxxxxxx, "dingo" <dingo@xxxx> wrote:
>> Sure - did you want the code that calcs the closing prices for 
YR> tomorrow as
>> well?
>>  
>> d
>> 
>> 
>>   _____  
>> 
>> From: YEA RIGHT [mailto:suedeuno@x...] 
>> Sent: Monday, September 13, 2004 9:27 PM
>> To: amibroker@xxxxxxxxxxxxxxx
>> Subject: [amibroker] auto plot next day's pivots todays close?
>> 
>> 
>> has anyone coded this yet?
>> 
>> 
>> 
>> Check AmiBroker web page at:
>> http://www.amibroker.com/
>> 
>> Check group FAQ at:
>> http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
>> 
>> 
>> 
>> Yahoo! Groups Sponsor	
>> 
>> ADVERTISEMENT
>>  
>> 
YR> <http://us.ard.yahoo.com/SIG=129dhgqf0/M=295196.4901138.6071305.30011
YR> 76/D=gr
>> 
YR> oups/S=1705632198:HM/EXP=1095211659/A=2128215/R=0/SIG=10se96mf6/*http
YR> ://comp
>> anion.yahoo.com> click here	
>>  
>> <http://us.adserver.yahoo.com/l?
YR> M=295196.4901138.6071305.3001176/D=groups/S=
>> :HM/A=2128215/rand=622986216> 	
>> 
>> 
>>   _____  
>> 
>> Yahoo! Groups Links
>> 
>> 
>> *	To visit your group on the web, go to:
>> http://groups.yahoo.com/group/amibroker/
>>   
>> 
>> *	To unsubscribe from this group, send an email to:
>> amibroker-unsubscribe@xxxxxxxxxxxxxxx
>> <mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe> 
>>   
>> 
>> *	Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
YR> Service
>> <http://docs.yahoo.com/info/terms/> . 
>> 
>> 
>> 
>> 
>> [Non-text portions of this message have been removed]




YR> Check AmiBroker web page at:
YR> http://www.amibroker.com/

YR> Check group FAQ at:
YR> http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
YR> Yahoo! Groups Links



 




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

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

<*> 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/