PureBytes Links
Trading Reference Links
|
Bill,
I am suggesting both a System Test as well as multiple Custom Indicators which you can use in an Exploration. The optimization has
to be done in a system test. When I run optimizations, I want to see the distribuition of my results to be "clustered." For example,
using the built-in Equis system of "Equis - Directional Movement w/Opt", you are optimizing the length of the PDI() and the MDI(). In
the results, I would sort by the period. Say the maximum return occurs at length = 17. I would want to see a successful result at 16
and 15 and 14 and 13 as well as 18 and 19 and 20 and 21. Not as profitable, but at least positively correlated.
So, I can do that part quickly in a System Test. Then, if successful over two or three securities, I would want to expand that to a
portfolio of securties, say the S&P500 using the multiple custom indicators in an Exploration. Then I can immediately see the results
across a broad range of stocks.
Continuing with the "Equis - Directional Movement w/Opt" example, I would create the following custom indicators: (I'm using the
following as an example, you can probably see ways to shorten and make this code more efficient, but I'll leave it as is to show all of
the steps)
INDICATOR1(Your formula)
Length:=17;
POS:=PDI(Length);
NEG:=MDI(Length);
POS;NEG
INDICATOR2
Y:=FmlVar("INDICATOR1","POS");
Z:=FmlVar("INDICATOR1","NEG");
Long:=Cross(Y,Z);
Short:=Cross(Z,Y);
INDICATOR3(Your market position)
A:=FmlVar("Indicator2","Long");
B:=FmlVar("Indicator2","Short");
If(Barssince(A)<=Barssince(B), 1,If(Barssince(B)<=Barssince(A),-1,0)
Indicator4(Your equity line)
Cum(If(Fml("Indicator2")=1,(Open-Ref(Open,-1),If(Fml("Indicator2")=-1,-1*(Open-Ref(Open,-1)),0)))
I would recommend that as you create each Custom Indicator, you plot it against a sample security to make sure that the timing is
correct. i.e. as you stop and reverse, you will probably want to use Ref(A,-1) instead of A. This would correspond to setting the delay
to 1 in the system tester. Also, the Equity Line assumes that you trade on the open; you can easily substitute the Close or some
predetermined entry value.
Now, you can create an Exploration with INDICATOR4 as one of the columns and quickly see the equity performance across your
portfolio of stocks. Then, you can change "Length:=17;" to 18 or 20 in INDICATOR1, and run the exploration again to get the results
for that value. You can repeat this for as many values as you like. (I copy the exploration results into Excel to do my summary
statistics).
If you've created a template or expert using your INDICATOR1, 2, 3, or 4 to draw the entry arrows and plot the PDI() or MDI(), it will
change also as soon as you adjust "Length:=17;" in your INDICATOR1.
Bill, I hope this example helps to answer some questions. I am happy to keep going with the detail, or if you want we can make it
more specific to your system.
Dave Nadeau
Fort Collins, CO
12/20/00 11:59:00 PM, "Bill Irwin" <Bill-Irwin@xxxxxxxx> wrote:
>Thanks for the excellent information Dave. Now to see if I understand it.
>
>> There is a faster way. You'll need to use a very structured approach.
>
>Being a programmer I should be able to handle this... 8^)
>
>> Start with a custom formula with three lines which are
>> something like this:
>>
>> LineA:=<time period one>;
>> LineB:=<time period two>;
>> LineC:=<time period three>;
>> Mov(C,LineA,S); Mov(C,LineB,S);Mov(C,LineC,S)
>
>I'm using something very similar to this in my System. The Enter Long is:
>
>Short:=Mov(C,opt1,S);
>Medium:=Mov(C,opt2,S);
>Long:=Mov(C,opt3,S);
>Long > Medium AND
>Short > Medium AND
>Ref(Short,-1) < Ref(Medium,-1)
>
>Are you talking about this being a custom Indicator or a System? I think
>you mean System because of your reference to OPT1, OPT2, etc. I have an
>Indicator called Triple Moving Average, which is:
>
>Short := Input("Short Moving Average", 1, 1000, 5);
>Medium := Input("Medium Moving Average", 1, 1000, 15);
>Long := Input("Long Moving Average", 1, 1000, 75);
>Mov(CLOSE, Short, S);
>Mov(CLOSE, Medium, S);
>Mov(CLOSE, Long, S);
>
>> You can later change these to OPT1, OPT2, and OPT3 in your
>> system test.
>>
>> Build your next formula based on the first, and give signals
>> for enter, short, exit, etc. as 1,2,3,4 or something like that.
>
>This is where you lost me. Build the 2nd formula where? Base it on the
>first, how? Do you mean to use fml("Triple Moving Average")? Are these the
>column formulas in an Exploration?
>
>> Then a third formula(Indicator3), based on the second, would
>> use Barssince(<your long signal>)<Barssince(<your short signal>) AND
>> Barssince(<your long signal>)<Barssince(<your exit signal>) =
>> 1 for long or =-1 for short and =0 for out.
>
>Here you're saying if the amount of time since I went long is shorter than
>the last time I went Short or Out, then I'm in a Long position and return
>+1, right?
>
>> Then you can create a fourth custom indicator based on this,
>> the equity line. This one says, Cum(If(Indicator3=1,Open-Ref(Open,-
>> 1),If(Indicator3=-1,-1*(Open-Ref(Open,-1),0).
>
>If I'm Long subtract the prior day's Open from the current day's Open and
>add this difference into the accumulator. Otherwise, if I'm Short subtract
>this difference from the accumulator, else add zero. This will keep a
>running total of the change in stock price, with an increase when the price
>increases and I'm Long, and a decrease when the price drops. When I'm Short
>and increase on a drop in price and a decrease on a rise? Am I on track?
>
>> Now you've got four indicators based on those three variable
>> definitions which are easy to change. You can run an
>> exploration with
>> this equity line to guage the performance across a portfolio
>> of stocks.
>
>Am I creating four custom Indicators here and using the name of the first
>one in the second, and the name of the 2nd in the 3rd, etc.?
>
>> You can write an expert that is based on the formulas and a
>> template. Your arrows for exits and entries as well as the lines
>> themselves will adjust whenever you go back to adjust those
>> three first lines of the first indicator.
>
>It seems that you're telling me to build custom Indicators, but I've read
>that when a custom formula is referenced, which has multiple plots, only the
>last one is returned. I'm confused about how I'd be able to use the first
>Indicator to have the second one based on it.
>
>> You can also run a new exploration once you've adjusted those
>> three values in the formula. You can do this as many times as you'd
>> like.
>>
>> I hope this explanation makes sense. I'm happy to clarify.
>> It is quicker, but still has some manual steps.
>
>I'm glad you're willing to clarify because, as you can see, I'm very green
>with MS and still need the obvious things included in any explanation.
>Sorry if this is more than you contemplated when you replied. You have me
>very intrigued about how this would work - especially for screening through
>large numbers of stocks to glean those that are cycling nicely so I can test
>different values to optimize. I suspect that I'm going to find that the
>optimal values for one stock are not the optimal values for another stock.
>What I think I'm looking for is a set of values that does reasonably well on
>many stocks, but not all, but I could be wrong on this.
>
>I hope there's some value in this thread to other readers. Thanks again
>Dave.
>
>Bill
>
>>
>> Dave Nadeau
>> Fort Collins, CO
>>
>> 12/20/00 10:53:21 AM, "Bill Irwin" <Bill-Irwin@xxxxxxxx> wrote:
>>
>> >Thanks Frans & Steve for the suggestion. Maybe if I'd more
>> fully explained
>> >what I'm doing perhaps another method is available, and
>> would be better.
>> >I'm working on a System that's based on this triple plot.
>> I'm going to be
>> >optimizing the values of this triple MA and, after the test,
>> observe the
>> >most profitable scenario.
>> >
>> >What I'd really like is for the System tester to plot the
>> triple MA (in 3
>> >colours) along with the Buy/Sell/Exit signs so that I can see the MAs
>> >crossing at these triggers. As it is, it appears I'll have
>> to apply the
>> >Triple MA Coloured Template, then adjust the lengths of the
>> MAs to match the
>> >winning System (after digging into the winning System to see
>> the values of
>> >OPT1/2/3 in a window that can't be sized to avoid the extra
>> step and time of
>> >scrolling). This doesn't make for a speedy review of a
>> given System across
>> >many charts. Of course, having to run the System test on
>> each individual
>> >chart (rather than on a selection, as in an Exploration) is
>> what really
>> >takes the time.
>> >
>> >If there's a faster way of doing this, please advise, and
>> thanks again.
>
Dave Nadeau
Fort Collins, CO
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
|