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

Re: [amibroker] median points of different time zones



PureBytes Links

Trading Reference Links

Hi,

This is a bit of code I use to plot session pivots for FX on an intraday 
chart,

It plots 9 levels but you may be able to adapt it to do what you need.


_SECTION_BEGIN ( "Session Start & Finish" );

    TimeFrameSet ( in5Minute );

Starttime = Param ( "Start Time", 000000, 000000, 240000, 010000 );
Endtime = Param ( "End Time", 180000, 000000, 240000, 010000 );

TN = TimeNum();

ST = ( TN == Starttime );

ET = ( TN == Endtime );

    

PlotSF = ParamToggle ( "Plot?", "No,Yes", 0 );

if ( PlotSF )
    {

        Plot ( ST, "Time = Start time", colorGreen, styleHistogram | 
styleOwnScale );
        Plot ( ET, "Time = End time", colorRed, styleHistogram | 
styleOwnScale );

    }

else
    {

    }

_SECTION_END();

_SECTION_BEGIN ( "Session Pivots" );



BiS = ValueWhen ( ST, Cum(1)-1);
BiE = ValueWhen ( ET, Cum(1)-1);

Bargap = BiE - BiS;

SO = ValueWhen ( tn == starttime, Open );
SH = ValueWhen ( ET, HHV ( H, Bargap ) );
SL = ValueWhen ( ET, LLV ( L, Bargap ) );
SC = ValueWhen ( tn == endtime, Close );
SR = SH - SL;
// Session PIVOT Calculation

SPP = ( SH + SL + sC ) / 3;
SS1 = ( 2 * SPP ) - SH;
SR1 = ( 2 * SPP ) - SL;
SS2 = SPP - ( SH - SL );
SS3 = SS1 - ( SH - SL );
SR2 = SPP + ( SH - SL );
SR3 = SR1 + ( SH - SL );

// Session PIVOT mid points

SM3 = ( SPP + SR1 ) / 2;
SM4 = ( SR1 + SR2 ) / 2;
SM5 = ( SR2 + SR3 ) / 2;
SM2 = ( SPP + SS1 ) / 2;
SM1 = ( SS1 + SS2 ) / 2;
SM0 = ( SS2 + SS3 ) / 2;

TimeFrameRestore();


PlotSP = ParamToggle ( "Plot?", "No,Yes", 0 );

if ( PlotSP )
    {

        Plot ( SR2, "", colorBlue, styleLine + styleThick + 
styleNoRescale + styleNoLabel );
        Plot ( SM4, "", colorBlack, styleDashed + styleNoRescale + 
styleNoLabel );
        Plot ( SR1, "", colorBlue, styleDots + styleThick + 
styleNoRescale + styleNoLabel );
        Plot ( SM3, "", colorBlack, styleDashed + styleNoRescale + 
styleNoLabel );

        Plot ( SPP, "", colorRed, styleDots + styleThick + 
styleNoRescale + styleNoLabel );

        Plot ( SS1, "", colorGreen, styleDots + styleThick + 
styleNoRescale + styleNoLabel );
        Plot ( SM2, "", colorBlack, styleDashed + styleNoRescale + 
styleNoLabel );
        Plot ( SS2, "", colorGreen, styleLine + styleThick + 
styleNoRescale + styleNoLabel );
        Plot ( SM1, "", colorBlack, styleDashed + styleNoRescale + 
styleNoLabel );

    }

else
    {

    }

_SECTION_END();

Monty

chandrakant wrote:
> Dear senior members,
> PLEASE help me ..i want to plot median points ..and my condition are =
> market opens=95500
> median points= [h+l]/2;
> [1]median points HHV[ 95500 TO 10300] and LLV[95500 TO 103000]
> [2]median points HHV[ 103000 TO 110000] and LLV[103000 TO 110000]
> [3]median points HHV[ 110000 TO 120000] and LLV[110000 TO 120000]
> this gives 3 pivots...*on intraday chart..
> KINDLY HELP ME TO CONSTRUCT THIS
> THANK YOU
>
>
>
> ------------------------------------
>
> **** 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
>
>
>
>
>   


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

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