PureBytes Links
Trading Reference Links
|
If that is what you want to do then I think that the following is the easy way to do that:
Periods = BarsSince(NewDay);
YourIndicator = CCI(Periods);
OR maybe something along these lines will work:
Newday = TimeNum() >= 093000;//assumes market normal trading hours starts at 0930.
Periods = BarsSince(NewDay);
YourIndicator = CCI(Periods);
This is for RT charts ... you might have to make it a condition that the first two bars have been built, in RT, because deviation from the mean, for one bar, will be zero which might crash the maths at the start of the (intra) day.
Compression only comes into it if you want to see the intraday CCI build in daily view.
Here is a link with a reasonable explanation of CCI and an Excel example for anyone who is interested.
http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:commodity_channel_index_cci
--- In amibroker@xxxxxxxxxxxxxxx, "brian_z111" <brian_z111@xxx> wrote:
>
> I am finding it difficult to respond because your logic doesn't match what you are trying to do (unless I am misunderstanding what it is that you are aiming for).
>
> > basically, i cam trying to get the Daily CCI value as it evolves >during the intraday chart.
>
> To achieve this:
>
> 1) (use the code as suggested by Rajiv, or similar)
>
>
> newday= day()!=ref(day(),-1);
> highestoftheday=highestsince(newday,H,1);
>
> 2) do the same for the low
> 3) Calculate the progressive intraday typical value
>
> Typical = (highestoftheday + lowestoftheday + close)/3;//use the current close
>
> 4) manually calculate CCI using the steps outlined in the AB helpmanual/indicators/CCI notes -
>
> - calculate MA(typical)
> - calculate deviation from mean typical value
> - * 0.15
> - divide relevant steps above
>
> Bingo!
>
> If your RT data contains out of hour trades you might need to add a caveat to exclude bars with after hours timestamps.
>
> Is that what you want to do?
>
> If you are trying to do something else I am sorry but I can't understand what it is from your statements.
>
>
>
> --- In amibroker@xxxxxxxxxxxxxxx, "murthysuresh" <money@> wrote:
> >
> > I am in desperate need of some help here. i dont want to think that it is impossible.
> >
> > basically, i cam trying to get the Daily CCI value as it evolves during the intraday chart.
> >
> > my attempt is below.
> >
> > So i came up with the idea that i can build the daily cci values using run time
> > values from intraday. i can build it using
> > CCIa formula
> >
> > TimeFrameSet( inDaily ); // switch to 5 minute frame
> > Typical=(C+H+L)/3;
> >
> > TimeFrameRestore();
> >
> > realtimecci=CCIa( Typical, 14 );
> > here i did not expand the Typical to 5 minute bars and so the array has the
> > daily bars values.
> >
> > As long as i can update the last bar with the intraday =(C+H+L)/3 i will keep
> > getting realtime CCI daily values as the bar progresses for backtesting.
> >
> > Hope this explains why i am looking for the HLC values as a number as i need to
> > use it as a number
> >
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "murthysuresh" <money@> wrote:
> > >
> > > In the case you have shown, the valuewhen returns an array. i want the actual low value as a number.
> > >
> > > The background behind this is that i am trying to plot the daily CCI value as the bar progresses during the day while backtesting. For a true backtesting of the strategy, i need to know the values of the indicators as the bar progresses over time. there is not way that i can get it automaticlaly with ab.
> > >
> > > Accoring to AB support
> > > If you want to calculate "what daily CCI would be on each of the intraday bars" - then you can't use TimeFrame functions for that, as they return EOD values of the OHLC arrays (of course daily Open is known since the start of the day). So you would need to calculate such indiators in some form of a FOR loop (or perhaps 2 nested loops). Unfortunatelly I don't have any ready-to-use example of such code I could share and writing such fomrula on demand from scratch exceeds the range of free support we are able to offer (see: http://www.amibroker.com/freesupport.html).
> > >
> > >
> > >
> > > after breaking my head over it for more than weeks, here is my almost completed code except for a small bit.
> > >
> > > use CCIa to do the cci formula and pass in a array with daily prices. so i get the daily price from timeframeset and do not expand it so that i will have the daily price arrays.
> > > my idea is to change the last value of the daily array with the current HLC values from daily bar.
> > >
> > > So i came up with the idea that i can build the daily cci values using run time values from intraday. i can build it using
> > > CCIa formula
> > >
> > > TimeFrameSet( inDaily ); // switch to 5 minute frame
> > > Typical=(C+H+L)/3;
> > >
> > > TimeFrameRestore();
> > >
> > > realtimecci=CCIa( Typical, 14 );
> > > here i did not expand the Typical to 5 minute bars and so the array has the daily bars values.
> > >
> > > As long as i can update the last bar with the intraday =(C+H+L)/3 i will keep getting realtime CCI daily values as the bar progresses for backtesting.
> > >
> > > Hope this explains why i am looking for the HLC values as a number as i need to use it as a number
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > --- In amibroker@xxxxxxxxxxxxxxx, "brian_z111" <brian_z111@> wrote:
> > > >
> > > > Hi Seede,
> > > >
> > > > Does this help.
> > > >
> > > > (I think you can substitute the High or Low, or any required bar specific value, for TimeNum())
> > > >
> > > > //AA Settings should be on an intraday timeframe e.g. 5 min
> > > > //Run the scan then use X_ATC_IntradayHLL to report on the data
> > > > //and export it to a spreadsheet for graphing
> > > >
> > > > Buy = Sell = 0;
> > > >
> > > > Sym = Name();
> > > >
> > > > DL = TimeFrameGetPrice( "L",inDaily,0);
> > > > BSL = BarsSince(L == DL);
> > > > ILT = ValueWhen(BSL == 0, TimeNum()/10000,1);
> > > >
> > > > I uded it at the Zboard and the full code is downloadable via file links there.
> > > >
> > > > http://zboard.wordpress.com/2009/03/02/342/
> > > >
> > > > --- In amibroker@xxxxxxxxxxxxxxx, "murthysuresh" <money@> wrote:
> > > > >
> > > > > An additional question. the highestoftheday returns a array. i want to get the specific value of the highestoftheday. i tried lastvalue but it was returning the values incorectly.
> > > > > appreciate any additional help.
> > > > > Seede
> > > > >
> > > > > --- In amibroker@xxxxxxxxxxxxxxx, "murthysuresh" <money@> wrote:
> > > > > >
> > > > > > thanks a lot. u are a genius.
> > > > > > --- In amibroker@xxxxxxxxxxxxxxx, Rajiv Arya <rajivarya87@> wrote:
> > > > > > >
> > > > > > >
> > > > > > > newday= day()!=ref(day(),-1);
> > > > > > >
> > > > > > > highestoftheday=highestsince(newday,H,1);
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > Rajiv
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > To: amibroker@xxxxxxxxxxxxxxx
> > > > > > > From: money@
> > > > > > > Date: Thu, 21 May 2009 12:48:34 +0000
> > > > > > > Subject: [amibroker] Re: find today's dailybar high and low from intraday bar
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > As per the docs below , it will give the last bar of the range in the AA window. I am looking for the highest high of the day from the intraday bars as the bar progreses.
> > > > > > >
> > > > > > > http://www.amibroker.com/guide/afl/afl_view.php?name=SELECTEDVALUE
> > > > > > >
> > > > > > > --- In amibroker@xxxxxxxxxxxxxxx, "jorgen_wallgren" <jorgen.wallgren@> wrote:
> > > > > > > >
> > > > > > > > I am relatively new at this, but shouldn't this give you what you want:
> > > > > > > >
> > > > > > > > H0 = SelectedValue(TimeFrameGetPrice("H", inDaily, 0));
> > > > > > > > L0 = SelectedValue(TimeFrameGetPrice("L", inDaily, 0));
> > > > > > > >
> > > > > > > > Regards,
> > > > > > > >
> > > > > > > > Jorgen
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > _________________________________________________________________
> > > > > > > Insert movie times and more without leaving Hotmail®.
> > > > > > > http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd1_052009
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
------------------------------------
**** 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/
|