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

[amibroker] Re: Pivot points on first 30 min of trading



PureBytes Links

Trading Reference Links

Absolutely brilliant. Copied your formula, changed the times and there
it is.

Thank you very much Ed for this nice work and all your help.

Regards,

Bart. 





--- In amibroker@xxxxxxxxxxxxxxx, "Edward Pottasch" <empottasch@xxx>
wrote:
>
> hi Bart,
> 
> I will add the code inside the Email. Only watch for line wraps.
> 
> the plugin is called deDateTime.dll and indeed you have to put in
inside the Plugins folder. Then when you restart Amibroker it will ask
you if you want to use this plugin, or some window pops up (can't
remeber exactly) but there is some acknowledgement that it is
incorporated within Amibroker. So all you have to do is place this
file inside the Plugins folder.
> 
> Code below can just be placed inside an afl file. The start and
endtime you need to adjust for your local needs,  rgds Ed
> 
> /* coded by: E.M.Pottasch */ 
> 
> starttime = 153000; 
> endtime = 160000; 
> 
> tn = TimeNum(); 
> 
> timecond = tn >= starttime AND tn <= endtime; 
> startday = tn == starttime; 
> timecondChart = tn > endtime AND tn < 240000; 
> 
> firstBarOfDay = deFlagFirstBarOfDay( starttime ); 
> lastBarOfDay = deFlagLastBarOfDay( endtime); 
> 
> myHigh = ValueWhen( timecond, HighestSince( firstBarOfDay, High) ); 
> myLow = ValueWhen( timecond, LowestSince( firstBarOfDay, Low) ); 
> myClose = ValueWhen(lastBarOfDay,C); 
> 
> DH = TimeFrameCompress(myHigh, inDaily, compressLast); 
> DL = TimeFrameCompress(myLow, inDaily, compressLast); 
> DC = TimeFrameCompress(myClose, inDaily, compressLast); 
> 
> //DH = Ref(DH,-1); 
> //DL = Ref(DL,-1); 
> //DC = Ref(DC,-1); 
> 
> DH = TimeFrameExpand( DH, inDaily, expandFirst ); 
> DL = TimeFrameExpand( DL, inDaily, expandFirst ); 
> DC = TimeFrameExpand( DC, inDaily, expandFirst ); 
> 
> rg = DH - DL; 
> 
> PV = (DH+DL+DC)/3; 
> R1 = 2*PV - DL; 
> R2 = PV + rg; 
> R3 = PV + 2*rg; 
> R4 = PV + 3*rg; 
> 
> S1 = 2*PV - DH; 
> S2 = PV - rg; 
> S3 = PV - 2*rg; 
> S4 = PV - 3*rg; 
> 
> Type =
ParamList("Type","Pivot,Pivot/S1/R1,Pivot/S1/S2/R1/R2,Pivot/S1/S2/S3/R1/R2/R3,Pivot/S1/S2/S3/S4/R1/R2/R3/R4");

> 
> if( Type == "Pivot" )  { 
> 
>    SetBarsRequired(10000, 10000); 
> 
>    SetChartOptions(0, chartShowDates); 
>    Plot(C,"C",colorWhite,64); 
>    Plot(IIf(timecondChart,PV,Null),"PV",colorWhite,styleThick); 
>    Plot( timecond, "", colorDarkGrey, styleArea|styleOwnScale,0,1); 
> 
> } 
> 
> if( Type == "Pivot/S1/R1" )  { 
> 
>    SetBarsRequired(10000, 10000); 
> 
>    SetChartOptions(0, chartShowDates); 
>    Plot(C,"C",colorWhite,64); 
>    Plot(IIf(timecondChart,PV,Null),"PV",colorWhite,styleThick); 
> 
>    // resistance 
>    Plot(IIf(timecondChart,R1,Null),"\nR1",colorRed,styleThick);
PlotText( "R1\n", LastValue(Cum(1)), LastValue(R1), colorRed ); 
> 
>    // support 
>    Plot(IIf(timecondChart,S1,Null),"\nS1",colorGreen,styleThick);
PlotText( "S1\n", LastValue(Cum(1)), LastValue(S1), colorGreen ); 
> 
>    Plot( timecond, "", colorDarkGrey, styleArea|styleOwnScale,0,1); 
> 
> } 
> 
> if( Type == "Pivot/S1/S2/R1/R2" )  { 
> 
>    SetBarsRequired(10000, 10000); 
> 
>    SetChartOptions(0, chartShowDates); 
>    Plot(C,"C",colorWhite,64); 
>    Plot(IIf(timecondChart,PV,Null),"PV",colorWhite,styleThick); 
> 
>    // resistance 
>    Plot(IIf(timecondChart,R1,Null),"\nR1",colorRed,styleThick);
PlotText( "R1\n", LastValue(Cum(1)), LastValue(R1), colorRed ); 
>    Plot(IIf(timecondChart,R2,Null),"R2",colorOrange,styleThick);
PlotText( "R2\n", LastValue(Cum(1)), LastValue(R2), colorOrange ); 
> 
>    // support 
>    Plot(IIf(timecondChart,S1,Null),"\nS1",colorGreen,styleThick);
PlotText( "S1\n", LastValue(Cum(1)), LastValue(S1), colorGreen ); 
>   
Plot(IIf(timecondChart,S2,Null),"S2",colorBrightGreen,styleThick);
PlotText( "S2\n", LastValue(Cum(1)), LastValue(S2), colorBrightGreen ); 
> 
>    Plot( timecond, "", colorDarkGrey, styleArea|styleOwnScale,0,1); 
> 
> } 
> 
> if( Type == "Pivot/S1/S2/S3/R1/R2/R3" )  { 
> 
>    SetBarsRequired(10000, 10000); 
> 
>    SetChartOptions(0, chartShowDates); 
>    Plot(C,"C",colorWhite,64); 
>    Plot(IIf(timecondChart,PV,Null),"PV",colorWhite,styleThick); 
> 
>    // resistance 
>    Plot(IIf(timecondChart,R1,Null),"\nR1",colorRed,styleThick);
PlotText( "R1\n", LastValue(Cum(1)), LastValue(R1), colorRed ); 
>    Plot(IIf(timecondChart,R2,Null),"R2",colorOrange,styleThick);
PlotText( "R2\n", LastValue(Cum(1)), LastValue(R2), colorOrange ); 
>   
Plot(IIf(timecondChart,R3,Null),"R3",colorLightOrange,styleThick);
PlotText( "R3\n", LastValue(Cum(1)), LastValue(R3), colorLightOrange ); 
> 
>    // support 
>    Plot(IIf(timecondChart,S1,Null),"\nS1",colorGreen,styleThick);
PlotText( "S1\n", LastValue(Cum(1)), LastValue(S1), colorGreen ); 
>   
Plot(IIf(timecondChart,S2,Null),"S2",colorBrightGreen,styleThick);
PlotText( "S2\n", LastValue(Cum(1)), LastValue(S2), colorBrightGreen ); 
>    Plot(IIf(timecondChart,S3,Null),"S3",colorSeaGreen ,styleThick);
PlotText( "S3\n", LastValue(Cum(1)), LastValue(S3), colorSeaGreen ); 
> 
>    Plot( timecond, "", colorDarkGrey, styleArea|styleOwnScale,0,1); 
> 
> } 
> 
> if( Type == "Pivot/S1/S2/S3/S4/R1/R2/R3/R4" )  { 
> 
>    SetBarsRequired(10000, 10000); 
> 
>    SetChartOptions(0, chartShowDates); 
>    Plot(C,"C",colorWhite,64); 
> 
>    Plot(IIf(timecondChart,PV,Null),"PV",colorWhite,styleThick); 
> 
>    // resistance 
>    Plot(IIf(timecondChart,R1,Null),"\nR1",colorRed,styleThick);
PlotText( "R1\n", LastValue(Cum(1)), LastValue(R1), colorRed ); 
>    Plot(IIf(timecondChart,R2,Null),"R2",colorOrange,styleThick);
PlotText( "R2\n", LastValue(Cum(1)), LastValue(R2), colorOrange ); 
>   
Plot(IIf(timecondChart,R3,Null),"R3",colorLightOrange,styleThick);
PlotText( "R3\n", LastValue(Cum(1)), LastValue(R3), colorLightOrange ); 
>    Plot(IIf(timecondChart,R4,Null),"R4",colorYellow,styleThick);
PlotText( "R4\n", LastValue(Cum(1)), LastValue(R4), colorYellow ); 
> 
>    // support 
>    Plot(IIf(timecondChart,S1,Null),"\nS1",colorGreen,styleThick);
PlotText( "S1\n", LastValue(Cum(1)), LastValue(S1), colorGreen ); 
>   
Plot(IIf(timecondChart,S2,Null),"S2",colorBrightGreen,styleThick);
PlotText( "S2\n", LastValue(Cum(1)), LastValue(S2), colorBrightGreen ); 
>    Plot(IIf(timecondChart,S3,Null),"S3",colorSeaGreen ,styleThick);
PlotText( "S3\n", LastValue(Cum(1)), LastValue(S3), colorSeaGreen ); 
>    Plot(IIf(timecondChart,S4,Null),"S4",colorPaleGreen ,styleThick);
PlotText( "S4\n", LastValue(Cum(1)), LastValue(S4), colorPaleGreen ); 
> 
>    Plot( timecond, "", colorDarkGrey, styleArea|styleOwnScale,0,1); 
> 
> } 
> 
> 
> 
> 
>   ----- Original Message ----- 
>   From: bartvandyk 
>   To: amibroker@xxxxxxxxxxxxxxx 
>   Sent: Tuesday, February 17, 2009 1:29 AM
>   Subject: [amibroker] Re: Pivot points on first 30 min of trading
> 
> 
>   I downloaded the deDateTime plug-in and stuck it in the folder
>   plug-ins. When I press Tools, highlight the plug-in and press Load, 
>   the eSignal feed stops working. Is just seeing the DateTime Functions
>   Plug-in enough and don't I need to load it?
> 
>   Also the PT afl attachment doesn't seem to do anything. I can't double
>   click it. 
> 
>   Does that afl automatically work with that plug-in?
> 
>   I tried to find the afl in the formula library, but I don't think its
>   there.
> 
>   I appreciate all your input and help.
> 
>   Please talk me through this.
> 
>   Bart. 
> 
>   --- In amibroker@xxxxxxxxxxxxxxx, "Edward Pottasch" <empottasch@>
>   wrote:
>   >
>   > hi
>   > 
>   > i adjusted the display a little. Have sent before but didn't come
>   through. So might come through twice ...
>   > 
>   > ed
>   > 
>   > 
>   > 
>   > ----- Original Message ----- 
>   > From: bartvandyk 
>   > To: amibroker@xxxxxxxxxxxxxxx 
>   > Sent: Monday, February 16, 2009 6:55 PM
>   > Subject: [amibroker] Pivot points on first 30 min of trading
>   > 
>   > 
>   > I would like to know if it is possible to calculate pivot points
after
>   > the first half hour of the trading day using the H and L of those
>   > first 30 minutes and plot the lines for the remainder of the day.
>   > 
>   > I have tried to combine existing formulas from the library, but no
>   > good result so far. 
>   > 
>   > If it is possible I'll keep trying. 
>   > 
>   > Sincerely,
>   > 
>   > Bart.
>   >
>




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

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