19 May 2011

Volatility channels

Volatility channels (or bands) move with the stock, quickly adjusting to
price movements. When a security trends outside the volatility channel, it
adds strength to a high probability long trade . Look out for a stock to
“trend” outside these bands to catch the momentum. When the swing
increases, the bands respond by opening up. The Lower channel normally
points to a key fibonacci support zone.

Right Click select Param “parameters” and select variable you need.


// Enable radio button "middle" for grid lines.


MaxGraph = 4;
Vc= Param("Volatility channel -",10,2,14);
Up=HHV(((((H+L+C)/3)*2)- H),Vc);
Lo=LLV(((((H+L+C)/3)*2)- L),Vc);
Graph0=C;
Graph0Style=128+4;
Graph0BarColor = IIf( Close > Ref( Close, -1 ), colorDarkGreen, colorDarkRed );
Graph0Style = styleBar;
Graph0 = Close;
Graph1=Up;
Graph1Style=styleLine;
Graph1Color=colorBlue;
Graph2=Lo;
Graph2Style=styleLine;
Graph2Color=colorBlue;
Title=Name() + " Volatiltiy Channels - LC" + WriteVal( Graph2 )+ ", UC" + WriteVal( Graph1 )+
", Close" + WriteVal( Graph0 );

05 May 2011

better Volume indicator for Amibroker afl code

Hi friends,
Hi afl coding experts
please make anb afl for amibroker from using trade station code given below
please get a improved indicator for our stocks


Most Traders Ignore Volume – Big Mistake!

Bottom
Start Up Trend

Up Trend Continue
Top
Start Down Trend

Down Trend Continue

Indicator Color

Volume Climax Up Yes Yes Yes Red
Volume Climax Down Yes Yes Yes White
High Volume Churn Yes Yes Green/Blue
Hi Vol Churn + Climax Yes Yes Magenta
Low Volume Yes Yes Yes Yes Yellow

Better Volume Indicator: Summary
Volume has to be the most underrated market variable used in technical analysis. But if you know how to analyze and interpret it, you'll be able to see market turning points develop and anticipate pullbacks and trend changes.
You can figure out whether the Professionals are buying or selling by analyzing:
Volume transacted at the bid or the ask
High to low range of the bar, and
Average trade size.
The Better Volume indicator improves on your typical volume histogram by coloring the bars based on 5 criteria:
Volume Climax Up – high volume, high range, up bars (red)
Volume Climax Down – high volume, high range, down bars (white)
High Volume Churn – high volume, low range bars (green, PaintBar blue)
Volume Climax plus High Volume Churn – both the above conditions (magenta)
Low Volume – low volume bars (yellow)
When there are no volume signals the default histogram bar coloring is cyan
The Better Volume indicator also comes in a PaintBar version, so you can see the coloring on the price bars themselves. The table above is a quick reference guide that shows what volume indicator signals to watch for at different stages of the market.
Remember, this method of identifying market turning points using volume is even more powerful when combined with other non-correlated indicators. In my trading I use the Hilbert Sine Wave to identify cyclical turning points and take the trade when confirmed with the Better Volume indicator signals.

Better Volume Indicator: Volume Climax Up

Better Volume Indicator: Volume Climax Up (Emini 5 min)
Volume Climax Up bars are identified by multiplying buying volume (transacted at the ask) with range and then looking for the highest value in the last 20 bars (default setting). Volume Climax Up bars indicate large volume demand that results in bidding up prices. The default setting is to color the bars red.
Volume Climax Up bars are typically seen at:
The start of up trends
The end of up trends, and
Pullbacks during down trends.
The beginning of an up trend is almost always marked by a Volume Climax Up bar. This shows that the buyers are anxious to get on board and large volume enters the market and bids up prices quickly. A valid breakout should be followed by more buying but occasionally the low of the Volume Climax Up bar is tested.
Market tops are also characterized by Volume Climax Up bars often with High Volume Churn and/or Low Volume test patterns. Changes in trend usually take a while to develop, so don't be suckered in too soon – wait for the market to become exhausted. A useful signal to watch for is the Low Volume bar – this shows that finally there is no demand and the market is likely to stop advancing.
During a down trend, pullbacks are often characterized by Volume Climax Up bars. These show short covering or traders calling a bottom too quickly. As soon as this Climax volume declines the down trend is likely to resume. Continuation of the down trend is confirmed when the low of the Volume Climax Up bar is taken out.

Better Volume Indicator: Volume Climax Down

Better Volume Indicator: Volume Climax Down (Emini 5 min)
Volume Climax Down bars are essentially the inverse of Volume Climax Up bars.
Volume Climax Down bars are identified by multiplying selling volume (transacted at the bid) with range and then looking for the highest value in the last 20 bars (default setting). Volume Climax Down bars indicate large volume supply that results in pushing down prices. The default setting is to color the bars white.
Volume Climax Down bars are typically seen at:
The start of down trends
The end of down trends, and
Pullbacks during up trends.
The beginning of a down trend is almost always marked by a Volume Climax Down bar. This shows that the sellers are anxious to get on board and large volume enters the market and pushes down prices quickly. A valid breakdown should be followed by more selling but occasionally the high of the Volume Climax Down bar is tested.
Market bottoms are also characterized by Volume Climax Down bars often with High Volume Churn and/or Low Volume test patterns. Changes in trend usually take a while to develop, so don't be suckered in too soon – wait for the market to become exhausted. A useful signal to watch for is the Low Volume bar – this shows that finally there is no supply and the market is likely to stop declining.
During an up trend, pullbacks are often characterized by Volume Climax Down bars. These show profit taking or traders calling a top too quickly. As soon as this Climax volume declines the up trend is likely to resume. Continuation of the up trend is confirmed when the high of the Volume Climax Down bar is taken out.

Better Volume Indicator: High Volume Churn

Better Volume Indicator: High Volume Churn (Emini 5 min)
High Volume Churn bars are identified by dividing volume by the bar's high to low range and then looking for the highest value in the last 20 bars (default setting). High Volume Churn bars indicate profit taking, new supply entering the market at tops or new demand entering the market at bottoms. The default setting is to color the volume histogram bars green and the price PaintBars blue.
High Volume Churn bars are typically seen at:
The end of up trends
The end of down trends, and
Profit taking mid-trend.
When Volume Churn is high it indicates demand is being met by new supply at tops or supply is being met by new demand at bottoms – in effect, price is not able to advance as new supply or demand enters the market. Hence the bar's high to low range is low.
Maybe one of my customers (Neil F.) says it better than I can:
“I like to think of the High Volume Churn bars as 'brakes'. It's like hitting the brakes – usually, the car will stop shortly thereafter (1-2 points), and then turn around. At other times, however, the momentum is so great that all you get is a pause and then the market just continues going in the same direction! Unfortunately, sometimes it is hard to tell which outcome will occur. Then you just need common sense.”
Occasionally Volume Climax (up or down) and High Volume Churn bars coincide and these bars are colored magenta.
A word of caution with intra-day charts. High Volume Churn often appears on the last bars of the trading day. This does not necessarily represent a possible turning point, but is more likely just to be high volume from day traders closing out positions.

Better Volume Indicator: Low Volume

Better Volume Indicator: Low Volume (Emini 5 min)
Low Volume bars are identified by looking for the lowest volume in the last 20 bars (default setting). Low Volume bars indicate a lack of demand at tops or a lack of supply at bottoms. The default setting is to color the bars yellow.
Low Volume bars are typically seen at:
The end of up trends
The end of down trends, and
Pullbacks mid-trend.
Low Volume bars are my favourite volume indicator signal. They show what the amateurs are doing on tick charts. They are also very useful confirming indicators of a change in trend direction when the market is testing a top or bottom.

Better Volume Indicator: TradeStation EasyLanguage Code
Inputs: LowVol(True), ClimaxUp(True), ClimaxDown(True), Churn(True) …
Variables: BarColor(Cyan);


BarColor = Color;

If BarType > 1 or UseUpTicks = False then begin
If C > O and Range 0 then Value1 = (Range/
(2*Range+O-C))*UpTicks;
If C < O and Range 0 then Value1 = ((Range+C-O)/ (2*Range+C-O))*UpTicks; If C = O then Value1 = 0.5*UpTicks; Value2 = UpTicks-Value1; End; If BarType Share here's the code. SetChartBkColor( ParamColor("BK COLOR",colorBlack)); Color=(colorGrey50); //=(colorAqua)== BarColor(Cyan) LowColor=(colorYellow); ClimaxColor=(colorRed); ChurnColor=(colorGreen); ClimaxChurnColor=(colorCustom12); LowChurnColor=(colorWhite); //AvgColor(Red); //Variables: BarColor(Cyan); BarColor = Color; range=H-L; Value1 = V; Value2 = V*Range; Value3 = IIf(range < Ref(range, -1) OR range > Ref(range, -1), V, IIf(range == Ref(range, -1), V /Range , 0));
//if Range <> 0 then Value3 = V/Range;
Value4 = MA(Value1,30);

Color12=
IIf (Value1 == LLV(Value1,20), LowColor,
IIf (Value2 == HHV(Value2,20), ClimaxColor,
IIf (Value3 == HHV(Value3,20), ChurnColor,
IIf (Value2 == HHV(Value2,20) AND Value3 == HHV(Value3,20), ClimaxChurnColor,
IIf (Value3 == LLV(Value3,20) ,LowChurnColor,Color)))));

Plot(Value1,"Volume",Color12,2+4);
Plot(Value4,"Avg",colorYellow);

04 May 2011

AMIBROKER: SHORT-TERM VOLUME AND PRICE OSCILLATOR

In "Short Term Volume And Price Oscillator," Sylvain Vervoort presents a new indicator that is said to generate short-term entry and exit signals based on a combination of price and volume action.

The AmiBroker formula language (AFL) implementation of the SVAPO indicator is straightforward. In addition to code based on the formula presented in Vervoort's article, we have included code that draws buy and sell arrows automatically based on change in direction of SVAPO (Figure 4). As a criterion for gauging change in direction, we have chosen the situation where SVAPO moves in one direction for at least four consecutive bars and then moves in the opposite direction in the last bar. It is worth noting that some of the signals generated that way are premature. Additional checks may be added, but this will result in delaying the signal.


// input parameters
Period = Param("SVAPO period", 8, 2, 20, 1 );
CutOff = Param("Min. % price change", 1, 0, 10, 0.1 );
devH = Param("Std. Dev High", 1.5, 0.1, 5, 0.1 );
devL = Param("Std. Dev Low", 1.3, 0.1, 5, 0.1 );
StDevPer = Param("Std. Dev. Period", 100, 1, 200, 1 );
// heikin-ashi smoothing
Av4 = (O+H+L+C)/4;
HaOpen = AMA( Ref( Av4, -1 ), 0.5 );
HaCl = ( Av4 + HaOpen + Max( Av4, Max( H, HaOpen ) ) + Min( Av4, Min( L, HaOpen ) ) ) / 4;
HaC = TEMA( HaCl, period/1.6 );
// medium term MA of volume to limit extremes
Vave = Ref( MA( V, period * 5 ), -1 );
Vmax = Vave * 2;
Vc = Min( V, Vmax );
// basic volume trend
Vtr = TEMA( LinRegSlope( V, period ), period );
HaCLimitUp = Ref( HaC, -1 ) * (1 + Cutoff/1000);
HaCLimitDn = Ref( HaC, -1 ) * (1 - Cutoff/1000);
// SVAPO result of price and volume
SVAPOSum = Sum( IIf( ( HaC > HaCLimitUp ) AND Hold( Vtr >= Ref( Vtr,-1 ), 2 ), Vc,
IIf( ( HaC < HaCLimitDn ) AND Hold( Vtr > Ref( Vtr, -1 ), 2 ), -Vc, 0 ) ),period );
SVAPO = TEMA( SVAPOSum / (Vave+1), period );
PlotGrid( 0 );
Plot( SVAPO, "SVAPO", colorBlue, styleThick );
Plot( devH * StDev( SVAPO, StDevPer ), "Up", colorGreen );
Plot( -devL * StDev( SVAPO, StDevPer ), "Dn", colorRed );
Chg = SVAPO - Ref( SVAPO, -1 );
BuySig = Chg > 0 AND Sum( Chg < 0, 5 ) == 4; SellSig = Chg < 0 AND Sum( Chg > 0, 5 ) == 4;
PlotShapes( shapeUpArrow * BuySig, colorGreen );
PlotShapes( shapeDownArrow * SellSig, colorRed );

sylvian vervroot svapo trail stop and zerolag

AMIBROKER, TRADING DIVERGENCES. Here is a sample AmiBroker chart demonstrating the RSI(14) overlay (lower pane) and five-day SVAPO

LISTING 1: Zero-lag moving average

function ZeroLagMA( data, periods )
{
EMA1 = EMA( data, periods );
EMA2 = EMA( EMA1, periods );
Diff = EMA1 - EMA2;
return EMA1 + Diff;
}

Periods = Param("Periods", 20, 2, 100 );

Plot( ZeroLagMA( Close, Periods ), "ZeroLagMA-"+Periods, colorRed );

LISTING 2: SVAPO price-only

// input parameters
Period = Param("SVAPO period", 8, 2, 20, 1 );
CutOff = Param("Min. % price change", 1, 0, 10, 0.1 );
devH = Param("Std. Dev High", 1.5, 0.1, 5, 0.1 );
devL = Param("Std. Dev Low", 1.3, 0.1, 5, 0.1 );
StDevPer = Param("Std. Dev. Period", 100, 1, 200, 1 );

// heikin-ashi smoothing
Av4 = (O+H+L+C)/4;
HaOpen = AMA( Ref( Av4, -1 ), 0.5 );
HaCl = ( Av4 + HaOpen + Max( Av4, Max( H, HaOpen ) ) + Min( Av4, Min( L, HaOpen ) ) ) / 4;

HaC = TEMA( HaCl, period/1.6 );

// medium term MA of volume to limit extremes
Vave = Ref( MA( C, period * 5 ), -1 );

// basic trend
Vtr = TEMA( LinRegSlope( C, period ), period );

HaCLimitUp = Ref( HaC, -1 ) * (1 + Cutoff/1000);
HaCLimitDn = Ref( HaC, -1 ) * (1 - Cutoff/1000);
// SVAPO result of price only

SVAPOSum = Sum( IIf( ( HaC > HaCLimitUp ) AND Hold( Vtr >= Ref( Vtr,-1 ), 2 ), C,
IIf( ( HaC < HaCLimitDn ) AND Hold( Vtr > Ref( Vtr, -1 ), 2 ), -C, 0 ) ), period );
SVAPO = TEMA( SVAPOSum / (Vave+1), period );

PlotGrid( 0 );

Plot( SVAPO, "SVAPO", colorBlue, styleThick );
Plot( devH * StDev( SVAPO, StDevPer ), "Up", colorGreen );
Plot( -devL * StDev( SVAPO, StDevPer ), "Dn", colorRed );

LISTING 3: Trailing stop reversal

stop = Param("Trailing Stop", 7, 0, 20 );

trail = Null;

for( i = 1; i < BarCount; i++ ) { prev = trail[ i - 1 ]; Cur = 0; if( prev == C[ i ] ) Cur = prev; else if( C[ i - 1 ] < prev AND C[ i ] < prev ) Cur = Min( prev, C[ i ] * ( 1 + stop/100 ) ); else if( C[ i - 1 ] > prev AND C[ i ] > prev )
Cur = Max( prev, C[ i ] * ( 1 - stop/100 ) );
else
if( C[ i ] > prev )
Cur = C[ i ] * ( 1 - stop/100 );
else
Cur = C[ i ] * ( 1 + stop/100 );

trail[ i ] = Cur;
}

Plot( C, "Price", colorBlack );
Plot( trail, "Trailstop", colorRed );
SMOOTHED RSI INVERSE FISHER TRANSFORM
Calculation of Sylvain Vervoort’s smoothed Rsi inverse Fisher transform, as presented in his article in this issue, begins by smoothing the price curve with the “rainbow” weighted moving average. This smoothed price curve is used to calculate an Rsi, which is then smoothed with the Vervoort zero-lag exponential moving average. The resulting curve is then transformed with an inverse Fisher filter.
Fisher suggests that a breakout above 12 indicates buying opportunities and a breakdown below 88 indicates selling opportunities. These opportunities should then be studied in the context of a slow stochastic and Vervoort’s own Arsi indicator. Here, we present the code for Vervoort’s rainbow (the indicator code) and Rsi_InverseFisher transforms (indicator and strategy code). The “Sve_RainbowAverage” function is used in the strategy and indicators.



AMIBROKER: SMOOTHED RSI INVERSE FISHER TRANSFORM
Implementing a smoothed Rsi inverse Fisher transform as described in Sylvain Vervoort’s article in this issue is easy in AmiBroker Formula Language (Afl).
A ready-to-use formula for the article is presented in Listing 1. Note that instead of the difficult-to-read, nested code of the original article, we use iteration (a loop). This results not only in cleaner code but also allows changing the “depth” of the rainbow without the need to recode the formula. In addition to that, we are also providing an asymmetrical Rsi (Arsi) formula in Listing 2. To use it, enter the formula in the Afl editor, then press the Insert Indicator button.
LISTING 1

// TASC Oct 2010 - SVE Inv Fisher

RSIPer = Param("RSI Period", 4, 2, 30 );
EMAper = Param("EMA Period", 4, 1, 100 );

mwiter = C;
RainbW = 0;
for( i = 0; i < 10; i++ ) { weight = Max( 5 - i, 1 ); mwiter = WMA( mwiter, 2 ); RainbW += weight * mwiter; } RainbW /= 20; x = 0.1 * ( RSIa( RainbW, RSIper ) - 50 ); EMA1 = EMA( x, EMAPer ); EMA2 = EMA( EMA1, EMAPer ); Difference = EMA1 - EMA2; Z1Ema = EMA1 + Difference; ex = exp( 2 * Z1EMA ); y = ( ex - 1 )/( ex + 1 ); invfish = 50 * ( y + 1 ); Plot( invfish, "SVE Inverse Fisher RSI", colorRed ); LISTING 2 // ARSI formula // variable period version Period = Param("ARSI Period", 14, 1, 100 ); Chg = C - Ref( C, -1 ); UpCount = Sum( Chg >= 0, Period );
DnCount = Period - UpCount;
UpMove = AMA( Max( Chg, 0 ), Nz( 1/UpCount ) );
DnMove = AMA( Max( -Chg, 0 ), Nz( 1/DnCount ) );

RS = UpMove/DnMove;

ARSI = 100-(100/(1+RS));

Plot( ARSI, "ARSI_V("+Period+")", colorBlue );

nb:change parameter like arsi 8,5,12 and stoch k 50,20,12 days which is suitable for you.
I use 8 days arsi and stoch 21 day .it is working cool for me.

My Blog List

Total Pageviews

Search This Blog

Followers