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

RE: [amibroker] Re: How to calculate Pivot & S/R from daily session only but on 24-hour chart



PureBytes Links

Trading Reference Links

This is what I have been trying to find, but I want to also find the pivots on the daily, weekly, and monthly along with hourly. 
   
  Unfortunately I don't know how to program, and I don't know how to fix syntax errors. I also don't know how to fix the : Error 29 Variable 'pivotstyle' used without having been initialized. 
   
  Is there someone that would be willing to help?
  SteveKub101161
   
  

"Fred S. Esch" <fesch@xxxxxxxxxx> wrote:
              Dear Rhoemke,
  
  Nice coding!
  
  Thanks for the contribution,
  
  Fred
  
      
---------------------------------
  
  From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of rhoemke
Sent: Thursday, August 03, 2006 3:08 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Re: How to calculate Pivot & S/R from daily session only but on 24-hour chart

  
        Hello svatso,
with another AFL-inbuilt method i use this for pivots:

// *************** Parameters 
GAP = ParamToggle("GAP","GAP|Normal");
Frame = ParamList("Frame","weekly|daily|monthly|yearly");
//levels for the day, the week and the month
Visible = ParamToggle("Visible","NOT Visible|Visible"); //want to
see the levels in the charts? 
pivotstyle = IIf(Visible ==1,
styleStaircase+styleNoRescale+styleDots,styleNoDraw|styleNoLabel|styleNoRescale);

// Pivots

TodayOpen = TimeFrameGetPrice("O",inDaily); 
LastDayHigh = TimeFrameGetPrice("H",inDaily,-1); 
LastDayLow = TimeFrameGetPrice("L",inDaily,-1); 
LastDayClose = TimeFrameGetPrice("C",inDaily,-1); 

ThisHourOpen = TimeFrameGetPrice("O", inHourly);
LastHourHigh = TimeFrameGetPrice("H", inHourly,-1);
LastHourLow = TimeFrameGetPrice("L", inHourly,-1);
LastHourClose = TimeFrameGetPrice("C", inHourly,-1);

ThisWeekOpen = TimeFrameGetPrice("O",inWeekly);
LastWeekHigh = TimeFrameGetPrice("H",inWeekly,-1); 
LastWeekLow = TimeFrameGetPrice("L",inWeekly,-1); 
LastWeekClose = TimeFrameGetPrice("C",inWeekly,-1); 

ThisMonthOpen = TimeFrameGetPrice("O",inMonthly); 
LastMonthHigh = TimeFrameGetPrice("H",inMonthly,-1); 
LastMonthLow = TimeFrameGetPrice("L",inMonthly,-1); 
LastMonthClose = TimeFrameGetPrice("C",inMonthly,-1); 

ThisYearOpen = TimeFrameGetPrice("O",inMonthly*12); 
LastYearHigh = TimeFrameGetPrice("H",inMonthly*12,-1); 
LastYearLow = TimeFrameGetPrice("L",inMonthly*12,-1); 
LastYearClose = TimeFrameGetPrice("C",inMonthly*12,-1); 

dHigh = IIf(Frame=="daily",LastDayHigh, IIf(Frame == "hourly",
LastHourHigh, IIf(Frame == "weekly", LastWeekHigh, IIf(Frame ==
"monthly", LastMonthHigh, LastYearHigh)))); 
dLow = IIf(Frame=="daily",LastDayLow, IIf(Frame == "hourly",
LastHourLow, IIf(Frame == "weekly", LastWeekLow, IIf(Frame ==
"monthly", LastMonthLow, LastYearLow)))); 
dClose = IIf(Frame=="daily",LastDayClose,IIf(Frame == "hourly",
LastHourClose, IIf(Frame == "weekly", LastWeekClose, IIf(Frame ==
"monthly", LastMonthClose, LastYearClose)))); 
dOpen = IIf(Frame=="daily",TodayOpen, IIf(Frame == "hourly",
ThisHourOpen, IIf(Frame == "weekly", ThisWeekOpen, IIf(Frame ==
"monthly", ThisMonthOpen, ThisYearOpen)))); 

PP = IIf(GAP==0,(dHigh+dLow+dClose+dOpen)/4,
IIf(GAP==1,(dHigh+dLow+dClose)/3,(dHigh+dLow+dOpen)/3)); 


// --------------- Pivotlevels ---------------------------
PR1=2*PP-dLow; 
PS1=2*PP-dHigh; 
PR2=(1*PP-PS1)+PR1; 
PS2=1*PP-(PR1-PS1); 
PR3=2*(PP-dLow)+dHigh; 
PS3=dLow-2*(dHigh-PP); 
PR4=PP+(2*dHigh-2*dLow); 
PS4=PP-(2*dHigh-2*dLow); 
PR5=2*PP+(2*dHigh-3*dLow); 
PS5=2*PP+(3*dHigh-2*dLow); 

Plot(PP, "PP",colorRed, pivotstyle);
Plot(PR1, "", colorBlack, pivotstyle); 
Plot(PR2, "", colorBlack, pivotstyle); 
Plot(PR3, "", colorBlack, pivotstyle); 
Plot(PR4, "", colorBlack, pivotstyle); 
Plot(PR5, "", colorBlack, pivotstyle); 
Plot(PS1, "", colorBlack, pivotstyle); 
Plot(PS2, "", colorBlack, pivotstyle); 
Plot(PS3, "", colorBlack, pivotstyle); 
Plot(PS4, "", colorBlack, pivotstyle); 

--- In amibroker@xxxxxxxxxxxxxxx, "jppt0k" <jppt0k@xxx> wrote:
>
> svatso, take a look a deDateTime.dll plugin. It let you access
values that refer to specific times of the day. I think it may solve
your problem. 
> http://www.amibroker.org/3rdparty/deDateTime.zip
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "svatso" <svatopluk.solc@> wrote:
> >
> > I can calculate daily Pivot & S/R from previous day with 
> > TimeframeSet(inDaily ) and then expand and plot on intraday chart. 
> > When using 24-hour intraday chart that inDaily compression applies to
> > 24-hour day, of course.
> > 
> > But I'd like to use 24-hour chart and at the same time calculate and
> > plot Pivot & S/R from previous daily session only ( 9:30 A.M. - 4:00
> > P.M. ).
> > 
> > Can anybody help me .
> > 
> > Thanks. 
> > 
> > svatso
> >
>

  



  

         




 		
---------------------------------
Do you Yahoo!?
 Next-gen email? Have it all with the  all-new Yahoo! Mail Beta.