[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


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

--- In amibroker@xxxxxxxxxxxxxxx, Natasha !! <dynomitedoll_ddd@xxxx> 
wrote:
> 
**********************************************************************
*********************************
> 
> mleonsprint <mleonsprint@xxxx> wrote: 
> 
> Does anyone have the code for the "B indicator"? I saw the code for
> the "Q indicator" but I didn't see the "B indicator", was hoping 
maybe
> someone has coded it up?
> 
> Thanks for your help
> Mark
> 
> *****************************************************************
> Hi ,
> 
> 
> 
> /*AMIBROKER: TREND-QUALITY-BALANCE 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 truefunction PiecewiseEMA( array, 
range, sincebar ){  factor = IIf( sincebar, 1, 2/(range+1) );  return 
AMA2( array, factor, 1-factor );//ama2( ARRAY, SMOOTHINGFACTOR, 
FEEDBACKFACTOR ) }// parameterssmoothing=Param
("smooth",4,0,100,1);//m=4;n=250;// generate reversal signals based 
on EMA crossover ruleLpf1 = EMA( C, 7  );Lpf2 = EMA( C, 
15 );CrossPoint = Cross( Lpf1, Lpf2 ) OR Cross( Lpf2, Lpf1 );Periods 
= BarsSince( CrossPoint );// variable bar sumDC = Close - Ref( 
Close, -1 );CPC = Sum( DC, Periods );// smooth CPC by piecewise 4 bar 
EMATrend = PiecewiseEMA( CPC, smoothing , CrossPoint );// noiseDT = 
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 = 3;
> 
> ****************************************
> 
> The above is trend Noise balance:
> 
> *****************************************
> 
>  The below is trend Quality:
> *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. 
> *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 truefunction PiecewiseEMA( array, 
range, sincebar ){  factor = IIf( sincebar, 1, 2/(range+1) );  return 
AMA2( array, factor, 1-factor );//ama2( ARRAY, SMOOTHINGFACTOR, 
FEEDBACKFACTOR ) }// parameterssmoothing=Param
("smooth",4,0,100,1);//m=4;n=250;// generate reversal signals based 
on EMA crossover ruleLpf1 = EMA( C, 7  );Lpf2 = EMA( C, 
15 );CrossPoint = Cross( Lpf1, Lpf2 ) OR Cross( Lpf2, Lpf1 );Periods 
= BarsSince( CrossPoint );// variable bar sumDC = Close - Ref( 
Close, -1 );CPC = Sum( DC, Periods );// smooth CPC by piecewise 4 bar 
EMATrend = PiecewiseEMA( CPC, smoothing , CrossPoint );// noiseDT = 
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 = 5;
> 
>  
> 
> Have fun ,
> 
> 
> 
> 
> 
> 
> Warm regards, 
> Natasha !
>  
> 
> 
> 
> 		
> ---------------------------------
> Do you Yahoo!?
>  Yahoo! Search presents - Jib Jab's 'Second Term'





------------------------ Yahoo! Groups Sponsor --------------------~--> 
In low income neighborhoods, 84% do not own computers.
At Network for Good, help bridge the Digital Divide!
http://us.click.yahoo.com/EpW3eD/3MnJAA/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/