31 January 2012

Fibonacci Numbers

Overview
Fibonacci numbers are the result of work by Leonardo Fibonacci in the early 1200's while studying the Great Pyramid of Gizeh. The fibonacci series is a numerical sequence comprised of adding the previous numbers together, i.e.,

(1,2,3,5,8,13,21,34,55,89,144,233 etc..)

An interesting property of these numbers is that as the series proceeds, any given number is 1.618 times the preceding number and 0.618% of the next number.

(34/55 = 55/89 = 144/233 =0.618) (55/34 =89/55 =233/144 =1.618), and 1.618 =1/0.618.

This properties of the fibonacci series occur throughout nature, science and math and is the number 0.618 is often referred to as the "golden ratio" as it is the root of the following polynomial x^2+x-1=0 which can be rearranged to x= 1/(1+x).

So that's were the fib # 0.618 comes from. The other fibs 0.382 and 0.5 commonly used in technical analysis have a less impressive background but are just as powerful in Technical analysis.

0.382=(1-.618)=(0.618*0.618)

and 0.5 is the mean of the two numbers.

Other neat fib facts (0.618*(1+0.618)=1 and (0.382*(1+.618))=0.618.

Use of Fibonacci #'s in Technical Analysis
Fibonacci numbers are commonly used in Technical Analysis with or without a knowledge of Elliot wave analysis to determine potential support, resistance, and price objectives. 38.2% retracements usually imply that the prior trend will continue, 61.8% retracements imply a new trend is establishing itself. A 50% retracement implies indecision. 38.2% retracements are considered nautral retracements in a healthy trend.

ABC's
Price objectives for a natural retracement (38.2%) can be determined by adding (or subtracting in a downtrend) the magnitude of the previous trend to the 38.2% retracement. After the 38.2% retracement the stock should break through the previous swing point(B) on heavier volume. If the volume isn't there the magnitude of the move will usually be diminished, especially on very low volume.






A-B =C-D when B-C =38.2% of A-B

61.8% retracements are warning signs of a potential trend changes. For a more detailed explanation of Fibonacci price projections and price wave theory I highly recommend the Elliot Wave Principle links below.

Confluence Confluence occurs when you take fibonacci projections off of multiple trends and get the same number and strengthens when it corresponds with other technical advents such as gaps, swing high/lows, chart indicators crossovers (MACD, RSI, Stochastics, etc.), trading congestion, etc. The more confluence, the more significant the level. I really take notice when I get two or more fib #s (say a 38.2% and 61.8%) to correspond with a gap in the chart or a swing high. Confluence is very powerful as it combines multiple technical analysis techniques to arrive at the same conclusion, and should be relied on accordingly IMHO

Trading Strageties JMHO

Once a new swing point is established in an equity, a new set of fibonacci numbers should be calculated, and confluence checked to determine potential support/resistance levels and trading strategies. (let the Fibonacci Calculator do most of the work for you). For instance:


If a stock is trending up, one may watch it until it forms a top then calculate the fibs. If she retraces 38.2% and turns with confluence, one could bite with an automatic stop under the 50% retracement and objective of the ABC. The Risk/Reward ratio for that trade is 0.118. (If you got stopped out 8 times and hit once you would have a 5.6% profit).

If she's trending down, you could bite at the 38.2% bounce with a stop at the 50% and get the same risk/reward ratio. With both strategies it is critical for the volume to be heavier on the swing point breakout.

If a position is going with you and you're looking for an exit point, calculate the 38.2% fib once a top is clear and put a stop below it. Won't get you out at the top but you may not miss that monster rally either.

Think a stock is a dog but it's trading at it's high wait for a 61.8% retracement from the last trend and sell it, with the stop below the 50% retracement.

20 January 2012

Bob-Marley-The-Wailers-Get-Up-Stand-Up My favorite (inspirational Song)

Get up, stand up: stand up for your rights!
Get up, stand up: stand up for your rights!
Get up, stand up: stand up for your rights!
Get up, stand up: don't give up the fight!

Preacherman, don't tell me,
Heaven is under the earth.
I know you don't know
What life is really worth.
It's not all that glitters is gold;
'Alf the story has never been told:
So now you see the light, eh!
Stand up for your rights. Come on!

Get up, stand up: stand up for your rights!
Get up, stand up: don't give up the fight!
Get up, stand up: stand up for your rights!
Get up, stand up: don't give up the fight!

Most people think,
Great God will come from the skies,
Take away everything
And make everybody feel high.
But if you know what life is worth,
You will look for yours on earth:
And now you see the light,
You stand up for your rights. Jah!

Get up, stand up! (Jah, Jah!)
Stand up for your rights! (Oh-hoo!)
Get up, stand up! (Get up, stand up!)
Don't give up the fight! (Life is your right!)
Get up, stand up! (So we can't give up the fight!)
Stand up for your rights! (Lord, Lord!)
Get up, stand up! (Keep on struggling on!)
Don't give up the fight! (Yeah!)

We sick an' tired of-a your ism-skism game -
Dyin' 'n' goin' to heaven in-a Jesus' name, Lord.
We know when we understand:
Almighty God is a living man.
You can fool some people sometimes,
But you can't fool all the people all the time.
So now we see the light (What you gonna do?),
We gonna stand up for our rights! (Yeah, yeah, yeah!)

So you better:
Get up, stand up! (In the morning! Git it up!)
Stand up for your rights! (Stand up for our rights!)
Get up, stand up!
Don't give up the fight! (Don't give it up, don't give it up!)
Get up, stand up! (Get up, stand up!)
Stand up for your rights! (Get up, stand up!)
Get up, stand up! ( ... )
Don't give up the fight! (Get up, stand up!)
Get up, stand up! ( ... )
Stand up for your rights!
Get up, stand up!
Don't give up the fight! /fadeout/

The lyrics for this 1973 track were written by Bob Marley and Peter Tosh who were influenced mainly by their Jamaican upbringing. The song is basically about the fight for acceptance of their Rastafarian religion and the need to take action to avoid oppression, however, much of the inspiration appears to have come from another song `Slippin' Into Darkness' by War.

The meaning behind the lyrics can be interpreted as both religious and anti-religious depending on your point of view. On one hand, the line, `Get up, stand up: stand up for your rights,' can be seen as a rallying call to stand up and demand respect for the Rastafarian religion. On the other hand, the lines, `Preacher man don't tell me, heaven is under the earth, I know you don't know, what life is really worth,' suggest hanging on to freedom of thought rather than the words of religious leaders.

In the track by War, the lyrics warn of the thin line between sanity and insanity and how your own thoughts can be enough to push you over the edge into darkness. In this song, the lyrics tell us that religion can also be responsible for altering the way some people think with the lines, `Alf the story has never been told, so now you see the light, eh!'

There may well be some underlying political as well as social undertones but the main message in the lyrics is to live for the here and now; not to wait for the promised ever after.

14 January 2012

Buying Stocks When The Price Goes Down: Big Mistake?

The strategy of "averaging down", as the term implies, involves investing additional amounts in a financial instrument or asset if it declines significantly in price after the original investment is made. It's true that this action brings down the average cost of the instrument or asset, but will it lead to great returns or just to a larger share of a losing investment? Read on to find out.

Tutorial: The World's Greatest Investors

Conflicting Opinions
There is radical difference of opinion among investors and traders about the viability of the averaging down strategy. Proponents of the strategy view averaging down as a cost-effective approach to wealth accumulation; opponents view it as a recipe for disaster.

The strategy is often favored by investors who have a long-term investment horizon and a contrarian approach to investing. A contrarian approach refers to a style of investing that is against, or contrary, to the prevailing investment trend. (Learn how these investors profit from market fear in Buy When There's Blood In The Streets.)

For example, suppose that a long-term investor holds Widget Co. stock in his or her portfolio and believes that the outlook for Widget Co. is positive. This investor may be inclined to view a sharp decline in the stock as a buying opportunity, and probably also has the contrarian view that others are being unduly pessimistic about Widget Co.'s long-term prospects. Such investors justify their bargain-hunting by viewing a stock that has declined in price as being available at a discount to its intrinsic or fundamental value. "If you liked the stock at $50, you should love it at $40" is a mantra often quoted by these investors. (To learn about the downside to this strategy, read Value Traps: Bargain Hunters Beware!)

On the other side of the coin are the investors and traders who generally have shorter-term investment horizons and view a stock decline as a portent of things to come. These investors are also likely to espouse trading in the direction of the prevailing trend, rather than against it. They may view buying into a stock decline as akin to trying to "catch a falling knife." Such investors and traders are more likely to rely on technical indicators, such as price momentum, to justify their investing actions. Using the example of Widget Co., a short-term trader who initially bought the stock at $50 may have a stop-loss on this trade at $45. If the stock trades below $45, the trader will sell the position in Widget Co. and crystallize the loss. Short-term traders generally do not believe in averaging their positions down, as they see this as throwing good money after bad.

Advantages of Averaging Down
The main advantage of averaging down is that an investor can bring down the average cost of a stock holding quite substantially. Assuming the stock turns around, this ensures a lower breakeven point for the stock position, and higher gains in dollar terms than would have been the case if the position was not averaged down.

In the previous example of Widget Co., by averaging down through the purchase of an additional 100 shares at $40, the investor brings down the breakeven point (or average price) of the position to $45. If Widget Co. stock trades at $49 in another six months, the investor now has a potential gain of $800 (despite the fact that the stock is still trading below the initial entry price of $50).

If Widget Co. continues to rise and advances to $55, the potential gains would be $2,000. By averaging down, the investor has effectively "doubled up" the Widget Co. position. Had the investor not averaged down when the stock declined to $40, the potential gain on the position (when the stock is at $55) would amount to only $500.

Disadvantages of Averaging Down
Averaging down or doubling up works well when the stock eventually rebounds because it has the effect of magnifying gains, but if the stock continues to decline, losses are also magnified. In such cases, the investor may rue the decision to average down rather than either exiting the position or failing to add to the initial holding.

Investors must therefore take the utmost care to correctly assess the risk profile of the stock being averaged down. While this is no easy feat at the best of times, it becomes an even more difficult task during frenzied bear markets such as that of 2008, when household names such as Fannie Mae, Freddie Mac, AIG and Lehman Brothers lost most of their market capitalization in a matter of months. (To learn more, read Fannie Mae, Freddie Mac And The Credit Crisis Of 2008.)

Another drawback of averaging down is that it may result in a higher-than-desired weighting of a stock or sector in an investment portfolio. As an example, consider the case of an investor who had a 25% weighting of U.S. bank stocks in a portfolio at the beginning of 2008. If the investor averaged down his or her bank holdings after the precipitous decline in most bank stocks that year so that these stocks made up 35% of the investor's total portfolio, this proportion may represent a higher degree of exposure to bank stocks than that desired. At any rate, it certainly puts the investor at much higher risk. (To learn more, read A Guide To Portfolio Construction.)

Practical Applications
Some of the world's most astute investors, including Warren Buffett, have successfully used the averaging down strategy over the years. While the pockets of the average investor are nowhere near as deep as deep as Buffett's, averaging down can still be a viable strategy, albeit with a few caveats:

Averaging down should be done on a selective basis for specific stocks, rather than as a catch-all strategy for every stock in a portfolio. This strategy is best restricted to high-quality, blue-chip stocks where the risk of corporate bankruptcy is low. Blue chips that satisfy stringent criteria - which include a long-term track record, strong competitive position, very low or no debt, stable business, solid cash flows, and sound management - may be suitable candidates for averaging down.

Before averaging down a position, the company's fundamentals should be thoroughly assessed. The investor should ascertain whether a significant decline in a stock is only a temporary phenomenon, or a symptom of a deeper malaise. At a minimum, factors that need to be assessed are the company's competitive position, long-term earnings outlook, business stability and capital structure.

The strategy may be particularly suited to times when there is an inordinate amount of fear and panic in the markets, because panic liquidation may result in high-quality stocks becoming available at compelling valuations. For example, some of the biggest technology stocks were trading at bargain-basement levels in the summer of 2002, while U.S. and international bank stocks were on sale in the second half of 2008. The key, of course, is exercising prudent judgment in picking the stocks that are best positioned to survive the shakeout.

The Bottom Line
Averaging down is a viable investment strategy for stocks, mutual funds and exchange-traded funds. However, due care must be exercised in deciding which positions to average down. The strategy is best restricted to blue chips that satisfy stringent selection criteria such as a long-term track record, minimal debt and solid cash flows.
by Elvis Picardo

Read more: http://www.investopedia.com/articles/stocks/08/average-down-dollar-cost-average.asp#ixzz1jQZn1yyW

13 January 2012

COG CHART

AFL COG

http://www.4shared.com/file/OCJoOub6/COG_MOD_SELF.html



COG: Center of Gravity indicator
AFL code by E.M.Pottasch, 2011
translated from: http://chartstudio.whselfinvest.com/files/CenterGravity_0.ctl

another translation of COG. This code faster and also comes with a timer which I will post separately.

About how to use it: there is material on the internet that explains. Note that this indicator repaints. Each time a new data point come in it uses all datapoints in the range to calculate the polynomial fit. So the fit is not stationary. Therefor it looks great but its use in trading is questionable. The chart shows how it is intended to use: The bands are heading up and the price is starting to enter the green zone this is where you buy.
Center of Gravity (COG) indicator, original idea from El Mostafa Belkhayate
Amibroker AFL code by E.M.Pottasch, 2011
Based on code by Fred Tonetti, 2006, n-th order Polynomial fit (see Amibroker Lib)
JohnCW provided Gaussian_Eliminationsv function based on static variables.

COG timing indicator
AFL translation by E.M.Pottasch, 2011
from: http://chartstudio.whselfinvest.com/files/COGTiming.ctl

I cant code just tricks n tweeks(copy past)

Inspired by wisestock n Rakib Bro

LINKS

http://www.imdb.com/title/tt1439572/
http://www.vyingbrain.com/
http://www.amibroker.com/library/list.php
http://blog.bdnews24.com/nijhum/58900
http://www.blogtopsites.com/siteposts/60116
http://www.simple-stock-trading.com/
http://www.amibroker.com/guide/drawtools.html
http://www.liberatedstocktrader.com/pareto-fibonacci-stock-market-crashes-stock-market-video-podcast-sept-2011/
http://www.swing-trade-stocks.com/technical-analysis-videos.html
http://www.stockta.com/fibonacci.html
http://www.youtube.com/watch?v=Dlv4MKIxdOg

http://www.desipad.com/english-hollywood-movies/

http://www.desirulez.net/latest-exclusive-movie-hq/
http://www.stockta.com/fibonacci.html

























Website Links

http://www.stockta.com/fibonacci.html

























09 January 2012

INTRA BP SP

_SECTION_BEGIN("Demand Index");
//------------------------------------------------------------------------------
//
// Formula Name: Demand Index
// Author/Uploader: Steve Wiser
// E-mail: slwiserr@erols.com
// Date/Time Added: 2001-07-05 19:12:36
// Origin:
// Keywords:
// Level: medium
// Flags: system,exploration,indicator
// Formula URL: http://www.amibroker.com/library/formula.php?id=58
// Details URL: http://www.amibroker.com/library/detail.php?id=58
//
//------------------------------------------------------------------------------
//
// Uses the demand index for a system test.
//
//------------------------------------------------------------------------------

/* Demand Index */
/* Steve Wiser at slwiserr@erols.com */
/* Exploration, System and indicator */

GraphMax=9;

A=(H+L+2*C);
B=EMA((HHV(H,2)-LLV(L,2)),19);
BuyP=
/*{BuyPower}*/
V/EMA(V,19) * ((A>=Ref(A,-1)) +(ARef(A,-1)) / exp((0.375 * (A+Ref(A,-1)) / B ) * (A-Ref(A,-1)) / Ref(A,-1)));


mabp=EMA(BuyP,19);
masp=EMA(SellP,19); /*{smooth Selling Pressure}*/
divsor=IIf(mabp>masp,mabp,masp); /*{BP:SP ratio}*/
divend=IIf(mabpmabp) , -var2 , var2 ) ; /*{range -100 to 100}*/
var4=var3*100;
Graph1 = var4;
Graph1Style=5;

var5=MA(var4,30);
Graph2=var5;;
Graph2Style=5;
Graph2Color=7;

/* Zero Line */
Graph0=0;


Buy=Cross(var4,var5); /* originally var5 was a zero */
Sell=Cross(0,var4);

Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);

Short=Sell;
Cover=Buy;

Filter= (Buy == 1 OR Sell == 1) ;
NumColumns = 7;
Column0 = IIf(Buy == 1, 1, IIf(Sell == 1, -1, 0 ) );
Column0Format = 1.0;
Column0Name = "B/S";
Column1 = C;
Column1Name = "Close ";
Column1Format = 1.2;
Column2 = MA(V,17);
Column2Name = "17 Ma Vol ";
Column2Format = 1.0;
Column3 = MA(C,17)/MA(C,50);
Column3Name = "% 17/50 ";
Column3Format = 1.2;
Column3Format = 1.2;
Column4= MA(C,17);
Column4Name="17 C ma";
Column4Format = 1.2;
Column4= MA(C,50);
Column4Name="50 C ma";
Column4Format = 1.2;
Column5=ROC(var4,2);
Column5Name="ROC DI";
Column5Format=1.2;
Column6=Cum(1);
Column6Name = "#Bars";
Column6Format = 1.0;

/* End of Exploration Code. */
_SECTION_END();

08 January 2012

FIBO RETS EXTEN COMENTRY NICE AFL

_SECTION_BEGIN("MOB simulation shiree");

SetChartOptions(0,chartShowArrows|chartShowDates);


_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
//Plot( C, "Close", ParamColor("Color", colorPink ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
PlotOHLC(O,H,L,C,"Price",IIf(C>O,colorGreen,colorRed),styleCandle);


//Date: 12-January 2002 by Thomas Zmuck
//thomas.zm@ aon.at
Offset = 5; //use two sheets: one with 5 and another with 7, or maybe other offset value
Avgmov = Offset*MA(abs( ROC(C,1)) ,20);
per = LastValue(Avgmov) ;
x=Cum(1);
Range = 0.01;
PS = TroughBars(L, per,1) == 0;
xa = LastValue(ValueWhen (PS,x,1)) ;//x from last trough
Ya = LastValue(ValueWhen (PS,L,1)) ;//y (Low) last trough
PR = PeakBars(H,per, 1) == 0;
xb = LastValue(ValueWhen (PR,x,1)) ;//x from last peak
Yb = LastValue(ValueWhen (PR,H,1)) ;//y (High) last peak
Trough_ReTest = abs((L/ya)-1) xa;//upSwing
DN = xa>xb;//DownSwing
RT23_6 = IIf(UP,yb-(yb- ya)*0.236, IIf(DN,ya+ (yb-ya)*0.236,-1e10) );
RT38_2 = IIf(UP,yb-(yb- ya)*0.382, IIf(DN,ya+ (yb-ya)*0.382,-1e10) );
RT50_0 = IIf(UP,yb-(yb- ya)*0.500, IIf(DN,ya+ (yb-ya)*0.500,-1e10) );
RT61_8 = IIf(UP,yb-(yb- ya)*0.618, IIf(DN,ya+ (yb-ya)*0.618,-1e10) );
RT78_6 = IIf(UP,yb-(yb- ya)*0.786, IIf(DN,ya+ (yb-ya)*0.786,-1e10) );

RT12_7 = IIf(UP,yb-(yb- ya)*1.27, IIf(DN,ya+ (yb-ya)*1.27,-1e10) );
RT16_1 = IIf(UP,yb-(yb- ya)*1.61, IIf(DN,ya+ (yb-ya)*1.61,-1e10) );

RT=
IIf(UP,-100* (yb-L)/(yb- ya),
100*(H-ya)/( yb-ya));//Retracement_ Value
InZone = Cya;//use it for filter to receive only signals that are in in the Retracement zone.
Buy = Trough_ReTest OR peak_Cross;
Sell = Peak_ReTest OR trough_Cross;
Filter = 1;
AddColumn(RT, "RT%");
AddColumn(Trough_ReTest,"TR- Test",1.0) ;
AddColumn(Peak_ReTest,"PK-Test",1.0) ;
AddColumn(Trough_Cross,"TR-Cross",1.0);
AddColumn(Peak_Cross,"PK-Cross",1.0);
//AddColumn(CdDoji( )OR CHammer(),"Candle" ,1.0);
Plot(C,"C",1, 64);
Plot(IIf(x>xa, ya,-1e10) ,"Bottom" ,colorBrown, 1+8);
Plot(IIf(x>xb, yb,-1e10) ,"Top",colorBrown,1+8);
xab = IIf(xb>xa,xb, xa);
//Retracements
Plot(IIf(x>= xab+1,RT23_6,-1e10), "23,6% Retr.",5,1);
Plot(IIf(x>= xab+1,RT38_2,-1e10), "38,2% Retr.",5,1);
Plot(IIf(x>= xab+1,RT50_0,-1e10), "50,0% Retr.",colorBlue, 1);
Plot(IIf(x>= xab+1,RT61_8,-1e10), "61,8% Retr.",colorYellow, 1);
Plot(IIf(x>= xab+1,RT78_6,-1e10), "78,6% Retr.",colorYellow, 1);

Plot(IIf(x>= xab+1,RT12_7,-1e10), "127% ext.",colorBrightGreen, styleDots);
Plot(IIf(x>= xab+1,RT16_1,-1e10), "161% ext.",colorBrightGreen, styleDots);
CondA=IIf(x>= xab+1,RT12_7,-1e10);
CondB=IIf(x>= xab+1,RT16_1,-1e10);
PlotOHLC(Condb,Condb,Conda,Conda,"",ColorRGB(30,130,30),styleCloud,styleNoLabel);


GraphXSpace = 0.5;




//Plot(Gauss2ord(C,5),"M5",4,1);
//GraphXSpace = 1.5;
//Title = Name()+" per = "+WriteVal(per, 1.0) +" Close = "+WriteVal(C, 1.2)+ " ("+WriteVal( ROC(C,1), 1.2)+"%)" +" Current Correction = "+WriteVal(RT, 1.0)+"%";

//Plot( Volume,"V", ParamColor("Color", colorBlueGrey ), ParamStyle( "Style", stylehidden| styleOwnScale | styleThick, maskHistogram ), 2 );


_SECTION_END( );

07 January 2012

SIMPLE MA CROSSOVER AFL SCAN

// EnterAtMarket.afl
//
// Entry at the Market
//
// This example uses a simple moving average crossover to
// illustrate entering a long position at the market
//
// The delay between the signal and the entry is
// controlled either by the Settings window or the AFL code
//
// The following code will insure that trades will be made
// on the Close of the same bar that generates the Buy or
// Sell signal.
SetTradeDelays(0,0,0,0);
BuyPrice = C;
SellPrice = C;

// The trading system is a simple moving average crossover
MA1 = MA(C,5);
MA2 = MA(C,25);

// The Buy signal is generated on the bar when MA1 crosses
// from below MA2 to above MA2.
Buy = Cross(MA1,MA2);
Sell = Cross(MA2,MA1);
//Figure 7.1 Enter at Market

MODIFY PERAMITER AS SUITABLE

Stock Scanning /Shortlisting

You can scan based on a variety of parameters.

Period – the last n bars that you want to scan Rate of change for 3 groups of n bars in the period above. If ROC is made 0, no rate of change is compared for that period. The AFL selects both positive ROC combinations and the converse. For example if you choose a ROC combination of 0.2, 0.2 and 0.2 for 10 bars, the selection of minus .2, minus .2, and minus .2 is automatic.

Use exploration to view the results. In exploration you can also sort by Price change during the day or within the range of n bars.

You can choose appropriate time frames and stocks lists using the Settings and Define options in Automatic Analysis.

Go ahead and modify to suit your needs.



n =Param("Period", 6, 1, 50, 1 );
n1 = Param("ROC1", 0.2, -2, 3, 0.01);
n2 = Param("ROC2", 0, -2, 3, 0.01);
n3 = Param("ROC3", 0, -2, 3, 0.01);


//Cond1 = IIf((C-Ref(C,-1))/Ref(C,-1)> 0.01 AND C>EMA(C,10),1,0);
//Cond2 = IIf((Ref(C,-1)-C)/Ref(C,-1)> 0.01 AND C0 AND n2>0 AND n3>0)
{
Cond1= ROC1 > n1 AND ROC2 > n2 AND ROC3 > n3;
Cond2= ROC1 < -n1 AND ROC2 < -n2 AND ROC3 < -n3; } else if(n1>0 AND n2>0 AND n3==0)
{
Cond1= ROC1 > n1 AND ROC2 > n2 ;
Cond2= ROC1 < -n1 AND ROC2 < -n2 ; } else if(n1>0 AND n2==0 AND n3==0)
{
Cond1= ROC1 > n1 ;
Cond2= ROC1 < -n1 ; } else if(n1>0 AND n2==0 AND n3>0)
{
Cond1= ROC1 > n1 AND ROC3 > n3;
Cond2= ROC1 < -n1 AND ROC3 < -n3; } else if(n1==0 AND n2>0 AND n3>0)
{
Cond1= ROC2 > n2 AND ROC3 > n3;
Cond2= ROC2 < -n2 AND ROC3 < -n3; } else if(n1==0 AND n2>0 AND n3==0)
{
Cond1= ROC2 > n2 ;
Cond2= ROC2 < -n2; } else if(n1==0 AND n2==0 AND n3>0)
{
Cond1= ROC3 > n2 ;
Cond2= ROC3 < -n2; } else if(n1==0 AND n2==0 AND n3==0) { Cond1= 1; Cond2= 1; } else if(n1>0 AND n2<0 AND n3==0) { Cond1= ROC1 > n1 AND ROC2 < n2 ; Cond2= ROC1 < -n1 AND ROC2 > -n2 ;
}
else if(n1<0 AND n2>0 AND n3<0) { Cond1= ROC1 < n1 AND ROC2 > n2 AND ROC3 < n3; Cond2= ROC1 > -n1 AND ROC2 < -n2 AND ROC3 > n3;
}
else if(n1<0 AND n2>0 AND n3>0)
{
Cond1= ROC1 < n1 AND ROC2 > n2 AND ROC3 > n3;
Cond2= ROC1 > -n1 AND ROC2 < -n2 AND ROC3 < n3; } else if(n1<0 AND n2>0 AND n3==0)
{
Cond1= ROC1 < n1 AND ROC2 > n2 ;
Cond2= ROC1 > -n1 AND ROC2 < -n2 ; } else if(n1<0 AND n2==0 AND n3>0)
{
Cond1= ROC1 < n1 AND ROC3 > n3;
Cond2= ROC1 > -n1 AND ROC3 < n3; } prch = (C- TimeFrameGetPrice( "C", inDaily, -1 ))/ TimeFrameGetPrice( "C", inDaily, -1 )*100 ; prch6= (C-Ref(C,-6))/Ref(C,-6)*100; Perc = (C-Ref(C,-nn))/Ref(C,-nn); Buy=Cond1 OR Cond2; Sell=!cond1 AND !cond2; Filter = (Cond1 OR Cond2) AND ADX() > 16;// AND C < 2500 ;
AddColumn(Cond1, "Buy",1);
AddColumn(Cond2, "Sell", 1);
AddColumn(C, "Close", 1.3);
AddColumn(Perc, "Change", 1.3);
AddColumn(ADX(),"ADX",1.1);
AddColumn(ROC1, "ROC", 1.1);
AddColumn(ROC2,"ROC-",1.1);
AddColumn(ROC3,"ROC--",1.1);
AddColumn(prch,"prchopen", 1.2);
AddColumn(prch6,"prchlast6", 1.2);



This scan helps to identify stocks which have a trend developing.
For example if your database has stock futures, you can find out which of these stocks are trending positively or negatively. The scan allows you to examine “n” bars, which you can set up in the parameters section – the default is 6. The default rate of change is +0.2 and -0.2.

By default the scan will examine the ROC of price movement for the latest n (default =6) bars for the time frame that you set in Automatic Analysis (which could be 5 minutes, 15 minutes, daily etc).

The output in the scan window will be all those stocks which have an ROC in the last n (default=6) greater than 0.2 or less than -0.2. This will allow you to identify positive trending and negative trending stocks.

The parameters can be changed using the parameters section in the Automatic Analysis window.

By default only the latest n (6) bars are selected in the scan. You can change this also by giving non zero values to ROC2, and ROC3. Lets say these are also set to 0.2 and 0.2. In that case, the scan will result in stocks which meet the criteria – where the the latest n bars, the previous n bars and the ones n bars prior as well to meet the ROC condition that you have setup.

For example if ROC1=ROC2=ROC3 =0.2, and n =6. The scan will show those stocks where the ROC in the three sets of previous 6 bars,(-1 to -6, -7 to -12 and -13 to -18) all have rates of change greater than 0.2 or less than -0.2.

Excellent to identify big trending stocks.

If you experiment with different positive and negative values of ROC1/2/3, you will also be able to identify stocks swinging one direction to the other.

And best part, of course, ability to set any time frame.

The scanned stocks can be put into a new watch list that you can then easily track.

Hope this helps.

06 January 2012

01 January 2012

Linear Regression Channel with Trend Identifier for Amibroker (AFL)

I modified the original Linear Regression code so that the line will change color based on the degree of the Linear Regression slope. I combine this with my trading system. When my system gives an entry signal I look at the Linear Regression Line and I will only take long positions if the Linear Regression line is green and the entry price is below the LR line. When my system gives an entry signal I look at the Linear Regression Line and I will only take short positions if the Linear Regression line is red and the entry price is above the LR line. It is usefull for filtering out lower probability trades.

I prefer 89 period .

My Blog List

Total Pageviews

Search This Blog

Followers