Month: April 2016

Recurrence Relations to Remember

Recurrence                Algorithm                Big-Oh Solution

T(n) = T(n/2) + O(1)      Binary Search            O(log n)

T(n) = T(n-1) + O(1)      Sequential Search       O(n)      

T(n) = 2 T(n/2) + O(1)    Tree traversal       O(n)

T(n) = T(n-1) + O(n)     Selection Sort (other n2 sorts)     O(n2)

T(n) = 2 T(n/2) + O(n)   Mergesort (average case Quicksort)   O(n log n)

T(n) = T(n/2) + O(n)    QuickSelect(select the kth smallest)   O(n)

T(n) = 2 T(n/2) + O(logn)   Optimal Sorted Matrix Search     O(n)

Refer to for solving more new problems.








Quarter Earning Calendar:

luxh009 : 几个指标看SPY要跟的,只是会晚一点

CYB WisdomTree Chinese Yuan Strategy Fund:

Cobra’s public chart (ranked #4) :


Anthony Caldaro (Elliott Wave) public charts:

Number #1 ranked (Joanne Klein) :


Dancing with the trend:

Do the CPCE and VIX suggest a top is imminent?
SVXY长期投资的可能性 [引用]




UVXY 之一 每年平均跌85% 你若做空赚85%

UVXY 之二 为什么长期来说UVXY稳跌 卖空UVXY稳赚

UVXY 之三 做空UVXY的风险到底有多压力山大

UVXY 之四 n种交易方法 到底是赔钱还是赚钱

UVXY 之五 机会突然就在眼前了 离入场只剩一步 (现实是差了好几步哈哈)

UVXY 之六 如何才能做空UVXY及替代办法(SVXY)

UVXY 之七 空仓开始后的止损和止盈


Earning report:

Technical stock chart:

good website:

I.    Relative Strength Index:

Reference:   Introduction to RSI  how to trade with RSI



RSI is considered overbought when above 70 and oversold when below 30. These traditional levels can also be adjusted to better fit the security or analytical requirements. Raising overbought to 80 or lowering oversold to 20 will reduce the number of overbought/oversold readings. Short-term traders sometimes use 2-period RSI to look for overbought readings above 80 and oversold readings below 20.  Momentum oscillators can become overbought (oversold) and remain so in a strong up (down) trend.  Like many momentum oscillators, overbought and oversold readings for RSI work best when prices move sideways within a range。


According to Wilder, divergences signal a potential reversal point because directional momentum does not confirm price. A bullish divergence occurs when the underlying security makes a lower low and RSI forms a higher low. RSI does not confirm the lower low and this shows strengthening momentum. A bearish divergence forms when the security records a higher high and RSI forms a lower high. RSI does not confirm the new high and this shows weakening momentum

Before getting too excited about divergences as great trading signals, it must be noted that divergences are misleading in a strong trend. A strong uptrend can show numerous bearish divergences before a top actually materializes.Conversely, bullish divergences can appear in a strong downtrend – and yet the downtrend continues. Chart 6 shows the S&P 500 ETF (SPY) with three bearish divergences and a continuing uptrend. These bearish divergences may have warned of a short-term pullback, but there was clearly no major trend reversal.

Positive-Negative Reversals:

Cardwell’s interpretation of divergences differs from Wilder. Cardwell considered bearish divergences as bull market phenomenon. In other words, bearish divergences are more likely to form in uptrends. Similarly, bullish divergences are considered bear market phenomenon indicative of a downtrend.

A positive reversal forms when RSI forges a lower low and the security forms a higher low. This lower low is not at oversold levels, but usually somewhere between 30 and 50. A positive reversal indicates a possible breakup from bottom. Chart 11 shows MMM with a positive reversal forming in June 2009. MMM broke resistance a few weeks later and RSI moved above 70. Despite weaker momentum with a lower low in RSI, MMM held above its prior low and showed underlying strength. In essence, price action overruled momentum.

Chart 11 - RSI Reversals

A negative reversal is the opposite of a positive reversal. RSI forms a higher high, but the security forms a lower high. In the example cited in the article, this negative reversal foreshadowed the big support break in late June and sharp decline.

Chart 12 - RSI Reversals

Failure Swing:

Failure swings are independent of price action. In other words, failure swings focus solely on RSI for signals and ignore the concept of divergences.

A bullish failure swing forms when RSI moves below 30 (oversold), bounces above 30, pulls back, holds above 30 and then breaks its prior high. It is basically a move to oversold levels and then a higher low above oversold levels.

A bearish failure swing forms when RSI moves above 70, pulls back, bounces, fails to exceed 70 and then breaks its prior low. It is basically a move to overbought levels and then a lower high below overbought levels.


make sure you recognize the failure-swing points and confirm the potential breakout.

In the left figure, entitled “Failure Swing: Top,” the high tops out at slightly above the 70 level and then falls off to about 60, which is known as the fail point. Rising again, the RSI value falls short of the 70 mark and thus results in a failure swing, and, as the value then reaches the fail point again, it is known as the failure-swing point, and the sell trigger is pulled. “Failure Swing: Bottom” shows us the exact opposite as the low of 30 is not exceeded after a fail point is established at about the 40 mark. The failure-swing point is established and the buy signal is in place at or about the 40 value.


The default look-back period for RSI is 14, but this can be lowered to increase sensitivity or raised to decrease sensitivity. 10-day RSI is more likely to reach overbought or oversold levels than 20-day RSI. The look-back parameters also depend on a security’s volatility. 14-day RSI for internet retailer Amazon (AMZN) is more likely to become overbought or oversold than 14-day RSI for Duke Energy (DUK), a utility.



An example for SPY in recent 5 years:

II MACD关于macd的一点浅见。

Because the MACD is unbounded, it is not particularly useful for identifying overbought and oversold levels.








在绘制的图形上,DIFF与DEA形成了两条快慢移动平均线,买进卖出信 号也就决定于这两条线的交叉点。很明显,MACD是一个中长期趋势的投资技术工具。缺省时,系统在副图上绘制 SHORT=12,LONG=26,MID=9时的DIFF线、DEA线、MACD线(柱状线)。



3. DEA 在盘整局面时失误率较高,但如果配合 RSIKDj 指标可适当弥补缺点。

III:  Bollinger Band

Identifying W bottom and M top

W-Bottoms were part of Arthur Merrill’s work that identified 16 patterns with a basic W shape. Bollinger uses these various W patterns with Bollinger Bands to identify W-Bottoms. A “W-Bottom” forms in a downtrend and involves two reaction lows. In particular, Bollinger looks for W-Bottoms where the second low is lower than the first, but holds above the lower band. There are four steps to confirm a W-Bottom with Bollinger Bands. First, a reaction low forms. This low is usually, but not always, below the lower band. Second, there is a bounce towards the middle band. Third, there is a new price low in the security. This low holds above the lower band. The ability to hold above the lower band on the test shows less weakness on the last decline. Fourth, the pattern is confirmed with a strong move off the second low and a resistance break.

M top:

M-Tops were also part of Arthur Merrill’s work that identified 16 patterns with a basic M shape. Bollinger uses these various M patterns with Bollinger Bands to identify M Bottoms. According to Bollinger, tops are usually more complicated and drawn out than bottoms. Double tops, head-and-shoulders patterns and diamonds represent evolving tops.

In its most basic form, an M-Top is similar to a double top. However, the reaction highs are not always equal. The first high can be higher or lower than the second high. Bollinger suggests looking for signs of non-confirmation when a security is making new highs. This is basically the opposite of the W-Bottom. A non-confirmation occurs with three steps. First, a security forges a reaction high above the upper band. Second, there is a pullback towards the middle band. Third, prices move above the prior high, but fail to reach the upper band. This is a warning sign. The inability of the second reaction high to reach the upper band shows waning momentum, which can foreshadow a trend reversal. Final confirmation comes with a support break or bearish indicator signal.

IV: Bollinger BandWidth

A new advance starts with a Squeeze and subsequent break above the upper band. A new decline starts with a Squeeze and subsequent break below the lower band.

The BandWidth indicator can be used to identify the Bollinger Band Squeeze. This alerts chartists to prepare for a move, but direction depends on the subsequent band break. A Squeeze and break above the upper band is bullish, while a Squeeze and break below the lower band is bearish. Be careful for head-fakes though. Sometimes the first break fails to hold as prices reverse the other way. Strong breaks hold and seldom look back. An upside breakout followed by an immediate pullback should serve as a warning.

V: The Money Flow Index (MFI)



VII:Stochastics: An Accurate Buy And Sell Indicator together with fibonacci retracement and EMA


Reading the Chart
The K line is the fastest and the D line is the slower of the two lines. The investor needs to watch as the D line and the price of the issue begin to change and move into either the overbought (over the 80 line) or the oversold (under the 20 line) positions. The investor needs to consider selling the stock when the indicator moves above the 80 level. Conversely, the investor needs to consider buying an issue that is below the 20 line and is starting to move up with increased volume.

Over the years many have written articles exploring the “tweaking” of this indicator, but new investors should concentrate on the basics of stochastics.


VIII:  Commodity Channel Index (CCI)

Developed by Donald Lambert, the Commodity Channel Index (CCI) is a momentum oscillator that can be used to identify a new trend or warn of extreme conditions. This strategy uses weekly CCI to dictate the trading bias when it surges above +100 or plunges below -100, which are key levels noted by Lambert. Once the trading bias is set, daily CCI is used to generate trading signals when it reaches its extremes.

Dips below -100 are deemed oversold and moves back above -100 signal the start of an oversold bounce (green dotted line). The upper band tag and breakout started the uptrend. CCI then identified tradable pullbacks with dips below -100. This is an example of combining Bollinger Bands with a momentum oscillator for trading signals.

the 10-period Commodity Channel Index (CCI) was used to identify short-term overbought situations. A move above +100 is overbought. A move back below +100 signals a resumption of the downtrend (red arrows). This system triggered two good signals in early 2010.


Use CCI together with BB bands:

Signal: Walking the Bands.


Chart 7 shows Monsanto (MON) with a walk down the lower band. The stock broke down in January with a support break and closed below the lower band. From mid January until early May, Monsanto closed below the lower band at least five times. Notice that the stock did not close above the upper band once during this period.  As such, the 10-period Commodity Channel Index (CCI) was used to identify short-term overbought situations. A move above +100 is overbought. A move back below +100 signals a resumption of the downtrend (red arrows). This system triggered two good signals in early 2010.

IX:  intraday intensity index:  volume-based indicator

X: SAR。判断止损,止盈



The Advance-Decline Line (AD Line) is a breadth indicator based on Net Advances, which is the number of advancing stocks less the number of declining stocks. Net Advances is positive when advances exceed declines and negative when declines exceed advances. The AD Line is a cumulative measure of Net Advances. It rises when Net Advances is positive and falls when Net Advances is negative. Chartists can use Net Advances to plot the AD Line for the index and compare it to the performance of the actual index. The AD Line should confirm an advance or a decline with similar movements. Bullish or bearish divergences in the AD Line signal a change in participation that could foreshadow a reversal.

XII: DRB 回购指数 nasdaq US Buyback Achievers Index

13: accumulation/distribution  Volume based indicator

05/21/2016 Weekend Update

Postby Cobra » Fri May 20, 2016 4:39 pm

Institutional buying and selling chart from stocktiming shows clearly more distribution than accumulation, not good.

    When accumulation and distribution are down means we’re in trending phase.
    When accumulation is up, distribution is down, it’s a bottoming phase.
    When accumulation is down, distribution is up, it’s the topping phase.


inst b sell.png

Smart money are buying while QQQ is down, so it’s case 2.), the pullback was over? I know it conflicts with the Institutional buying and selling chart I posted earlier. But that chart only reflects what is happening now, not the future while the smart money chart here does reflect the future, so I’d put more weight on the smart money chart.

How I use the chart:

I don’t care what’s the logic behind the chart. I found it works in the following two cases:

1.) When market up huge, if I see smart money huge short, best if new record short, then I know a short-term pullback is due soon.
2.) When market down, if I see smart money suddenly rises sharply from very negative value, then I know the pullback was over.

So I only use this chart for the above 2 cases. Besides those 2 cases, it means nothing to me. i.e. the absolute value of this chart means nothing to me, I only care if it rises sharply or drops sharply.




@ Computational Investing, Part I – GIT的Dr. Tucker Balch

@ Microeconomics Principles – UIUC

@ The Power of Microeconomics: Economic Principles in the Real World – UC,

@ Finance 方面的课程

@ Economics 方面的课程




想到一个绝妙的炒股盈利办法:如果你经常炒股亏损,把资金分成3份,一份你来操作,要往死里亏。另外2份交给别人来操作,操作跟你的是相反的,或者买相对 应的反相ETF。买UVXY啊,稍微盈利一点,就跑,亏损就死拿。买DUST啊,稍微盈利就跑,亏损就死拿。各种三倍杠杠ETF玩起来。主要的玩法就是稍 微盈利就跑,亏损就死拿,被套加仓,割肉在底部。下跌做多,上涨的标做空

Should I file a amended return if I receive a k-1 form after tax return already filed

Question:  After I filed a return and already got the about $3000 federal return and $1000 state return, I received a k-1 form which doesn’t really change my tax return much (only increased by $8), should I file an amended return?

I spent a whole afternoon filing the amended return and find out I owe $8 federal tax after taking into consideration of the k-1 forms received. seems not worth to file an amended return. even from IRS standpoint of view, It might cost more for them to process the amended return. from my side, the postage fee would be more than $8 given the return is about 40 pages federal and 40 pages of state. More important, from the link below, it says amended refund would be much more likely be audited (although it says especially if you are requesting more tax return)



转发 青蛙十戒律

一)首先要做好资金和风险管理。这是个大课题,以后还要慢慢讲,多多讲,细细讲。基本思路是不要动不动就all in,就上马金,上靠。你可能大赚一两次,但长期下来肯定见妈妈她妈。还有就是离大起大落的个股远点,手痒了,可以day trade 他们,别拿着不放,做青蛙就要有个做青蛙的样,怕心脏受不了。举个例子吧,我曾经抄一个high beta的太阳能股票,赌ER,赚了很多,我留着没卖,结果眼看着利润变成了亏损,对我心里打击太大,连着出昏招,结果亏的一塌糊涂。做好资金和风险管理,就是要做好作战计划。理解股市就是玩概率,小概率时间会发生,想在股市里长期存活,就得在买卖之前就想好冒多大的风险,想好contingency plan,啥时该割肉,啥时该套利。心里有谱了,就会不着慌,少出昏招,减少炒股的stress level。





五)自己是在投资还是在投机。上胡同的,都是想炒股发财的。而且我发现,投机的比投资的多。投资的要有个投资的样,投机的要有个投机的样。投资的看FA,看月线,看周线。投机的就花样多了,光TA也行,看5分钟,一分钟的图的也行。你一定要想好自己是干嘛的。是投资的,就一年调整几次就行了,不用每天看,看了就瞎想,瞎干。记住,股价像个random walk,也叫drunken sailor’s walk。你每天看,挺热闹,挺恐怖的。可一个人喝醉了,能跑多远。Time Frame很重要,作为青蛙,就盯着一个Time Frame做,可以用多Time Frame来给参考意见,但不要弄混了。


六)不要交易过度。啥事过度都不好,炒股,交易过度是大忌。该得的利润没得,不该割肉的给割了,这要是说你,你就过度了。你要是day trade,一天其实也就2,3个好的机会,别去scalp,太累。找自己熟悉的股票,找自己熟悉的pattern,就光做他们,等你稳定赚钱的时候再出去闯荡。trust me,你进进出出几十次,不如你稳扎稳打一两次。


七)做好长久作战的准备。一个朋友很早前告诉我,炒股是个war,不是就一个battle。炒股是一个game of attrition。有多少人能大赚一把就洗手不干的。又有多少人叩见外婆一次,就不玩儿了的。所以,既然是长期作战,就不要一下子把精力都耗完了。累了,就歇一歇。作的不顺了,就歇一歇。另外,这个戒律也告诉我们,赚钱的策略要禁得起时间考验。


八)多看少动。一定得多看,图形看多了,就有直觉,比好多牛逼指标都牛逼。多看几个自己做的熟的股票,或者干脆只看大盘。即使你最近没时间炒股,也要一周看几次图形,知道市场在哪儿。自己看了,再看蛇大的报告,看看自己看到的和老大看到的差了多远。老大有的东西是统计上的东西,你得自己去整才能得到类似的结论,可price pattern却是人人看得见。想想为什么老大看到到,你看不到。慢慢的,你应该觉得老大的报告很亲切,因为跟你看到的差不多。如果你有时看了老大的报告高兴,有的时候看了老大的报告想扁他,那你还修行不够,接着做自己的青蛙。少动,前面已经说过了,不要过度交易。一定要做高盈率的trade。管得住自己的手!


九)要独立思考。青蛙们经常看见这个说的有道理,看着那个说的有道理。可人家两个人一个看涨,一个看跌。最后人家都赚了钱,你赔了双份的。我们看老大们的报告或是评论或是预测,不是让你跟风做,timing是everything,你跟着做的很难掌握 timing。还有就是,每个人的风险喜好,资金大小都不一样,你盲从,不是找死吗?高手说的是给我们学习的机会,要看别人怎么得到结论的,要学会critical thinking。归根到底,你得有自己的一套,所以不能跟着凑热闹。

十)做好本分工作。你要想股市赚大钱,你得把这当全职工作,全心全意的做,忘我的做。你要是没法做到,就安心做青蛙。大市大涨,你小赚,大市大跌,你小赔或是不赔。你的目标是beat大市一点点。你是青蛙,别想2X,3X的beat大市consistently。一个朋友告诉我,不要问what the market can do for you, ask what you did for the market?职业trader adds liquidity 给大市,你一次拿2000,3000 出来,一周做一个小时的homework,还想赚2X,3X。不管别人服不服,我就不服。你还是青蛙的时候,trading是个hobby,做好了,有supplemental income。做坏了,也不赔上老婆孩子还有厨具,歌照唱,舞照跳。不要每天忧国忧民,早上起来第一件事就看future。get a life, please。你赚小钱,受大罪,值得吗?值得吗?值得吗?