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

[amibroker] Re: Floor Trader Pivots



PureBytes Links

Trading Reference Links

Hello Edward,

Thank you for your help.

I'm getting Syntax error with The code.Also Variable firsbarofday 
used without having been initialized.

Could you please upload the right one or send it to my yahoo ID. 

Again thank you very much.

Regards,



--- In amibroker@xxxxxxxxxxxxxxx, "Edward Pottasch" <empottasch@xxx> 
wrote:
>
> hi,
> 
> here is code I use. It is written for ES futures trading. It needs 
to use 1-minute intraday charts. It looks at 24 hours continues data 
but to calculate the pivots it uses the price of regular trading 
hours. The regular trading hours (my local time is CET) are displayed 
in the chart as a dark grey background (see inserted chart). You will 
need to adjust:
> 
> starttime = 153000; 
> endtime = 220000; 
> 
> lines like PV = round(PV * 4) / 4; I added because ES trades in 
steps of 0.25 point.
> 
> 
> for your local opening and closing hours. When you load the code 
you will need to go to the parameter window and chose these support 
and resistance levels you want to display.
> 
> If anyone knows a succesful way to use this for trading ..... 
please let me know :)
> 
> rgds, Ed
> 
> 
> 
> 
> 
> 
> 
> 
> freq = 1 * inDaily; 
> 
> starttime = 153000; 
> endtime = 220000; 
> 
> tn = TimeNum(); 
> dn = DateNum(); 
> 
> timecond = tn >= starttime AND tn <= endtime; 
> startday = tn == starttime; 
> 
> 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, freq, compressLast); 
> DL = TimeFrameCompress(myLow, freq, compressLast); 
> DC = TimeFrameCompress(myClose, freq, compressLast); 
> 
> DH = Ref(DH,-1); 
> DL = Ref(DL,-1); 
> DC = Ref(DC,-1); 
> 
> DH = TimeFrameExpand( DH, freq, expandFirst ); 
> DL = TimeFrameExpand( DL, freq, expandFirst ); 
> DC = TimeFrameExpand( DC, freq, expandFirst ); 
> 
> rg = DH - DL; 
> 
> PV = (DH+DL+DC)/3; PV = round(PV * 4) / 4; 
> R1 = PV + (PV - DL);  R1 = round(R1 * 4) / 4; 
> R2 = PV + rg; 
> R3 = R1 + rg; 
> R4 = R2 + rg; 
> 
> S1 = PV - (DH - PV); S1 = round(S1 * 4) / 4; 
> S2 = PV - rg; 
> S3 = S1 - rg; 
> S4 = S2 - rg; 
> 
> Type = ParamList
("Type","Pivot,Pivot/S1/R1,Pivot/S1/S2/R1/R2,Pivot/S1/S2/S3/R1/R2/R3,P
ivot/S1/S2/S3/S4/R1/R2/R3/R4,Yesterdays H/L/C"); 
> 
> if( Type == "Pivot" )  { 
> 
>    SetBarsRequired(10000, 10000); 
> 
>    SetChartOptions(0, chartShowDates); 
>    Plot(C,"C",1,64); 
>    Plot(PV,"PV",colorWhite,styleThick); 
>    Plot( timecond, "", colorDarkGrey, styleArea|styleOwnScale,0,1); 
> 
> } 
> 
> if( Type == "Pivot/S1/R1" )  { 
> 
>    SetBarsRequired(10000, 10000); 
> 
>    SetChartOptions(0, chartShowDates); 
>    Plot(C,"C",1,64); 
>    Plot(PV,"PV",colorWhite,styleThick); 
> 
>    // resistance 
>    Plot(R1,"\nR1",colorRed,styleThick); PlotText( "R1\n", LastValue
(Cum(1)), LastValue(R1), colorRed ); 
> 
>    // support 
>    Plot(S1,"\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",1,64); 
>    Plot(PV,"PV",colorWhite,styleThick); 
> 
>    // resistance 
>    Plot(R1,"\nR1",colorRed,styleThick); PlotText( "R1\n", LastValue
(Cum(1)), LastValue(R1), colorRed ); 
>    Plot(R2,"R2",colorOrange,styleThick); PlotText( "R2\n", LastValue
(Cum(1)), LastValue(R2), colorOrange ); 
> 
>    // support 
>    Plot(S1,"\nS1",colorGreen,styleThick); PlotText( "S1\n", 
LastValue(Cum(1)), LastValue(S1), colorGreen ); 
>    Plot(S2,"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",1,64); 
>    Plot(PV,"PV",colorWhite,styleThick); 
> 
>    // resistance 
>    Plot(R1,"\nR1",colorRed,styleThick); PlotText( "R1\n", LastValue
(Cum(1)), LastValue(R1), colorRed ); 
>    Plot(R2,"R2",colorOrange,styleThick); PlotText( "R2\n", LastValue
(Cum(1)), LastValue(R2), colorOrange ); 
>    Plot(R3,"R3",colorLightOrange,styleThick); PlotText( "R3\n", 
LastValue(Cum(1)), LastValue(R3), colorLightOrange ); 
> 
>    // support 
>    Plot(S1,"\nS1",colorGreen,styleThick); PlotText( "S1\n", 
LastValue(Cum(1)), LastValue(S1), colorGreen ); 
>    Plot(S2,"S2",colorBrightGreen,styleThick); PlotText( "S2\n", 
LastValue(Cum(1)), LastValue(S2), colorBrightGreen ); 
>    Plot(S3,"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",1,64); 
> 
>    Plot(PV,"PV",colorWhite,styleThick); 
> 
>    // resistance 
>    Plot(R1,"\nR1",colorRed,styleThick); PlotText( "R1\n", LastValue
(Cum(1)), LastValue(R1), colorRed ); 
>    Plot(R2,"R2",colorOrange,styleThick); PlotText( "R2\n", LastValue
(Cum(1)), LastValue(R2), colorOrange ); 
>    Plot(R3,"R3",colorLightOrange,styleThick); PlotText( "R3\n", 
LastValue(Cum(1)), LastValue(R3), colorLightOrange ); 
>    Plot(R4,"R4",colorYellow,styleThick); PlotText( "R4\n", LastValue
(Cum(1)), LastValue(R4), colorYellow ); 
> 
>    // support 
>    Plot(S1,"\nS1",colorGreen,styleThick); PlotText( "S1\n", 
LastValue(Cum(1)), LastValue(S1), colorGreen ); 
>    Plot(S2,"S2",colorBrightGreen,styleThick); PlotText( "S2\n", 
LastValue(Cum(1)), LastValue(S2), colorBrightGreen ); 
>    Plot(S3,"S3",colorSeaGreen ,styleThick); PlotText( "S3\n", 
LastValue(Cum(1)), LastValue(S3), colorSeaGreen ); 
>    Plot(S4,"S4",colorPaleGreen ,styleThick); PlotText( "S4\n", 
LastValue(Cum(1)), LastValue(S4), colorPaleGreen ); 
> 
>    Plot( timecond, "", colorDarkGrey, styleArea|styleOwnScale,0,1); 
> 
> } 
> 
> if( Type == "Yesterdays H/L/C" )  { 
> 
>    SetBarsRequired(10000, 10000); 
> 
>    SetChartOptions(0, chartShowDates); 
>    Plot(C,"C",1,64); 
>    Plot(DC,"\nDC",colorLightBlue,styleDashed); PlotText( "Ys C\n", 
LastValue(Cum(1)), LastValue(DC), colorLightBlue ); 
>    Plot(DH,"DH",colorSkyblue,styleDashed);  PlotText( "Ys H\n", 
LastValue(Cum(1)), LastValue(DH), colorSkyblue ); 
>    Plot(DL,"DL",colorTurquoise,styleDashed);  PlotText( "Ys L\n", 
LastValue(Cum(1)), LastValue(DL), colorTurquoise ); 
> 
>    Plot( timecond, "", colorDarkGrey, styleArea|styleOwnScale,0,1); 
> 
> } 
> 
> 
> 
>   ----- Original Message ----- 
>   From: Mohammed 
>   To: amibroker@xxxxxxxxxxxxxxx 
>   Sent: Friday, April 25, 2008 1:28 AM
>   Subject: [amibroker] Floor Trader Pivots
> 
> 
> 
>   Hi All,
> 
>   I'm trying to write the formula for Pivot Point, support and 
resistance as it showing in the following code.
> 
>   /*
> 
>   Pivot Point = [Yesterday's High + Yesterday's Low + Yesterday's 
Close] / 3 
> 
>   Support Levels
> 
>   S1 = [Pivot Point * 2] - Yesterday's High 
> 
>   S2 = Pivot Point - Yesterday's High + Yesterday's Low 
> 
>   S3 = S2 - Yesterday's High + Yesterday's Low 
> 
>   Resistance Levels
> 
>   R1 = [Pivot Point * 2] - Yesterday's Low 
> 
>   R2 = Pivot Point + Yesterday's High - Yesterday's Low 
> 
>   R3 = R2 + Yesterday's High - Yesterday's Low 
> 
>   */
> 
>   Piv = Ref(H,-1) + Ref(L,-1) + Ref(C,-1)/ 3;
>   S1 = Piv*2 - Ref(H,-1);
>   S2 = Piv - Ref(H,-1) + Ref(L,-1);
>   S3 = S2 - Ref(H,-1) + Ref(L,-1);
> 
>   R1 = Piv*2 - Ref(L,-1);
>   R2 = Piv + Ref(H,-1) - Ref(L,-1);
>   R3 = R2 + Ref(H,-1) - Ref(L,-1);
> 
>   Plot(S1,"S1",colorgreen, styleLine);
>   Plot(S2,"S3",colorgreen, styleLine);
>   Plot(S3,"S3",colorgreen, styleLine);
> 
>   Plot(R1,"R1",colorRed, styleLine);
>   Plot(R2,"R2",colorRed, styleLine);
>   Plot(R3,"R3",colorRed, styleLine);
> 
>   BUT this gives me wrong result???
> 
>    Any one can help please Why I got wrong result? 
> 
>   Also I would like to plot it as a horizontal line not as 
indicator.  As it showing here
> 
>   FloorTrader Pivots 
> 
> 
>   All the best.
>



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

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/