[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EquisMetaStock Group] Re: Expert Advisor Signals Run Amok



PureBytes Links

Trading Reference Links

Super,

A sincere thank you for the guidance. I downloaded the DLL from 
Equis, but when I select it is says ExtFml( "Latch.Latch", , , , ). 
I suspect I haven't found the right one yet, I'll keep looking. I 
appreciate the point in the direction. I was able to do the Trends 
entry like you suggested for now, while I work the other issue out.

I've had MetaStock now 1 year and am very much the newbie you make 
me out to be. I played with it until about May before I made my 
first trade. So far on an account of $30k, I'm up 15% or so. Capital 
preservation techniques, again learned through reading and studying, 
have probably saved me more over the past 2 quarters than anything. 
I've tried to research, read my manual (it fell into two pieces the 
other day, because of use), search the internet, read books, and 
try, try, try to language first. 

So far, I've found this the most valuable  resource.
I do see two types of folks posting here.
1. Please give me a formula to make me rich.
2. Please give me some guidance so that I may learn.

I'd like to believe that in my postings, I fall under Group #2. 
I've also noted the response styles of yourself, Preston, Steve, and 
Roy. Much is pointed out in ways to find the right answer, without 
actually giving it. Something about teaching a man to fish versus 
just feeding him. 

I'm also fascinated by how one question can lead to a discussion 
such as the Raw RSI the other day. I've duplicated the RSIr now in 
one of my indicators. For being so new, I haven't quite figured out 
how to apply it, but working on it.
I've also recreated what Steve was doing with the StochRSI entry and 
a SEB exit on a few stocks. Fascinating.

Here is a formula:

C> Mov(C,200,e) 
And
Sum(Security("E:\Metastock Data\Indices & Indicators\US & Canadian 
Indices\.VIX",(RSI(2))),2)>90
And
Open>Ref(Security("E:\Metastock Data\Indices & Indicators\US & 
Canadian Indices\.VIX",c),-1)
And
Sum(RSI(2),2)<30

I pulled this one from a narrative in a book I've read recently. 
Moving average above 200. 2 Period RSI of VIX>90. Today's VIX 
open>Yesterday's VIX Close. 2 Period RSI<30. I jumped around in joy 
when I finally got the Security reference in. Woohoo!
But, I can't seem to get it the formula to work. Wrong comma in the 
wrong spot? Maybe. I do appreciate bringing these things forward to 
the group for a review and comment. 

Thanks again. I'll keep working on things, and reading these posts.

Big

--- In equismetastock@xxxxxxxxxxxxxxx, superfragalist <no_reply@xxx> 
wrote:
>
> Latches and MS function language really don't have anything to do 
with
> intelligence per se. It's a matter of practice and understanding of
> what each of the MS functions do and the values they return. 
> 
> First from Roy, "A `latch' is a device that stores and holds, or
> remembers, a particular event or condition. A `binary latch' can be
> set to one of two values (normally zero and one but not necessarily
> so), while a `price latch' can be set to virtually any value one 
could
> think of. Each type has both advantages and disadvantages that 
will be
> mentioned as appropriate."
> 
> This is key. Right now on your chart you see multiple buy signals.
> Your expert is recognizing every buy event that is true, not just 
the
> first one. So it is not storing the condition when it first 
occurs. 
> 
> So you need to look at example 2. First you want to set the memory 
of
> the first buy signal. That's the set signal part of the code. The 
set
> signal is the buy formula. The reset is when the buy condition no
> longer exists. In other words you have a sell condition. There can 
be
> many buy signals that occur between the first one and when a sell
> signal is encountered. Once a sell signal shows up. It's game over.
> The next buy signal after a sell signal is the first one in a new
> sequence of buy signals. 
> 
> Once the first buy signal is hit, then you want the buy condition 
to
> stay true until a sell signal resets it. So each bar that the buy
> signal is still true on prevents MS from treating it as a "new" buy
> signal. 
> 
> set:=buysignal;
> reset:=sellsignal;
> Init:= Cum(set+ Reset>-1)=1;
> Trade:= BarsSince(Init OR Set)<BarsSince(Init OR Reset);
> Trade AND Alert(Trade=0,2);
> 
> Init means the set and reset signals are valid. It solves a problem
> with the BarsSince function returning an invalid response. 
Essentially
> the cum value is going to be =1 if a legitimate buy signal and sell
> signal has occurred in the past. 
> 
> How would you know that BarsSince can return a not valid signal?
> Intelligence! No, only experience with MS coding will tell you 
that.
> You get a few N/A screwing up your code, then you'll look for a
> solution and eventually you'll either quit out of frustration or
> you'll come up with some logic to get around the problem. Every 
coding
> language has problems. 
> 
> Next Trade says that if the bars since the first buy signal is less
> than the bars since a sell signal, then the sell condition remains
> true and is set to 1. The last line Trade and Alert means a buy 
signal
> must exist and it didn't exist on previous bars. In other words 
both
> conditions must be true to hold the expert in a buy state. 
> 
> Write your expert with this last bit of code in it. Code the buy
> conditions, usually buy:= whatever and sell:= whatever . 
> 
> Then set:=buy;
> reset:=sell;
> etc.
> 
> That will be your entry expert. Your exit expert is set up the same
> way except the exit or sell condition goes in the set and the buy
> condition goes in the reset for the exit expert. 
> 
> This one one kind of latch, or condition state code. Some types of 
buy
> signals require a different kind of condition state code. In 
addition
> there are other types of code which can hold a state condition as
> positive.
> 
> In addition on the MS forum there is a latch code dll that you can
> download. 
> 
> Here's the syntax for the latch in the Forum dll. The four 
parameters
> are Long Entry, Long Exit, Short Entry and Short Exit. I suggest 
you
> only use the first two and leave the "short" parameters at zero. 
The
> Forum.dll file is around 188-189KB. Pay attention to the size of 
the
> file to make sure you have the current version. 
>  
> ExtFml( "Forum.Latch", , , , ) 
> 
> I think the forum latch code should be built into the formula 
language
> and put in the manual. But so far it isn't. Unfortunately BP, if 
you
> want to use custom code in your experts, then you have no choice 
but
> to learn the basics. 
> 
> I have learned to write code that is sloppy and less than elegant, 
but
> it works. I don't worry too much about the MS function language
> because as I've said many times, making money trading never 
depends on
> programming complex formulas, etc. 
> 
> You'll get a little help for awhile on some of the forums. But 
once a
> newbie has had time to learn things for themselves, the help will 
dry up. 
> 
> Only a dozen or so people supply coding help on all of the forums 
so
> they remember who they've helped and how often. Unfortunately some 
of
> the newbie's think the people on the forums are saps and will code
> everything they want for them for free and forever. They don't 
want to
> do the homework and take the tests. They want someone else to do it
> for them, but they want the grade and the degree. 
> 
> So you and I have little choice but to struggle through this
> ourselves, and I can tell you I hate spending time coding MS. I 
have a
> large code library that I have collected over the years and 
basically
> I can piece most things together by looking at other formulas and
> doing some trial and error. 
> 
> I use very little code in my buy and sell formulas. They're pretty
> simple. Most of the code gets used in my analysis screens, but in 
the
> long run I think I would do just as well if I didn't use them. They
> give me some comfort emotionally and intellectually. 
> 
> They are a lot of newbies who make breathless posts wanting code 
for
> some magic formula they got from a guru of sorts. They often think
> that if they just had that code they would make money. Here's the
> bottom line. Equis can code anything. If there were formula's that
> they could put into MS that would help traders, especially new
> traders, make money, they would bust their butts to get those 
formulas
> into MS because sales would take off like a rocket. Instead they
> supply vague notions of systems that often can't be tested and that
> work well only when the market is in a strong trend. Why might 
that be? 
> 
> I hope this bit of latch code gets you where you want to be with 
your
> experts. All those signals are frustrating. I remember that time 
well. 
> 
> If you don't get it to work out, you can put your buy and sell code
> into the highlight tab in the expert. Color code the buy and sell
> conditions with a different color and as long as you have a buy
> condition your bars (or whatever) will remain that color. It's the
> same as getting one buy and one sell signal.
> 
> Super
> 
> 
> 
> --- In equismetastock@xxxxxxxxxxxxxxx, "Big Papa" <denver69692002@>
> wrote:
> >
> > Well, I thought I was a bit intelligent until I tried to read, 
re-
> > read and decipher the Latch article.
> > 
> > My hats off to Mr. Larsen for his intelligence. I've also looked 
on 
> > Equis under latches and Googled Metastock Latches which gives me 
> > several more various articles from Larsen.
> > 
> > Still struggling. I'd appreciate a guiding hand to push me a bit.
> > 
> > First, are the latches their own seperate indicator or are they 
> > built into the buy and sell alerts on the expert advisor?
> > 
> > 
> > Thanks.
> > 
> > 
> > 
> > --- In equismetastock@xxxxxxxxxxxxxxx, superfragalist 
<no_reply@> 
> > wrote:
> > >
> > > Look in the files section and download the Using Latches 
article. 
> > That
> > > will explain how to stomp out those unwanted buy signals all 
over 
> > your
> > > chart.
> > > 
> > > Super
> > > 
> > > 
> > > --- In equismetastock@xxxxxxxxxxxxxxx, "Big Papa" 
<denver69692002@>
> > > wrote:
> > > >
> > > > 
> > > > I am having issues with my expert advisor.
> > > > 
> > > > I have taken an indicator and dumped it into the expert 
advisor.
> > > > Such as sell when C>HHV(C,7).
> > > > It shows a sell sign at the right time, but then shows 
another 
> > sell 
> > > > sign each time that condition is true, regardless if a buy 
sign 
> > has 
> > > > generated or not.
> > > > So now, my charts look like 20 sell signs right in a row. My 
> > charts 
> > > > look like a neighborhood in foreclosure!! I could probably 
deal 
> > with 
> > > > it, but looks terrible.
> > > > 
> > > > Do I have to use the Write If function in the expert advisor 
to 
> > only 
> > > > have it show up once? It seems like I would need some logic 
to 
> > say If 
> > > > condition X, then sell, but then only show again if 
condition W 
> > (buy) 
> > > > is generated.
> > > > 
> > > > Thanks.
> > > >
> > >
> >
>



------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/equismetastock/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/equismetastock/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:equismetastock-digest@xxxxxxxxxxxxxxx 
    mailto:equismetastock-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    equismetastock-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/