PureBytes Links
Trading Reference Links
|
Thanks nenapacwanfr.
I was thinking of something like below , but i dont think its what
i want.
A=Foreign( "XAO", "Close" ) ;
b=PDI(14)>MDI(14) AND ADX(14)<PDI(14) AND ADX(14)>Ref(ADX(14),-1)
AND ADX(14)>15;
Cc=IIf(b,1,0);
dd=IIf(b==1,Foreign("all","Cross(C,MA(C,1))"),0);
ee=IIf(dd,1,0);
AddColumn(C,"c");
Filter=ee;
Buy=ee;
Sell=Cross(MA(C,5),C);
I am Using the crossing of a ma and c only for an easy anylysis
on the charts.
I dont know how to place the index in another window so
I opened ami twice and sized each program so i could view the
index and the stock i choose after running a back test.
It looks as if it is only placing a buy when the formula of the index
is true.
I need to really figure out how to have both windows of the index
and stock open in the same program to do a more accurate comparison.
the lines of code( up to the cc=) must be doing something to the
rest of the code because there are many ma crossings that dont
trigger probably due to this part of the index code.( or has it
ignored the actaul index and only using the adx code on the stocks i
am testing)
I dont know what i am doing and dont know if this test actually
is only buying a stock when the index rule is true.( but it is doing
something).
this code below is what i used for the index only( and i used it on
a second ami prog i opened) and after running a back test compared it
to the combined test
A=Foreign( "XAO", "Close" ) ;
b=PDI(14)>MDI(14) AND ADX(14)<PDI(14) AND ADX(14)>Ref(ADX(14),-1)
AND ADX(14)>5;
Cc=IIf(b==1,1,0);
Filter=Cc;
AddColumn(C,"c");
Buy=cc;
Sell=Cross(MA(C,3),C);
thanks.
peter.
--- In amibroker@xxxx, "nenapacwanfr" <nenapacwanfr@xxxx> wrote:
> Hi,
>
> perhaps you can use rel perf
>
> A slightly more advanced version of Relative Performace Chart is a
> baseline version that displays the performance of several
securities
> compared to one "base" security (in the example below this is
^DJI) -
> showing exactly what stocks outperform or underperform the base
> stock/index. The formula for the baseline relative performance
chart
> is as follows:
>
> /* Baseline Relative Performance charts
> ** with ^DJI as a base line
> ** AFL implementation by Tomasz Janeczko
> **
> ** Use Automatic scaling, Grid: Percent, Limits, Middle
> **
> ** This example plots 4 lines
> ** bold red - currently selected ticker
> ** blue - DJIA - Base Line
> ** black - IBM
> ** green - MSFT
> ** you can of course change the tickers as you wish
> */
> maxgraph = 4; // as many as you wish to use
> startpoint = 10; // the start point of comparision will be 10th bar
> // here is a base line
> price = foreign("^DJI", "C");
> baseline = 100 * ( price/ValueWhen( cum(1) == startpoint, price ) -
> 1 );
> price = close;
> graph0 = 100 * ( price/ValueWhen( cum(1) == startpoint, price ) -
> 1 ) - baseline;
> graph0style = 4;
> // base line chart (flat line)
> graph1 = baseline - baseline;
> graph1style = 1;
> // you can change the ticker below
> price = foreign("IBM", "C");
> graph2 = 100 * ( price/ValueWhen( cum(1) == startpoint, price ) -
> 1 ) - baseline;
> graph2style = 1;
> // you can change the ticker below
> price = foreign("MSFT", "C");
> graph3 = 100 * ( price/ValueWhen( cum(1) == startpoint, price ) -
> 1 ) - baseline;
> graph3style = 1;
> graph3color = 6;
>
>
>
>
> > This is a good question as i too would like to know how to do
this.
> > Is it possible to only have stocks that may be choosen by the
ROC
> or
> > other sys to compare against an index only if the index is rising
> by
> > using an adx formula or similar.
> > I am fairly new to ami and dont understand the capabilities
of
> > ami yet.
> > I can create a custom index but the results when looking at
> the
> > chart are very choppy and has eratic short price jumps from 1
> extreme
> > to the other.
> > The prob is how can i use a custom or even the normal index
as
> a
> > base ( but only a base when it is in a rising trend) then only
when
> > the formula of the index is true will it then seek to buy stocks
> > from whatever group of stocks you choose.
> > I would like this as an exploration, and also to backtest all
> the
> > qoutes.
> > I would think this is impossible as it would probably have to
be
> > done in 2 steps and save the index results in a separate watchlist
(
> > but i dont think you can save a watchlist of the index or any
other
> > stock that has the history with only the individual date ranges
or
> > true results after running a formula e.g. ADX)
> > In this case it would only have stored the ranges of the index
> > after running an ADX formula.
> > so then i can compare all the stocks or certain groups against
> this
> > broken index knowing it will only buy if the index has a rising
> trend.
> > If there is any other way to do this can someone please be
> helpful
> > and post a formula or the way to do this in a basic explanation.
> >
> > sorry if this is a stupid question.
> >
> > Thankyou
> >
> > peter.
> >
> >
> >
> > --- In amibroker@xxxx, "mik954" <mik-u@xxxx> wrote:
> > > Hi,
> > >
> > > Did you try to store Exploration results in Watch List and then
> > > caclulate the results using back-test for this list?
> > >
> > > Mike
> > >
> > > --- In amibroker@xxxx, "witold_dabrowski"
<witold_dabrowski@xxxx>
> > > wrote:
> > > > Hi,
> > > >
> > > > I want back-test a trend-following system who watch an index
to
> > > > determine trend. When the trend is found, system ranks the
> stocks
> > > > from index and choose one the best. The buy-signal is
> generated
> > > only
> > > > for this stock. Exit signal is generated with 'ApplyStop()'
> > > function.
> > > >
> > > > I have troubles with programming buy signal. It's simple to
> watch
> > > > cross-over on the index, but how to tell to AmiBroker to buy
a
> > > stock
> > > > XYZ? For this moment I see only one solution: write this as
> > > > Exploration (it's simple) and calculate the results of back-
> > testing
> > > > mannualy...
|