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

[amibroker] Re: In April of 2004 there was a "Q indicator" and "B indicator" published



PureBytes Links

Trading Reference Links


Works now, thanks again for your help

Mark

--- In amibroker@xxxxxxxxxxxxxxx, Natasha !! <dynomitedoll_ddd@xxxx>
wrote:
> 
> 
> 
> Hi Mark,
> 
> ___________________________________________________________________
> mleonsprint <mleonsprint@xxxx> wrote:
> 
> 
> Sorry I couldn't reply sooner my "box" just has got back from the 
> shop and the backup is still in..ugh...
> 
> Thanks for your help Natasha, I added it to AB and kept getting 
> sintax errors, I would debug it except I don't understand it.. 
> 
> It is first saying "Sincebar" used without being initialized.... hmmm 
> any thoughts?
> 
> 
> Thanks again for your help
> Mark
> ____________________________________________________________
> 
> Try the codes below cut and paste as is from line to line .I don't
see why you should have a problem.I don't.
> 
> Trend Quality noise balance:
> 
> ____________________________________________________________
> 
> /*AMIBROKER: TREND-QUALITY INDICATOR  BALANCE
> 
> In "Trend-Quality Indicator" in this issue, David Sepiashvili
presents an innovative trend-detection tool -- the trend-quality
indicator -- that attempts to estimate the trend in relation to noise. 
> 
> Calculations presented in the article can be easily reproduced using
AmiBroker Formula Language. The only tricky part is a piecewise
exponential moving average that restarts the calculations on every
moving average crossover, but we managed to implement it in two lines
of code, thanks to AmiBroker's powerful Ama2 function, which allows
easy implementation of all kinds of single-order infinite impulse
response filters. 
> 
> Listing 1 shows ready-to-use indicator code to plot the Q-indicator.
In AmiBroker, select Indicator Builder from the Analysis menu, click
the "Add" button, enter the formula, and then press "Apply." Figure 3
shows a sample chart. 
> 
> reproduces the chart presented in Sepiashvili's article.
> 
> LISTING 1
> 
> */
> 
> // Piecewise EMA is an EMA function that restarts calculations each time
> 
> // the 'sincebar' argument is true
> 
> function PiecewiseEMA( array, range, sincebar )
> 
> {
> 
> factor = IIf( sincebar, 1, 2/(range+1) );
> 
> return AMA2( array, factor, 1-factor );
> 
> //ama2( ARRAY, SMOOTHINGFACTOR, FEEDBACKFACTOR ) 
> 
> }
> 
> // parameters
> 
> smoothing=Param("smooth",4,0,100,1);
> 
> //m=4;
> 
> n=250;
> 
> // generate reversal signals based on EMA crossover rule
> 
> Lpf1 = EMA( C, 7 );
> 
> Lpf2 = EMA( C, 15 );
> 
> CrossPoint = Cross( Lpf1, Lpf2 ) OR Cross( Lpf2, Lpf1 );
> 
> Periods = BarsSince( CrossPoint );
> 
> // variable bar sum
> 
> DC = Close - Ref( Close, -1 );
> 
> CPC = Sum( DC, Periods );
> 
> // smooth CPC by piecewise 4 bar EMA
> 
> Trend = PiecewiseEMA( CPC, smoothing , CrossPoint );
> 
> // noise
> 
> DT = CPC - Trend;
> 
> Noise = 2 * sqrt( MA( DT^2, n ) );
> 
> // alternative 'linear' noise calculation
> 
> // Noise = 2 * MA( abs( DT ), n ) );
> 
> BIndicator = (abs(Trend)/(abs (Noise)+abs(Trend))) * 100;
> 
> Plot( Bindicator, "Bindicator", colorDarkGreen, 1);
> 
> PlotGrid( 0 );
> 
> PlotGrid( 20 );
> 
> PlotGrid( 40 );
> 
> PlotGrid( 60 );
> 
> PlotGrid( 80);
> 
> PlotGrid(100);
> 
> //--Tomasz Janeczko, AmiBroker.com 
> 
> GraphXSpace = 8;
> 
> _____________________________________________________________________
> 
> Trend Quality Indicator:
> 
> ______________________________________________________________________
> 
> /*AMIBROKER: TREND-QUALITY INDICATOR 
> 
> In "Trend-Quality Indicator" in this issue, David Sepiashvili
presents an innovative trend-detection tool -- the trend-quality
indicator -- that attempts to estimate the trend in relation to noise. 
> 
> Calculations presented in the article can be easily reproduced using
AmiBroker Formula Language. The only tricky part is a piecewise
exponential moving average that restarts the calculations on every
moving average crossover, but we managed to implement it in two lines
of code, thanks to AmiBroker's powerful Ama2 function, which allows
easy implementation of all kinds of single-order infinite impulse
response filters. 
> 
> Listing 1 shows ready-to-use indicator code to plot the Q-indicator.
In AmiBroker, select Indicator Builder from the Analysis menu, click
the "Add" button, enter the formula, and then press "Apply." Figure 3
shows a sample chart. 
> 
> reproduces the chart presented in Sepiashvili's article.
> 
> LISTING 1
> 
> */
> 
> // Piecewise EMA is an EMA function that restarts calculations each time
> 
> // the 'sincebar' argument is true
> 
> function PiecewiseEMA( array, range, sincebar )
> 
> {
> 
> factor = IIf( sincebar, 1, 2/(range+1) );
> 
> return AMA2( array, factor, 1-factor );
> 
> //ama2( ARRAY, SMOOTHINGFACTOR, FEEDBACKFACTOR ) 
> 
> }
> 
> // parameters
> 
> smoothing=Param("smooth",4,0,100,1);
> 
> //m=4;
> 
> n=250;
> 
> // generate reversal signals based on EMA crossover rule
> 
> Lpf1 = EMA( C, 7 );
> 
> Lpf2 = EMA( C, 15 );
> 
> CrossPoint = Cross( Lpf1, Lpf2 ) OR Cross( Lpf2, Lpf1 );
> 
> Periods = BarsSince( CrossPoint );
> 
> // variable bar sum
> 
> DC = Close - Ref( Close, -1 );
> 
> CPC = Sum( DC, Periods );
> 
> // smooth CPC by piecewise 4 bar EMA
> 
> Trend = PiecewiseEMA( CPC, smoothing , CrossPoint );
> 
> // noise
> 
> DT = CPC - Trend;
> 
> Noise = 2 * sqrt( MA( DT^2, n ) );
> 
> // alternative 'linear' noise calculation
> 
> // Noise = 2 * MA( abs( DT ), n ) );
> 
> QIndicator = Trend/Noise;
> 
> sign = IIf(Lpf1>Lpf2,1,-1);
> 
> Plot(sign/*(Lpf1-Lpf2)*/, "Rev", colorRed );
> 
> Plot( Qindicator, "Qindicator", colorBrightGreen, styleHistogram);
> 
> PlotGrid( -1 );
> 
> PlotGrid( 1 );
> 
> PlotGrid( 2 );
> 
> PlotGrid( -2 );
> 
> PlotGrid( 5 );
> 
> PlotGrid(-5);
> 
> //--Tomasz Janeczko, AmiBroker.com 
> 
> GraphXSpace = 8;
> 
> ______________________________________________________________________
> 
> Theory: This is for Q-indicator;
> 
> First you have to create a trading cycle; done by creating a moving
average crossover;
> 
> You can replace this crosspoint by another cycle creation method
instead of Ema.
> 
> Moment crosspoint is done then the calculations start.
> 
> You have CPC (cumulative price change)which you can chart as a
separate indicator.It calculates amount price has changed from a fixed
starting point viz the crosspoint.
> 
> Trend within the semicycle is found by the function piecewiseEma and
is in reality the moving average of the CPC.
> 
> Both TREND and CPC can be used separately as stand alone indicators
or also components of other analysis.
> 
> Qindicator is  (Trend/Noise )*c where c is appropriate correction
factor.and noise is calculated as moving average of the root mean
square of difference between CPC and Trend 
> 
> Note: Q indicator is used to measure trend activity and is used as a
centered oscillator.
> 
> benchmarks for trend:(-1 to +1)-trend buried beneath noise:(+1 to
+2)or (-1 to -2)-weak trend;Q>2 then promising trend and above 2 to 5
moderate trend <5 strong trend.
> 
> You have to experiment and see.
> 
> b-indicator is banded oscillator between 0 and 100 and doesnt give
the direction of trend but shows better existance of trend and
strength of the trend. 50-65 weak trending , 65-80 moderate trending
and 80 + strong trending.
> 
> For more info on the above indics.you may visit www.alticom.com.
> 
> These indicators and other numerous similiar indicators are
available free for usage.
> 
> Have fun,
> 
>  
> 
> 
> 
> Warm regards, 
> Natasha !
>  
> 
> 
> 
> 		
> ---------------------------------
> Do you Yahoo!?
>  Yahoo! Search presents - Jib Jab's 'Second Term'





------------------------ Yahoo! Groups Sponsor --------------------~--> 
What would our lives be like without music, dance, and theater?
Donate or volunteer in the arts today at Network for Good!
http://us.click.yahoo.com/Tcy2bD/SOnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

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