Monday, August 12, 2013
Friday, August 9, 2013
Wednesday, June 5, 2013
Monday, May 13, 2013
Monday, May 6, 2013
Python Snippet - Pearson Correlation function
def get_Pearson_Correlation(dataseries1, dataseries2):
result = 0.0
sum_sq_x = 0.0
sum_sq_y = 0.0
sum_coproduct = 0.0
mean_x = dataseries1[0]
mean_y = dataseries2[0]
for i in range(2,len(dataseries1)+1):
sweep = (i-1)/float(i)
delta_x = dataseries1[i-1]-mean_x
delta_y = dataseries2[i-1]-mean_y
sum_sq_x += delta_x * delta_x * sweep
sum_sq_y += delta_y * delta_y * sweep
sum_coproduct += delta_x * delta_y * sweep
mean_x += delta_x / float(i)
mean_y += delta_y / float(i)
pop_sd_x = (sum_sq_x / float(len(dataseries1)))**0.5
pop_sd_y = (sum_sq_y / float(len(dataseries1)))**0.5
cov_x_y = sum_coproduct / float(len(dataseries1))
result = cov_x_y / (pop_sd_x*pop_sd_y)
return result
Java Snippet - Pearson Correlation function
public class PearsonCorrelation {
public static double getPearsonCorrelation(double[] scores1, double[] scores2){
double result = 0;
double sum_sq_x = 0;
double sum_sq_y = 0;
double sum_coproduct = 0;
double mean_x = scores1[0];
double mean_y = scores2[0];
for(int i=2;i<scores1.length+1;i+=1){
double sweep = Double.valueOf(i-1)/i;
double delta_x = scores1[i-1]-mean_x;
double delta_y = scores2[i-1]-mean_y;
sum_sq_x += delta_x * delta_x * sweep;
sum_sq_y += delta_y * delta_y * sweep;
sum_coproduct += delta_x * delta_y * sweep;
mean_x += delta_x / i;
mean_y += delta_y / i;
}
double pop_sd_x = (double) Math.sqrt(sum_sq_x/scores1.length);
double pop_sd_y = (double) Math.sqrt(sum_sq_y/scores1.length);
double cov_x_y = sum_coproduct / scores1.length;
result = cov_x_y / (pop_sd_x*pop_sd_y);
return result;
}
}
Wednesday, April 24, 2013
Sunday, January 27, 2013
Saturday, January 26, 2013
Monday, January 21, 2013
List of Top 10 Trader Mistakes
- Failure to have a trading plan in place before a trade is executed.
- Inadequate trading assets or improper money management.
- Expectations that are too high, too soon.
- Failure to use protective stops.
- Lack of “patience” and “discipline.”
- Trading against the trend–or trying to pick tops and bottoms in markets.
- Letting losing positions ride too long.
- “Over-trading.”
- Failure to accept complete responsibility for your own actions.
- Not getting a bigger-picture perspective on a market.
10 Lessons From the Market Crash of 1987
2. Be like Buffett: Buy on the fear, sell on the greed
3. Make a crash shopping list
4. What goes up fast comes down faster
5. There’s no such thing as ‘it can’t happen’
6. Tune out the daily noise
7. Don’t bail
8. Don’t use the calendar to rebalance your portfolio
9. Bet with your head, not over it
10. Investors face greater risk now
Some David Rosenberg Rules to Remember
1. In order for an economic forecast to be relevant, it must be combined with a market call.
2. Never be a slave to the date – they are no substitute for astute observation of the big picture.
3. The consensus rarely gets it right and almost always errs on the side of optimism – except at the bottom.
4. Fall in love with your partner, not your forecast.
5. No two cycles are ever the same.
6. Never hide behind your model.
7. Always seek out corroborating evidence.
8. Have respect for what the markets are telling you.
9. Be constantly aware with your forecast horizon – many clients live in the short run.
10. Of all the market forecasters, Mr. Bond gets it right most often.
11. Highlight the risks to your forecasts.
12. Get the US consumer right and everything else will take care of itself.
13. Expansions are more fun than recessions (straight from Bob Farrell’s quiver!).
Some Warren Buffet quotes on investing and the stock market
Money Management: “In the 20th century, the United States endured two world wars and other traumatic and expensive military conflicts; the Depression; a dozen or so recessions and financial panics; oil shocks; a flu epidemic; and the resignation of a disgraced president. Yet the Dow rose from 66 to 11,497.”
The Business of Investing: “I always knew I was going to be rich. I don’t think I ever doubted it for a minute.”
The Investor Self: “It’s better to hang out with people better than you. Pick out associates whose behavior is better than yours and you’ll drift in that direction.”
Market Analysis: “Risk comes from not knowing what you’re doing.”
Routines: “The business schools reward difficult complex behavior more than simple behavior, but simple behavior is more effective.”
Stalking: “I don’t look to jump over 7-foot bars; I look around for 1-foot bars that I can step over.”
Buying: “Why not invest your assets in the companies you really like? As Mae West said, “Too much of a good thing can be wonderful.”
Monitoring Positions: “Rule No. 1: Never lose money. Rule No. 2: Never forget Rule No. 1.”
Selling: “Should you find yourself in a chronically leaking boat, energy devoted to changing vessels is likely to be more productive than energy devoted to patching leaks.”
Review: “If past history was all there was to the game, the richest people would be librarians.”
May 6th 2010 - Stock market flash crash videos
An euforic guy with his candlestick charts:
List of 17 General Trading Rules & Investing Lessons
- Establish your risk and stop loss before you hit the buy key.
- If it's worth trading, it's worth writing it down. Keep a journal.
- Embrace the "Law of Probabilities" and execute your system with consistency.
- Embrace technology and take it with you to track positions when you travel.
- Investing is a competition. Bring your "A" game mindset to the table every day.
- Yesterday's state of mind doesn't matter. The only thing that matters is today, here and now.
- Listen to the market. Focus on what the market is telling you, and don't concern yourself with trying to figure out why it's happening.
- Every trade should yield a key takeaway lesson.
- Stay true to your methodology and your system, not your emotions.
- Be brutally honest about your personal "enemies within" and deal with them. Know yourself.
- Procrastination and denial have no place in a trader's tool kit.
- Do not trade when you are discombobulated or out of equilibrium.
- Don't focus on the dollars. Focus instead on the execution of your trading methodology.
- Devise both a bullish and a bearish scenario for your equity when the market is closed.
- Never give back more than 50% of your profits on an equity.
- Selling is a solo inner struggle. Don't look for company.
- Never lose sight of your money management routines.