Monday, July 25, 2011

Watch Google to test 52Wk high

Have you looked at the Google Stock Chart lately? It is ready to test its 52Wk high of $642.96 that it set in Jan 2011. RSI is over 75 already as of 25th July, 2011. RSI indicates Google is in Overbought condition. To read more about RSI, please refer my earlier post available at http://gupta-munish.blogspot.com/2011/07/read-stock-charts-and-improve-your.html. If google does hit a new 52-wk high, consider shorting it or buying the PUT options since it would look to correct itself at any bad news. Moreover, it has created a huge gap between $590 and $560. Once the RSI goes above 80, it would be a good time to buy PUT options at a strike price of $600 for Aug 11.



Saturday, July 23, 2011

Read Stock Charts and improve your winning


There are four components that make stock a winner
  • Fundamentals of the company like company management, business model, margins etc
  • Sector performance to which the stock belongs to
  • Market conditions like investor sentiment, market outlook
  • Technical Indicators that we will discuss
Each of the above four components carry 25% weight towards making a particular stock a 'WINNER' or a 'LOSER'

Technical Indicators, in my opinion, are the easiest to read and often result in profitable trades.
While there are hundreds of technical indicators, I will discuss the most basic and the most important. So, let us start and understand more about it.



















To generate free Stock Charts for any equities, visit http://stockcharts.com/

In the  above chart, there are few indicators to understand as below
1) Relative Strength Index: It is intended to chart the current and historical strength or weakness of a stock or market based on the closing prices of a recent trading period.The RSI is classified as a momentum oscillator, measuring the velocity and magnitude of directional price movements. Momentum is the rate of the rise or fall in price.The RSI is most typically used on a 14 day time-frame, measured on a scale from 0 to 100, with high and low levels marked at 70 and 30, respectively. Definition taken from http://en.wikipedia.org/wiki/Relative_Strength_Index
The point to note here is that when RSI gets over 70, it is known as OVERBOUGHT condition whereas when the RSI falls below 30, it is known as OVERSOLD.
OVERBOUGHT and OVERSOLD are good signals to EXIT and ENTER the trade respectively as his visible in the chart.

2) MACD: It is used to spot changes in the strength, direction,momentum, and duration of a trend in a stock's price.The MACD is a computation of the difference between two exponential moving averages(EMAs) of closing prices. This difference is charted over time, alongside a moving average of the difference. The divergence between the two is shown as a histogram or bar graph.
Exponential moving averages highlight recent changes in a stock's price. By comparing EMAs of different periods, the MACD line illustrates changes in the trend of a stock. Then by comparing that difference to an average, an analyst can chart subtle shifts in the stock's trend.
Since the MACD is based on moving averages, it is inherently a lagging indicator. As a metric of price trends, the MACD is less useful for stocks that are not trending or are trading erratically.
The point to note here is that when the MACD line crosses the signal line and starts moving up, that is a good time to ENTER the trade and vice-versa when the MACD line cross the signal line on the way down, that is a good to EXIT the trade.

3) Moving Averages: Moving averages act as SUPPORT and RESISTANCE for the price as shown in the chart. As you can see in the char, GOOGLE tried to cross 50-day MA from Mar 2011 to Mid June 2011 and it failed. 50Day Moving Averages acted as a RESISTANCE. But when it finally closed above 50DMA, it literally flew

So as you can see, technical indicators give us a lot of clues as to which direction the stock is headed. You can base your ENTRY and EXIT strategies based on these indicators and end up on the winning side.

Click http://www.stocktradingtogo.com/2007/04/30/stock-charts-understanding-the-basics/  to understand all the fields in the chart.

Have a question? Please leave a comment and I would be glad to answer.
If you find it useful, please feel free to share it with your friends and family.

Friday, July 22, 2011

How to track PeopleSoft Process Scheduler Requests

Someone ran a Process Scheduler request and as a PeopleSoft administrator, you want to find how to see that running in the database.

Here is a SQL statement to track the same.
select  b.sid,b.serial#,
prcsinstance,
prcstype,prcsname,
to_char(rqstdttm,'mm-dd-yy hh24:mi:ss') Start_Date,
oprid,
decode(runstatus,1,'Cancel',
           2, 'Delete',
           3, 'Error',
           4, 'Hold',
           5, 'Queued',
           6, 'Initiated',
           7, 'Processing',
           8, 'Cancelled',
           9, 'Success',
           10,'No Success',
           11,'Posted',
           12,'Not Posted',
           13,'Resend',
           14,'Posting',
           15,'Generated') "Status",
origprcsinstance
from PSPRCSQUE a, v$session b
where runstatus='7'
and b.process=to_char(a.sessionidnum)
and b.client_info is not null

Expect the output as shown below.

    SID SERIAL# PRCSINSTANCE PRCSTYPE                      PRCSNAME     START_DATE        OPRID                Status     ORIGPRCSINSTANCE
------- ------- ------------ ------------------------------ ------------ ----------------- -------------------- ---------- ----------------
    917    8093       502333 COBOL SQL                      SFPGRPST     07-22-11 10:27:56 CNYADM               Processing           502333
   1806   60301       502320 COBOL SQL                      SFPGRPST     07-22-11 07:09:33 CNYADM               Processing           502320
   2688   33914       502324 Application Engine             CU_C_115A    07-22-11 09:55:13 CNYADM               Processing           502324
   1732    7710       502338 Application Engine             CU_C082C_TAX 07-22-11 11:07:10 CNYADM               Processing           502338
   1728    5964       502338 Application Engine             CU_C082C_TAX 07-22-11 11:07:10 CNYADM               Processing           502338

So, just in one screen, you can everything that is running along with database session to diagnose further.

Here is another SQL to check on the history for a given Application Engine request.
select
prcsinstance,
prcstype,prcsname,
to_char(begindttm,'mm-dd-yy hh24:mi:ss') Start_Date,
to_char(enddttm,'mm-dd-yy hh24:mi:ss') End_Date,
oprid,
decode(runstatus,1,'Cancel',
  2, 'Delete',
  3, 'Error',
  4, 'Hold',
  5, 'Queued',
  6, 'Initiated',
  7, 'Processing',
  8, 'Cancelled',
  9, 'Success',
  10,'No Success',
  11,'Posted',
  12,'Not Posted',
  13,'Resend',
  14,'Posting',
  15,'Generated') "Status",
origprcsinstance
from PSPRCSRQST 
where
prcsname like '&process_name%'
and begindttm > sysdate-3
order by 1 desc

You can enter the process name and also change the data(sysdate-3) to whatever you need.
This will give you the history of the process for the last three days.

Enter value for process_name: CU_INTR_THRD
PRCSINSTANCE PRCSTYPE                      PRCSNAME     START_DATE        END_DATE          OPRID                Status     ORIGPRCSINSTANCE
------------ ------------------------------ ------------ ----------------- ----------------- -------------------- ---------- ----------------
      502368 Application Engine             CU_INTR_THRD 07-22-11 13:39:52                   CNYADM               Processing           502368
      502362 Application Engine             CU_INTR_THRD 07-22-11 12:16:29 07-22-11 12:54:54 CNYADM               Success              502362

Please leave a comment if you have any specific question. I would be glad to answer that.

Thursday, July 21, 2011

Want to invest in stocks but don't know where to begin?

About eight years ago, I was asking this myself. I wanted to invest in the stock market but just did not where and how to begin. With all the buzz words around, it is easy to get puzzled. With 24*7 news channel speaking of Armageddon every day, it is easier to get scarred as well. However, stocks by far offer the best returns than any other investment considering the initial investment.

The beauty about investing in the stock market that you can begin with as little as $100. You don't have to be a PhD. in finance to make money in the stock market. Yes, the market will go up and down but if you choose your investments wisely, you should be just fine.

It was just three years ago in Oct-Nov 2008 when it looked like the 'End of World' is near. Dow Jones was down to low 6k and S&P 500 index was down to 660. 
Instead of getting scared of these time, don't you wish you had bought GOOGLE then at $250 or APPLE at $78 or CHIPOTLE at $40. There are so many great names that were trading at unbelievable discount. Don't we go shopping at such huge discounts. 

The fact is that media makes more money putting a grim picture as more people tend to watch the news. But the news channels over blow the issue by talking about it day in day out like debt ceiling and European debt fears. When we hear the same bad stories over and over again, we tend to believe in it.

So, consider stock market an investment option just like fixed deposits, investment property, gold etc.

In order to begin investing in stock market, the first thing you need to do is open a Brokerage Account. There are numerous firms that you can look at like Fidelity, Scottrade, Etrade, Bank of America etc.
Once the account is opened, start funding your brokerage account. You may choose to transfer every week, every month or every quarter or whatever frequency you like but invest only the amount you can afford to loose. In order words, if you were to loose every penny in your brokerage account that should not affect your day-to-day expenses. INVEST not GAMBLE

Options are a wonderful investing tool. You can follow the below link to learn the basics on options.
http://www.cboe.com/LearnCenter/Tutorials.aspx

Some investment strategies for beginners 
  • Invest no more than 60% of your funds at any time. For example, if you have $10,000 in your account, invest $6000. Keep the remaining $4000 for times like Oct 2008 or Mar 2009 or May 2011 when the market undergoes deep correction. 
  • Have no more than 3-4 equities in your account at any time. It is very difficult to track news on your portfolio if you have more equities.
  • Be diversified. For e.g, Technology sector, Materials, Finance etc. You should never have all the equities in your portfolio from the same sector
  • Buy the share of the best companies in their field. Even if the big names like google, apple, J P Morgan, Mastercard go down with the market, they recover quicker than others. You are less likely to incur huge losses. 
  • Set your targets with every trade. Before placing a trade, you should have a target for entering and exiting both on the up and the down side. 
I hope this will alleviate your fears. So, consider giving it a try
    Have a quick comment or a question? Please post it and I would be glad to answer.

    Wednesday, July 20, 2011

    CPU utilization at 100%; What is killing the database

    More often than not as a System Administrator or as a DBA, we run into situations where the host machine is running at 100% used CPU or 0% idle cpu.

    It is vital to find the processes rather quickly that are chewing up the CPU. On Solaris, we can use
    prstat command that is excellent to report the processes in the sorted order.
    prstat -s cpu -n 10
    The above command shows the top 10 CPU consuming processes.

    If indeed it is the memory that is running out, you can tweak the prstat command
    prstat -s size -n 10
    The above command shows the top 10 memory consuming processes.
    Once we find the top CPU or memory consuming processes, we can map those processes to the actual database session to see what really is happening in those sessions.

    select inst_id,module,status,sid,serial#,username,last_call_et
    from gv$session where paddr in ( select addr from gv$process
    where spid = &spid and inst_id=&inst_id)
    The above RAC enabled command shows what those sessions are, given the process id from prstat command.

    This is a quick method to get a handle on the processes that are killing the host machine.

    Have a question? Please leave a comment and I would be glad to answer.

    Real Estate! What's not to like?

    Afraid of buying a house in this economy? Think you will get stuck in a downward spiral?

    • Historically low Interest rates
    • Abundant of properties to choose from
    • Affordable prices
    • Ever increasing rents

    So, Think Again.

    Let's run some numbers. 
    Let's say you are buying a house for $200K with a 20%($40K ) down-payment.Your annual real estate tax may be around 1.5%($3000) and lets keep another $300/month for HOA fee.
    Let us look at your monthly expenses now
    • Mortgage expense: 160000@5%(current rate) = $860/month
    • Monthly Property tax payment: 3000/12 = $265/moth
    • HOA fees = $300/month
    Put together, you will be spending $1425/month for a place of your own.

    If you are presently renting, you can easily expect to pay $1200-$1500/month for a similar house/condo/apartment depending on the location and amenities.

    Now let us go one step further and say you are going to live in same city for 5 years.
    Can you even imagine how much rent you would have paid in those five years?
    Let's do the numbers again.
    Monthly rent(Avg rent from 1200-1500)*no. of months*no. of years
    $1350*12*5=$81000 (whopping 81 thousand dollars going down the drain)

    Had you owned your place for 5 years, you would have spent

    $1425*12*5=$85,500 (Wow! this is more than renting)
    NOT AT ALL. LET US SEE HOW!
    Out of the $85,500 you spent, $51,600 went to your lender for your mortgage.
    Further, out of $51,600, your interest payment was $38460.85 that is subject Federal Tax credit on Mortgage Interest. So, you are sure to get something back from $38460.85
    This is the PROUD PART, In those 5 years, you build yourself a NICE EQUITY of $13074.03

    Out of remaining $33,900(85,500-51,600), You paid $15,000 in your property taxes that is again subject to Federal Tax credit.

    So, all in all you paid a lot less to OWN than to RENT

    With the economy recovering, you will certainly do fine. With all the EQUITY you would have built by then, your down-payment on your next house would be ready.

    This was the WORST-CASE scenario. On the brighter side, the REAL ESTATE is bound to recover sooner or later. You can't rent forever or can't live in your parents house forever simply because you will outgrow the space and would need some space of your own.

    Who knows if you let this opportunity go by and wait for a few more years, what would be interest rate or real estate prices.

    One piece of advise is that your total housing expense(whether owning or renting) should not be more than 30%-35% of own take home pay. Look for rental property and something to buy in that range and you will do just fine.

    If you want to discuss or have a specific question, please leave a comment and I would glad to answer to the best of my ability.

    Tuesday, July 19, 2011

    Growth Stocks

    I love high flying growth stocks. They are hugely volatile and that is the beauty about growth stocks. If entered into an equity at the right time, you can get huge returns but at the same time, a wrong time can result into huge losses in no time.

    Some of the high flyers I am watching

    Google: Just went up 25% with the earning or $125 in just 3 weeks
    Apple: Went up 25% with the earning or almost $90 in just 3 weeks
    Intitutive Surgical: Bounced higher after testing 50day support. Up $40 in 2 days with earnings.
    Chipotle: From $270 to $333 in just 3 weeks.

    As you can see, you can reap huge rewards with some great names if entered at the right time relatively quickly.
    Never PANIC in down market. Never sell your position as a result of fear or panic. Best days follow up just after down days.

    Enjoy these high flyers. Lock in your gains if you did enter the trade in any of the above before the wonderful earnings. STOP LOSS is the way to go right now.

    Monday, July 18, 2011

    Why is my SQL query taking forever to run?

    All of us must have been in this situation before.
    Why is SQL taking forever to run today? Until today, it was taking minutes and today it is running forever.

    This is the worst nightmare for a DBA. In this situation, the most likely scenario is that SQL is running with a different execution plan as opposed to when it was taking minutes.
    How do we find it out?
    The below SQL will give you all the child cursor for the SQL in question. Just pass the SQL id of the problem SQL. If you see multiple PLAN_HASH_VALUE for this given SQL, that means this SQL indeed has multiple execution plans. One of them being the efficient one that it had been using. 

    select
    inst_id,sql_id,plan_hash_value,child_number,executions,round(buffer_gets/executions,2)
    "buffer_gets/exec" , cpu_time/1000000 "Cpu Time(s)",round(rows_processed/executions,2) "Rows",
    elapsed_time/1000000 "Elpased Time(s)"  from gv$sql where
    sql_id='&sql_id'
     
    Once we know all the child cursors, run the below SQL to get the execution plan for all the child cursor and see why it is taking forever for this run.

    select * from TABLE(dbms_xplan.display_cursor('&SQL_ID',&child_cursor,'PEEKED_BINDS'))

    Just Pass the SQL id and the child cursor and you will be able to the execution plan.

    What is running in my database?

    Have you ever wondered what is running in the database at any given time and how to find it?

    Simply run the below SQL command on your Oracle Database. It will give tell who is running what. Yes, this is RAC friendly. You may need to format the output. This is very handy to have for a DBA to see the snapshot of what is running in the database. It is a good first step to diagnose any Performance issue.

    select  s.inst_id "Inst",s.sid||','||s.serial# sidserial,osuser,username,
       sql_id sql_id,
       module,
       substr(s.event,1,27) event,
       s.last_call_et "Wait", s.machine
    from gv$session s
    where status = 'ACTIVE'
    and event not like 'Streams AQ: waiting%'
    and event not like 'Streams AQ:%idle%'
    and s.event not like 'LNS%'
    and (s.event not like '%idle wait%')
    and  s.event not in ('PL/SQL lock timer','SQL*Net message from client','queue messages',
    'rdbms ipc message','Streams AQ: waiting for messages in the queue','smon timer','wakeup time manager','async disk IO',
    'pipe get','pmon timer','gcs remote message','ges remote message','log file sync','jobq slave wait','slave wait')
    order by module,sql_hash_value

    Sunday, July 17, 2011

    Sure, You can live debt free

    I never thought I would write something like this on the internet. Thanks to my sister, she motivated me to go online and share my thoughts with the outside world. Here I am writing my very first post.

    Do you ever wish of having financial independence? Do ever think of living debt free? Do you enjoy the life on credit?

    Well, life is certainly beautiful and too precious to fret over financial ruins and crisis. It is entirely in our hands to write or build our financial status.

    To get our financial house in order, we need to start distinguishing between needs and wants. We all know what needs and wants are. We can easily distinguish between them. All we need is discipline and will power to stay within our needs until the debt is paid off.

    In order to get there, we need to know what we are spending on. Lets list down all our expenses on a easy to locate and reachable place.  Every time we spend any money, it should be written down with the date, amount and type of expense like food, clothing, rent, mortgage etc. Once we know where and how much we are spending, it is easy to categorize the expenses. It is really surprising at the end of this exercise to see how much we are spending on items that we don't really need.

    It is not that difficult rather you can enjoy this process and in the process you are sure to learn a lot about yourself. So, lets start writing down our expenses...

    Credit Cards are not necessarily evil elements. You can really save money with credit cards. Just remember to use them like debit card. Spend only what you can pay in full and enjoy all the perks your credit card offers. Always check all the benefits your credit card offers and keep them in mind when in need. For instance, I was very upset when my laptop got stolen in NYC. Obviously there was no scope of getting it back. Fortunately, I had bought it on my credit card. I contacted my credit card, completed the paper work like forms, the receipts, police report etc and there you go, I got the amount credited on my account. I then bought even better laptop. 
    There are tons of credit card with 'NO ANNUAL FEE'. No need to pay the hefty fees if you are not going to use those extra features. You may want to check this out for all the great credit cards on offer.
    /http://www.creditcards.org/

    So keeping our financial health in tact in really in our hands. Spend wisely and remain disciplined focusing on needs. Make of prioritized list of your wants. Set the goal for your top priority 'want' and start saving for it. I am sure you will start appreciating the process and get your financial house in order.

    In the closing, I wish you and your family good financial health and I sincerely thank you for spending your valuable time with me.

    I will be back with more....