Ask Sunny

Got a question about Trading? Technical Analysis? Coding strategies in TradeStation, MultiCharts, NinjaTrader, Genesis Navigator or MetaStock?

Ask it here. If I don't know the answer, I'll research it for you.

EMail Address:
First Name:
Last Name:
Day Phone:
Your Comment or Question:


Questions and Answers:


PART 1 9/28/14 1:47pm:

I have a question on CPC formula:
My understanding is that:
CPC Index = PF * % Profitable * (Avg Win/Avg Loss)
...but my confusion is this: 
Since PF already = (W% * Avg Win)/(L%*Avg L), then isn't there redundancy in 2 places? I mean doesn't PF already include in its own formula the "% Profitable" as "W%/L% ?
Similarly, isn't Avg Win/Avg Loss in the CPC formula redundant too since PF already includes "Avg Win / Avg Loss"?
Thanks for helping set me straight on this. I really appreciate your time. -Bob B.

PART 2 11/14/14 3:19pm

Thanks for your response.
Can you elaborate just a little re answer 1:
I didn't understand your answer. Maybe you could put it a different way?  thanks. Also, I wasn't sure what you thought about the redundancy I pointed out. Thanks for clarifying.




Thank you Bob for corresponding.
I always appreciate hearing from my readers.
1. Yes, there is redundancy in the formula. And if you will work it out all the way there ends up being squares of products in it. That’s the beauty.
2. Yes, I still use 1.2 as my cutoff and have for many years.
3. I know of no other code or formula that incorporates your other factors.



Hi Sunny, I've started reading you book and I have a few comments. I've only made it thru the first 20 pages. Here are three observations.

1. I was under the impression that we were going to use the same data set for the charts. Thus I downloaded your DISdata from your Web page and imported it. DISData spans from 02/20/2008 to 02/19/2010 Fig 2.2 spans from 11/NN/2009 to 08/nn2010 Fig 2.12 spans 12/NN/2009 to 01/NN/2011 In other words I can't reconstruct your FIg 2.2 and 2.12 charts with the file I was instructed to download. Furthermore it's confussing why the date range was changed in Fig 2.12 from what it was in Fig 2.2 **************************************************************

2. On page 20 (last sentence before Step 6) you state that my chart should look like 2.12 with the moving average in subgraph 2. There were no instructions in the text that would have directed the MOV AVE indicator to subgraph 2. (I figured out how to do it - but that's not the point). ***************************************************************************

3. Also in Chart 2.12 - I would have expected your moving average indicator to be called sjh Mov Ave ... not the one ***************************************************************************************

IF my comments are off base - or you're not interested - just let me know - abnd I won;t send anymore.  I'm a slow reader so it may be a few more days till I send more.

Thanks - Iraklis iraklis@knology.net


Thank you for your comments.

In your Subject Line you put TS ME instead of TSME.
In your first sentence you put "you" instead of "your."
In your second sentence, you forgot the comma after "Thus."
In your fourth sentence you forgot the comma after "Furthermore" and you spelled "confussing" instead of "confusing."
Next, I never say MOV AVE I use MOV AVG instead.

I spent 12 years getting TSME into publication. It was a huge project and a labor of love.
Mistakes are easy to make and easy to criticize.

The publisher asked for many charts over again, and I had to go with the data I had at the time of the request, under a tight deadline.

Apparently you are not intimately familiar with just how difficult the publication process is, and how difficult it is to write a book  of 746 pages.

I'm sure you can go through TSME with a fine tooth comb and criticize every page. Thanks, but I'm not interested.

The book is done. I did my best. I'm working on another book now, with all my heart, to best inform my readers. On this new one, I am also doing my best.

That's all I can do.



"Great website.  I have considered developing a formal system versus my discretionary day trading (5+ years) but get hung up about:

  • If I have someone help me develop a system & the system is good - then I have disclosed the system which reportedly causes systems to fail. ?
  • Similarly, if my broker sees my account increasing regularly won't they follow the account trades or hack my system ?
  • Also, won't the market maker try to a shake the system out ?
  • How valid are these concerns for day trading versus swing trading ?"

-John O.



All good questions. I had the same questions 20 and 30 years ago.

What I have found is that no matter how many contracts I trade, I'm still one of the little guys. My broker doesn't really care to follow my trades. I'm never going to be PruBache, or John Templeton, or even Monroe Trout.

Your broker might, I say might, congratulate you and might even ask how you're doing so well. But, that's even rare. They have lots and lots of customers and they don't follow any particular one. If you end up doing so well that someone follows your work, well congratulations. What usually happens is that people do well and then hit drawdown, do well again and then hit drawdown again. No one wants to follow you into that.

And, if you program your system in TradeStation or MultiCharts or MetaStock -- any of the programs, really -- you can lock the code and they won't be able to hack it.

What you really need to know is that you will have to continually develop new and better systems over the years. The market is always changing. As you develop and change systems, neither your broker nor anyone else in the market will know you have changed systems.

They really don't care.

Q Sunny,
I am reading your book :Getting Started in Trading: to investigate trading as a career; I am scheduled to be laid off from my data analyst job because of a merger at the end of March. What software do you now consider to be the best help with trading options? How about with regular stocks? May I connect with you here on LinkedIn?
Henry C.
A Henry:
I use TradeStation and MultiCharts. They are very similar products, but each has something the other does not. Both work well with stocks, options, futures, ... whatever.
I would caution you about trading in an environment where you "need" to have money. Trading is risky and nerve-wracking to say the least. But when you need to make money to live off of, the pressure is so high, and it's difficult to sustain over periods of drawdown.
Q I followed your presentation on MultiCharts today. What numbers did you want me to give you, to get a trial of your indicators?
(Click here to see the MultiCharts presentation slidesthemselves.)

I need the User ID. It is found by going to Help > About > and sending me the User ID.

Here's what it looks like:





I noticed this afternoon that my DMA program triggered a reversal from long to short OJ.

It indicates that it triggered from last Friday’s close…though it only showed this today.

Any ideas????


I tried everything I know to get TradeStation to replicate the situation.

I gave it one day at a time on End Date and it all looks the same.

Sometimes the closing price of a symbol continues to update after the close. In fact, more than sometimes. All the time.

So, prices continue to come it and the calculations, if they were close, continue to update and change.
That’s why you want to build slippage into your thought process.

Stuff happens.
You’ll never get the prices that your system gets.
Real life prices and fills will differ from system prices.


I wanted to know why my losses were going up as the market was going up. I should show profit as the market is going up shouldn’t I? -Carol P.


If you are doing it right, as in you have properly done your backtesting and come up with the proper optimization numbers for your system,
then, you should be making profits in Long trades when the market is going up and profits in Short trades when the market is going down.

You won’t automatically make profits when the market is going up and losses when it’s going down. That assumes a Long-Only system.

Q How much money do I need to trade 4 contracts of the EMini? -Don T.

For the EMini S&P 500 contract, the minimum margin requirement is currently about $5,000 at most brokerages. It changes as the market goes up and down in volatility.

I like to have twice the minimum margin in my account, for each contract I'm trading.

While it is true that the overnight margin is much more than the daytrading margin, IGNORE that. Use the larger value.

So, $5,000 * 2 is the minimum I would use. Then, 4 contracts times $10,000 would be $40,000 in your account to trade 4 contracts.

If you use less than this, you'll be sorry.


Here's a telephone conversation I had today with a potential client.
Q So, what's so good about your DMA system? It don't seem any different from XAverage or MACD. Those are available for free in TradeStation. So what's so good about yours? It seems to get in late and the others seem like better, sooner entries. - Dan A. 20111229
A I spent 3 years working on the mathematics to avoid whipsaw in my trading. I found that whipsaw is far more important than getting in at tops and bottoms. I can't argue it with you, Dan, if you can't see it. Run the optimizations on the code I sent you, and see which one performs better. I think you'll be surprised at the performance statistics.
Q So, performance. What does that mean? Where do you find that?
A Go up to File and pull down to View Performance Report. (And the conversation went on like this for the next 10 minutes. Then I finally said:) I think you need a little bit of consulting time, Dan. If you can't afford me, then call TradeStation and ask them to show you how to find Performance Statistics and how to run an Optimization.
In frustration, I am creating the three charts showing the difference between MACD, Exponential Moving Average and my SunnyDynamicMovingAverage (SDMA). They are presented below. Take a look for yourself. Here is one week trading a 5-minute chart of the EMini.

MACD Chart & Performance:


XAverage Chart & Performance:


Sunny's DMA Chart & Performance:


It speaks for itself.


Q Where is the MoneyMentor Blog?
A Just click here and you'll be taken directly there.

Q So when you say learn everything about a company you really mean about its price behavior over time, while keeping in mind its fundamentals.
A Rather, I say learn everything about the way a SYMBOL trades. I don’t really care about the company.

What I care about 1st is it liquid enough to trade? Is there enough volume? Do enough trades happen per day in this symbol?

Then second, what time interval is its rhythm in? Is it in 1-min, 15-min, daily, weekly, or what?

All symbols have their rhythm. Maybe it’s even in range bars, or ticks. Maybe 100 ticks.
You have to determine the rhythm of each symbol.

Then, what’s it’s PHW? How many and how wide are the swings?

Then, watch how fast the moves form.

Things like that.

Always be asking “What is true?”

Q You like to use CrossLoop to communicate with us. I'm having trouble installing it. Can you help me?
A Sure. Be happy to. Click here to go to the documentation. (UPDATE: as of 1/1/2012 I prefer to use TeamViewer. It is also in the documentation.


As I reviewed the slide presentation you gave recently for TradeStation, a couple of titles perked my interest. The particular slide, number 6 in the PDF file, indicated the articles were available on www.MoneyMentor.com. After scurrying around the web site from page to page, I was unable to locate the articles. Would you email file copies of the articles listed below?

  • From No System to a Proven System in Three Well-Defined Steps
  • Clustering Effects of Good Optimization
  • Testing, Testing, 1, 2, 3…

Thank you.

A I have LOTS of articles available for you. They are in this website at Articles & Editorial. Just click the link.

Q We were reviewing your note on Ralph Vince that references page numbers with explanatory notes. We were not successful in finding the source the page numbers refer. Would you kindly tell us which text or texts of Vince’s work you are referencing?
A The references are to pages in Ralph Vince's "Portfolio Management Formulas."

Q I keep trying to login to your VantagePoint forecast, but it won't take me to the forecast. What am I doing wrong?
A Please refresh the MoneyMentor pages often. (You can press F5) I add and revise pages daily. If you don't clear the cache, or refresh the page, my updates will not show up. There was a bug in the link to the forecast, but I have now fixed it. You must refresh the page, or even the frame, to access the new changes.


Hi Sunny. I just got done reading you "Electronic Day Trading 101." It's the first book I've read on trading. I learned so much more than what I expected trading to be. Most people (even me) think trading is like gambling. After reading your book, I realized it is a profession. I am going to continue my journey to becoming a successful day/speed trader.

I do have one question. I heard to actually trade as a day/speed trader, I need to open a trade account with a minimum of $25,000. Otherwise I am only able to trade a stock every 3 days. Is this information true or I'm I mislead? Thank you. –Fuad A.



Yes, you need $25,000 to open a meaningful, tradeable account. You will have losses. And if you don't leave room for the losses, you will continually have to put more money in your account. One must start slowly. People think they want to be successful within the first few months. I doesn't happen. It takes about 3 years to get good at trading. I remember when I first started, 30 years ago, thinking that I didn't have 3 years. I needed to be good right then. But, the 3 years came and went, and I finally caught on.


Hello Misses Harris,

I have started tradestation made easy , I have learnt some easy basics but rest is too hard for me . What can I do to learn easylanguage coding in an easier way ? – Sinan A.



I wrote "TradeStation Made Easy!" with the novice TradeStation user and novice programmer in mind. There are no books that I know of that present it any easier than mine does.

Perhaps you would like to consider some personal mentoring or programming lessons. Please feel free to contact me. (760) 908-3070.




Thanks for everything today.  If I'm traveling and not near my computer, do I still have to be logged into my TradeStation account for the automation to work?  Please advise.



OMG YES! Computers crash; they lag; they lose data; TradeStation goes down; a trade can be missed and from then on all the trades following are wrong .... Lots of stuff.

You must still watch it even if it's on Automatic.

Automatic is just a way to take your emotions out of it, not a way to crank out money with no work.



05/23/2011 from James H.:

Just finished your book "Getting Started in Trading". Need more info on canned trading systems. Only possibly good ones.


Regarding your question about trading systems: Boy, don’t I wish I knew the answer to that!

I’d have everyone in the world be rich.

I'm writing a new book, "Grading the Gurus", which explores & examines the trading systems of famous gurus and systems' designers. We'll see in time what that brings. I'll be commenting on chapters as I write them on my website at Gurus. Keep coming back for more information.

Over the years I’ve tried just about every canned trading system, and I have lots of opinions, and lots of losses to show for it.

The only trading system I ended up using, and making money with, is my own, which I developed over 18 months of 18 hours a day 7 days a week research. That was back in the ‘80s.

It’s still working and I'm still using it, I’m happy to say.

Basically, it’s very hard to follow a canned trading system. Or anyone else's system. When it goes into drawdown, and they all do, the user gets scared and gets out – with losses. And then when it starts winning again, the user doesn’t get in again until it’s nearly at the top of its game, and it’s time to start losing again. And so the story goes.

Do you have TradeStation?

If so, I’d be happy to show you my trading system and let you try it for a week. Then you can see what I’m talking about.



Dear Sunny,

I recently picked up your book "TradeStation Made Easy". I am a newcomer to programming and even more so to EasyLanguage. I have been working with financial markets for the last 9 or so years with the intial four or so years, spent primarily as a fundamental investor / analyst. However, over the last five or so years, I developed an inclination towards technical analysis and that too towards quantitative trading strategies. But then as a poet to programming, I did not venture towards coding my systems into some kind of programming systems. Instead, I stuck to Excel. And which is what I have been using for the last five or so years as my programming tool!

Then I recently came across TS in search for a better tool and then located your book as a way to learn it. It is an excellent book and I am extremely thankful to you for putting it together. I am approaching you with a problem that has developed into a programming block for me. I am trying to code a system that uses two different EMA crossover systems - one uses two daily EMAs and the other uses two weekly EMAs. i have found it easy to code it in excel but I am just having a real hard time trying to code it as a strategy within TS. the problem is that coding this requires for me to set two different timeframes within one strtaegy - one for calculating the daily EMAs and the other for calculating weekly EMAs. and then I need to revert back to the dailies to see if a trade is triggered on any specific day.

Could you kindly help me with this. I would very much very appreciate your help with this. Any guidance will be a great help.



I would be happy to help you.
Would you like me to

  1. teach you how to do it yourself
  2. do it for you
  3. or do it for you and teach you what I did?

Options a and b would be $200. Option c would be $300.