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

Re: [amibroker] Re: median points of different time zones



PureBytes Links

Trading Reference Links



Hi chandrakant'

mmm, plots fine for me...

Couple of things, this is not stand alone code needs to plot on a price chart..

I have added below a stand alone version which will plot a price chart.

Also my database is 24hr FX 5 min data not sure what you are using so I have altered the default start to 10:00hrs and finish to 16:00hrs for equities..

 Finally I am not sure what time frame your data is stored in so have removed the  5min reference

The option to plot or not has to be selected in the Parameter settings..

Hope this works for you,
as I mentioned the AFL is not exactly what you were looking for and will need to be used as a basis to be adapted by you to fit your needs

Good luck with it :)

Monty

_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_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() );
_SECTION_END();

_SECTION_BEGIN("Basic time sessions");
 
 _SECTION_BEGIN ( "Session Start & Finish" );
  
 Starttime = Param ( "Start Time", 100000, 000000, 080000, 010000 );
 Endtime = Param ( "End Time", 160000, 000000, 160000, 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;
 
 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:
Hello monty,
Thank you for your quick reply ..but its not plotting correctly !?
even i cant see ..evey level gets mixed up.
please solve this
Thank you

--- In amibroker@xxxxxxxxxxxxxxx, Monty <pmonty@xxx> wrote:
  
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/


  


__._,_.___


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





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___