New version 18 available now

Download software Tutorial videos
Subscription & data-feed pricing Class schedule

New account application Trading resources
Margin rates Stock & option commissions

Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Profile: jas0501
User Name: jas0501
Groups: Gold User, Member, TeleChart
Rank: Registered User
Real Name:
Gender: Unsure
Joined: Saturday, December 31, 2005
Last Visit: Friday, May 18, 2018 11:31:10 PM
Number of Posts: 2,498
[0.86% of all post / 0.55 posts per day]
Last 10 Posts
Topic: FYI:Backtesting overfitting article
Posted: Sunday, April 27, 2014 9:29:40 PM
While the literature on regression overfitting is
extensive, we believe that this is the first study
to discuss the issue of overfitting on the subject
of investment simulations (backtests) and its
negative effect...



Topic: Allocating more memory to realcode
Posted: Wednesday, February 05, 2014 4:21:03 PM

Converting from 32-bit to 64-bit is not just a matter of a recompile. The are numerous MS com controls that have not yet and will not be converted to 64-bit.  This requires installing the 32-bit version of MS Office if any of these controls are used.

I expect the 64-bit conversion  of Stockfinder may require simliar effort for its controls.



Here was my wish list back in N0V 2010 from

As to "we'll soon be working on StockFinder 5.1, which will tackle all documented BackScanner issues".   Can this list be published so that users may comment on omissions?

Never happened....

I know it is not policy to reveal features, except by release, however it would be good to know what the general game plan is for the backscanner. Is there any intention of supporting any of the following?:

1.     A way of saving the results that permits reconstruction or at least realization  of what the backscan rules were at the time it was run.

2.     Improved run to run results tracking

a.     Tabbed scan results, so that one can appreciate result improvements

b.     The ability to provide description with the scan results. Typically consecutive scans are run tweaking settings. There is no easy way to review multiples runs and appreciate what caused the improvements

3.     Money management with support for

a.     Tie breaker, for picking which trades to execute when multiple opportunities are presented

b.     Margin

c.     Minimum/maximum  setups per bar

d.     Minimum/Maximum trades per bar

e.     Maximum open trades

f.      Multiple Trade sizing models

4.     A standard template and support for user specified result templates. This would permit users to compute their own metrics as in Sharpe, Kelly, RAR,  etc. etc

a.     For scan results

b.     For MM results

c.     For optimization run summaries

5.     Intermediate results display of backscan results, to permit early termination if the results don’t look promising. This is particularly helpful when running long scans.

6.     Equity curve display during backscan

7.     Interruption of backscan with partial results retained

8.      Entry and exit @Price

9.     Realcode access to Trade information

10.   Saving backscan trade sets permitting running vai realcode post scan

a.     Money management studies

b.     Entry studies

c.     Exit studies

d.     Correlation studies

11.   For saved backscan trade sets, permitting additional indicator values to be associated with each trade. For example @ trade entry what various ATR values were.

12.   bars in Trade variable in realcode

13.   realcode Loop support for both backscan and Money Management  runs to permit optimization

14.   For optimization

a.     Multiple formats for stating variable values

                                          i.     A set, as in  [5,7,13,23,42]

                                         ii.    A stepped range, x to y stepped by z, as in (5 to 30 by 5)

b.     Realcode access to variable assignments.

15.   Standard IO for reading and writing results. This would permit post processing of run results and adjustments of parameters for scans or MM runs.

16.   Realcode support for multiple positions with scaling into and out of positions

Topic: pcf language
Posted: Wednesday, January 08, 2014 1:52:00 PM


also see

Open topic with navigation as mentioned at the end of the Personal Criteris Language page


Topic: LRS
Posted: Wednesday, January 08, 2014 1:39:54 PM

QUOTE (brihous)

How can I make indicators for price being above the linear regression slope 20(lrs) and another indicator with price being below lrs .  The lrs is already on my charts however when I try to create a condition with price history the lrs does not show up in the pull down.  I attempted to do it in real code however it keeps giving me expression error.  This is what I tried.


if price.close > # lrs then pass.


The expression error is the # lrs which is not a legal variable name.


Topic: export watchlist from realcode
Posted: Sunday, December 15, 2013 10:19:43 PM

Export a plot that just prints close on lastbar should give you something to work with


if lastbar then
    plot close


Topic: Does anyone have a good memory on when they began to learn stock trading?
Posted: Saturday, November 16, 2013 11:52:47 AM

There are the charts and the systems of infinite variety. The truely hardest thing to learn is to manage your psyche. Lack of impulse control and "if only" thinking can drain you enthusiasm and your trading account in no time.

  1. Find an approach the resonates with your personality. This is a never ending process.
  2. Experiece the mechanics of trading for x trades using the approach outlined below. 
  3. After x trades evaluate your performance and assess if you have the tempermant to be successful and that you can sleep and night and enjoy the process.
  4. Figure out what needs to change in order to improve.
  5. Approach Outline
    • candidate selection
    • plan the trade
    • trade the plan
      • position size
      • entry
      • exit
    • for each trade do post mortem alalysis

If you don't plan the trade, and trade the plan, then post mortem analysis is impossible. The hardest thing it to learn to control your own actions. Keep track of what you did and didn't do during the process and tally each category. Work on reducing the frequency of the top shortcoming and give yourself credit for the things you did right. Rinse and repeat.

A few mistake categories:

  • Entered without an exit strategy
  • Failed to exit per plan
  • Added to a bad position, hoping...
  • Didn't check the fundamentals
  • Forgot about the quarterly report or dividend
  • entered a position that didn't fully qualify ( volume, volatility, trend, etc.)
  • didn't do post mortem analysis
  • indecision on entry
  • indecision on exit
  • bought in a bad industry sector
  • changed the plan mid-trade
  • too many open trades
  • etc.
  • etc.
  • etc.


Topic: The basic of trading - how to find the regular stock ?
Posted: Sunday, November 10, 2013 4:39:20 PM

I'll confess I haven't closely read the entire thread. I do want to mention on point regarding "easy to see" versus "not so easy to program".

I'll use cup and handle as an example.  One can look at a chart and see the formation easily. The difficulty is that each cup and handle spans a different number of bars, so writing code that can recognize the formation is not easy. Visually out brains see the pattern without needing to consider the bar count. Programming the code "sees" a bar at a time and can remeber things, but pattern construction and recognition  is hard.


When defining the end points that defines the trend line, one needs to decide how many bars to consider, the width. One also needs to decide how long should that trend be considered relevant. If the end point  is x bars old is the trendline still applicable, or are the more recent events caring more weight than an "old" trendline.


Another point, often can  take a chart and draw historical trend lines and see how well the approach  "predicts" things.  One has a hard time quantify all the simlar trend lines that don't match the prediction. The viewer can easily see the goodness. Using stockfinder to keep score will provide the performance measure. Don't let these easy to see confirmations give a flawed approach undeserved merit.


An example of being tricked by the plot is the zig-zag plot which nicely points out tops and bottoms.  It is a flawed trading mechanism as the corners are defined by a percentage, which is a look ahead of n bars. Thus it depends on future information. This is often how the brain constructs potentially viable approachs when looking at historical charts. There is an unintentional look ahead. Encoding the rules and backtesting with Stockfinder will provide the win%.


Once Stockfinder gives you a viable approach, based on backtesting results, one last step would be to compare the results with the same number of random trades. A viable strategy needs to outperform random trades by a good margin. See for an example of this.


Topic: Debugging Support
Posted: Tuesday, November 05, 2013 8:18:24 PM

This might be it:: Accidental comment 
'sinceGap(i) += 1

For i As Integer = 1 To System.Math.Max(gapnumber, 1)  'Increments Sincegap here
    If Gapnumber = 0 Then 
        Exit For
    Else If Gapclosed(i) = 0 Then
        'sinceGap(i) += 1
        'Label = sincegap(1)=0
        'label = gapclosed(1)=0
        sincegap(i) = sincegap(i) + 1
       'Label = Sincegap(1) = 1
     End If
'Label = sincegap(1)=1


A couple minor optimization comments:

1. Avoid divides and multiplies when possible.
Replace MinGapPerc / 100 with gapSize

Dim gapSize as single

If isfirstbar
      gapSize = MinGapPerc / 100 
Else If (1 - Price.High / Price.Low(1)) >= gapSize And Price.High < Price.Low(1) Then


2. The only way the gapSize can be statisfied is if Price.High < Price.Low(1)  so you don&#39;t need to check if High is less than yesterday&#39;s low yielding a simplified expression

Else If (1 - Price.High / Price.Low(1)) >= gapSize then


Topic: "edit condition" not showing all "userinput" fields
Posted: Monday, November 04, 2013 2:32:49 AM

One approach would be to code multiples into a single parameter and then parse the values


# Parms = UserInput.string = "15:1:0:0:25"




Topic: Backtesting - Length of a test in order to be statistically significant
Posted: Monday, August 26, 2013 10:56:50 AM

see  Bband - with CCI break out scan. for code for generating random sample backtest. The idea being to pick a random stock and hold it for a fixed time based on the average hold time of the approach you a comparing.

The link using an 18 day hold and an ajusted percet of 0.55% to get the right amount of trades during the test period.


As to the length of test, an equally critical question is how many trades. For example a 5 year test against S&P500 resulting in 150 trades might be to thin a selection. If the criteria are tuned as you evolve the strategy some curve fitting might be ocurring, fitting the strategy to the data.

One approach is to split the data into to sets. One to develop/train the strategy and the other to validate it. There is an excellent book
       Evidence Based Technical Analysis by David Aronson  
that covers may asppect of validating strategies.

I prefer doing a fixed length trade random sampling over the same data to see what a monkey with darts would do. This approach captures the market bias that the market trend of the test period comtributes.

One would want performance that significanlty exceeded the random sample to feel comfortable with the strategy.


 Two more points:

1. Some times a strategy produces good results but the trades are bunched because of some market condition that matches the criteria. Then one could not take full advantage of all the trades as there wouldn&#39;t be enough capital to fully commit.

2. Long duration tests against market indices like S&P500 or Russel 1000 suffer from membership bias. A form of survivorship bias. The fact that a stock is listed on the S&P500 today indicates some level of success. If it was added during the backtest period, that is not in the list at the start of the backtest, with data for the whole backtest, one can assume that is will outperform the market duing the backtest.

Applying the strategy gouing forward does not have this advantage as one doesn&#39;t know what stock will be added and removed from the list in advance.