PureBytes Links
Trading Reference Links
|
--- In amibroker@xxxxxxxxxxxxxxx, "brian.z123" <brian.z123@xxx> wrote:
>
> PS
>
> For the record.
>
> Is there any info around that you know about that explains how to
do
> MCS in AB now?
One function you may find useful is below:
function MCOSGets(Mu, SD, Distr)
{
Dir="Y:\\Amibroker\\ExcelFiles\\RandomNrsNormDist.csv";
//"Y:\\MathCad\\Amibroker\\ExportCSV\\RandomNnrs.csv";
osInitialize();
ImportTable = osTabCreate();
//osTabAddColumn("Teller",1,ImportTable);
osTabAddColumn("RR",1,ImportTable);
osTabImport(Dir,",",ImportTable);
NrRows = osTabGetRowCount(ImportTable)+1;
RanInd = round(Random()*(NrRows-1));
RCh[0]=0;
for (n=0; n<LastValue(BarCount);n++)
{
nrstandev[n] = osTabGet(RanInd[n],Distr-
1,ImportTable);//Zero-based !!!
RCh[n] = Mu[n] + nrstandev[n]*SD[n];
}
osTabDelete(ImportTable);
return RCh;
}
Basically, it uses the OSAKA plugin to randomly read randomly
generated numbers (in "RandomNrsNormDist.csv") with which I then hit
the volty of the series. You obviously first need to generate the
random numbers in the csv, but Excel can do that for you (as you can
read, I also use Mathcad, because it allows me a larger number and
more flexibility in terms of the (theoretical/empirical)
distributions.)
As you can imagine, you can use this function very flexibly, and
choose which expected return/volty you wish. By choosing your
distribution (usually normal, but it can be anything) you can
generate new (even stress-tested) return-series.
Another function I subsequently use then multiplies these series with
a choosen startprice in order to generate the new price series. These
then form the sample of prices based on alternative histories on
which I run my backtests.
I was planning to file these, but knowing TJ will shortly introduce
his MCS, I can't be bothered.
>
> I haven't rushed at it as I can do it externally if necessary via
> Compuvision, RiskAmp (Xcel based) or MSA Analyser.
>
> I am actually not a true believer in MCS although not a disbeliever
> either.
> It is the best that I am capable of at the moment but I can't quell
> the desire to do better.
>
> One of the things I am trying to prove or disprove is whether the
> general population profile generated by MCS will in fact only be a
> duplicate *image* of the sample data with it's profiling statistics.
> My hypothesis is that I should be able to calculate all of the
stats
> I need for the greater population of unknown trades, without the
> need to run MCS.
> This would be a timesaver.
> Also no matter how many times we run simulations we can *never*
> predict the future.
> We are only looking to acquire the probalities for the future
> datasets.
> Can't we derive them from the sample stats without MCS?
>
> I realise that this is an intuitive and naive view of sample
> distribution but I am looking to the published academics to confirm
> or deny the theory.
I've also added some comments to the feedback centre along these
lines: as you know, there is first of all a difference between
bootstrap and MC simulation. Most discussions on this board deal with
bootstrap, i.e. randomize the series of trades. Second, it is true
that the statistics (parameters) of the aforementioned price series
are similar, i.e. drawn from the same (theoretical) distribution.
However, the price paths aren't, and that's what many use for their
signals. This becomes particularly relevant for the outliers of the
assumed distribution. For example, if you would use the infinite-
variance Levy distributions of Mandelbrot (again, see Taleb) there is
a higher probability of extreme events. When they take place, the
estimated parameters change only modestly, compared to those of the
log-normal distribution which are much more sensitive to stress. FYI,
this is why the options Clearing Corp uses this distribution for
margins. When did the option-smile/skew start to appear,
counterintuitive to the BS-model? After the crash of '87.
>
> I would love to hear your stories about Capra without boring
> everyone else.
> An email is on the way.
I'll mail you an alternative one if it isn't working.
>
> Thanks kindly.
Pleasure, but now I've written enough to keep me in credit for a
month or so.
>
> BrianB2.
>
>
> --- In amibroker@xxxxxxxxxxxxxxx, "vlanschot" <ecbu@> wrote:
> >
> > quanttrader714,
> >
> > Q for you:
> >
> > Not knowing the other settings, let's assume the system shows
> > promising results over the IS-period (otherwise why bother
testing
> > further). Let's further assume that the risk/return profile(s) of
> the
> > underlying series is fairly stable over time. Is there not
already
> a
> > natural bias in the fact that the number of trades, regardless of
> IS
> > or OOS, is inticately linked to the aforementioned profile, i.e.
> the
> > expected return, simply because we assume "1 history"? Therefore,
> > having buy-signals drawn "randomly" but benchmarked to the number
> of
> > trades in the OOS-period doesn't give you an unbiased view of the
> > system versus chance?
> >
> > FAC, I'm not criticising you. I realize your suggestion is meant
> as a
> > quick test, but I would suggest to extend it via MCS: generate
> > simulated price-series (stress-tested or not), thus generating
> > hundreds of "alternative histories" and apply one's system to
> these.
> > All this can already be achieved in AB now, although TJ is
> planning a
> > native MCS-functionality.
> >
> > PS
> >
> > (For Brian: unfortunately Capra hates the markets [see his
> > book "Hidden Connections"]. Tried to explain things to him. He
> didn't
> > want to listen. Suggest private e-mail if you want to know more).
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "quanttrader714"
> > <quanttrader714@> wrote:
> > >
> > > This is OT on psychology but a while back I believe you were
> asking
> > > about statistics and trading? Here's a very simple statistical
> test
> > > that can be run using AB alone. This simplified example will
> > estimate
> > > the strength of a "long only" system's entries. Long and short
> > > systems and exits are a bit trickier but the principle is the
> same.
> > >
> > > Run an *out of sample* (OOS) system backtest. Save the
results.
> > Note:
> > > OOS only!
> > >
> > > Add the following line of code to specify the number of
> iterations.
> > > I'd run 1000 or more but as few as 100 will still give a crude
> > > estimate.
> > >
> > > Iterations = Optimize("Iteration",1,1,1000,1);
> > >
> > > Replace the system's buy condition with the following code but
> leave
> > > the original settings, sell condition and stops in place.
Tweak
> the
> > > value in the Buy line (0.975 in this case) so the number of
> trades
> > is
> > > approx. the same number as in the original OOS backtest. BTW, I
> > > personally wouldn't be comfortable with this procedure unless
> the
> > OOS
> > > backtest has at least several hundred trades.
> > >
> > > Buy= Random()>0.975;
> > >
> > > Optimize over the OOS period. Sort results by the metric you
> want to
> > > analyze. The fraction of optimized results that is greater
than
> or
> > > equal to the OOS backtest metric is an estimate of the
> probability
> > > that one can do as well as or better than the original system
> entry
> > by
> > > chance alone. Of course no matter how good the results,
there's
> no
> > > guarantee of future profitability. But this is an easy way to
> get a
> > > decent estimate of how much better than chance your OOS metrics
> are.
> > >
> > > --- In amibroker@xxxxxxxxxxxxxxx, "brian.z123" <brian.z123@>
> wrote:
> > > >
> > > > Thanks to the silent majority for your patience with me on
the
> > > > Psychology included in this topic.
> > > > Right at the moment I can't see myself raising the subject
> again,
> > > > not in this forum anyway.
> > > >
> > > > My next series of posts is all hardcore trades and code; I
> > promise.
> > > > I have started testing the bearMonday Calender Affect and I
> will
> > > > post the results as a training project.
> > > > If there is a valid trade in there I am likely to publish it,
> but
> > > > don't hold your breath.
> > > > While, as a project it has some interesting features, I don't
> see
> > > > anything to get excited about so far.
> > > > The results will be posted in a new topic: *Calender Effect*;
> > maybe
> > > > next week.
> > > >
> > > >
> >
> ********************************************************************
> > > >
> > > > Trading Psychology follows.
> > > > Includes material suitable for advanced students only.
> > > >
> > > > I need to redress the omission of an important point and I
> will
> > also
> > > > offer a short explanation to help with practical application.
> > > >
> > > > Referring to the visual mnemonic.
> > > >
> > > > The universal energy (white space)is the same within and
> without
> > > > except that which is within the area bounded by the mnemonic
> is
> > that
> > > > portion commanded by the individual.
> > > > Great men perform great acts in the world by way of the
amount
> of
> > > > energy at their disposal.
> > > >
> > > > The visual image implies that this is brought about by an act
> of
> > > > dedicated focus based on supreme will power.
> > > >
> > > > Energy is a matter related to the heart.
> > > > If you don't have enough that is where to start looking.
> > > >
> > > > The symbology contained in many popular books is often
> incorrect
> > or
> > > > of academic interest only.
> > > > The true symbology for Erebus is the circular *Snake that
> > swallows
> > > > its own tail*; an ancient Cosmological symbol.
> > > > Symbols can have several meanings, depending on their use,
> rather
> > > > like signs in some Asian languages.
> > > > In this case it refers to perpetual circular motion.
> > > >
> > > >
> > > > Practical examples:
> > > >
> > > > 1. Should the goals set be achievable goals?
> > > >
> > > > Your goals should match your dreams and beyond.
> > > > Hitch your wagon to a star.
> > > > If you reach for the stars and fall short you may still grab
> hold
> > of
> > > > the moon on the way down.
> > > >
> > > > 2. How can we ever expect to reach *pie in the sky* goals?
> > > >
> > > > Assess with total honesty where you are now in comparison to
> > where
> > > > you intend to be.
> > > > What resources do you command? mentally list the pluses and
> > minuses.
> > > > Then start with a step by step plan to reach the first
> attainable
> > > > stage that you can see up ahead in the distance.
> > > > Work to build on your strengths and eliminate your weaknesses.
> > > > Don't look beyond the first stage; the gulf between you and
> your
> > > > goals will act to deter you if you do.
> > > > Only look (plan) one stage ahead at a time.
> > > >
> > > > Hold on to your dream (goal) the way a drowning man or woman
> > > > clutches at a lifebuoy.
> > > > Don't let go no matter how rough the weather.
> > > >
> > > > 3. Won't it be psychologically damaging if I set an
impossible
> > dream
> > > > and then fail?
> > > >
> > > > Not at all.
> > > > Not if you gave it your best shot.
> > > > I have never meet one single person who isn't happy with that.
> > > >
> > > > It is common for people to hitch their wagon to the wrong
star.
> > > > Once this becomes apparent it is better to accept this and
> change
> > > > stars.
> > > >
> > > > Life also changes; relationships, health, family, work and
> many
> > > > other issues can force us to abandon or postpone a dream.
> > > > If this is the case accept your destiny with humility, not
> > rancour.
> > > >
> > > > Trading itself has no more or less intrinsic value than
> thousands
> > of
> > > > other things we could do with our lives.
> > > > The true value lies in the character it builds and the habits
> of
> > > > success that it engenders.
> > > > They are portable and will serve us well anywhere.
> > > >
> > > > *Great Honour* to the venerable Confucius, LaoTze; *The Way
of
> > the
> > > > Tao*.
> > > >
> > > > Fritjof Capra?
> > > >
> > > > BrianB2.
> > >
> >
>
Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.13.27/517 - Release Date: 11/3/2006
|