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

RE: [EquisMetaStock Group] Re: Coding request



PureBytes Links

Trading Reference Links

Preston

 

Thanks.  Why do you say that I am using a daily indicator?  The code is the
same isn't it?  I actually want a 30 week EMA.   My chart is opened to
weekly charts.

 

I also use a TradeSim function to ensure that the testing is based on the
first bar after the signal's close.  This is simpler than using the Ref
function in Metastock.

 

 

John

 

  _____  

From: equismetastock@xxxxxxxxxxxxxxx [mailto:equismetastock@xxxxxxxxxxxxxxx]
On Behalf Of pumrysh
Sent: Wednesday, 8 November 2006 9:35 PM
To: equismetastock@xxxxxxxxxxxxxxx
Subject: [EquisMetaStock Group] Re: Coding request

 

John,

You're not sounding ungrateful at all...inquisitive yes. That's okay 
though since part of learning is asking questions.

Make sure the signals are what you are looking for by plotting it on 
a chart first before you go to the trouble of testing. I think the 
signals using your code will fall a day late.

Just noticed that you are asking for weekly EMA breakouts and using 
a daily indicator. You'll need to resolve that first.

The basis for a lot of TA follows around looking at todays close 
versus the close of some time ago. In essence a MACD does this. It 
is a 12EMA minus a 26EMA. The ROC is the difference between todays 
close and yesterdays close. Elegance is in the eye of the beholder.

Preston

--- In equismetastock@ <mailto:equismetastock%40yahoogroups.com>
yahoogroups.com, "John Nicholson" 
<johnnic@xxx> wrote:
>
> Preston
> 
> 
> 
> Thanks. At the risk of sounding ungrateful for your advice (which 
I'm
> certainly not) may I ask my original question again? I want to 
test the
> following trading plan.
> 
> (1) The 30 week EMA breaks out from a downtrend or sideways 
trend and
> commences to trend upwards.
> 
> (2) Once it has trended upwards for two weeks in a row, buy.
> 
> (3) Provide a buy signal once and once only.
> 
> 
> 
> My current coding, amended after reading Roy's comments, for the 
entry is:
> 
> 
> 
> C > Mov(C,30,E) AND 
> 
> (Mov(C,30,E) > Ref(Mov(C,30,E),-1) AND
> 
> Ref(Mov(C,30,E),-1) > Ref(Mov(C,30,E),-2) AND
> 
> Ref(Mov(C,30,E),-2) < Ref(Mov(C,30,E),-3));
> 
> 
> 
> My questions are:
> 
> 
> 
> (1) Will that code produce the result I want?
> 
> (2) Is there a more elegant way of producing the exact same 
result?
> 
> 
> 
> As an aside, I have been playing with the effect of adjusting the 
decision
> based on the slope of the uptrend indicated in the first two weeks 
and there
> seems to be some potential there.
> 
> 
> 
> Regards
> 
> 
> 
> John
> 
> _____ 
> 
> From: equismetastock@ <mailto:equismetastock%40yahoogroups.com>
yahoogroups.com 
[mailto:equismetastock@ <mailto:equismetastock%40yahoogroups.com>
yahoogroups.com]
> On Behalf Of pumrysh
> Sent: Wednesday, 8 November 2006 2:56 PM
> To: equismetastock@ <mailto:equismetastock%40yahoogroups.com>
yahoogroups.com
> Subject: [EquisMetaStock Group] Re: Coding request
> 
> 
> 
> John,
> 
> Suggest that you follow Roy's advice and plot the 30MA on a chart. 
> Then apply the indicator in another window. The signals from my 
code 
> and your code will not agree. Question is which one do you want? 
At 
> least I believe you're headed in the right direction now though.
> 
> good luck,
> 
> Preston
> 
> --- In equismetastock@ <mailto:equismetastock%40yahoogroups.com>
> yahoogroups.com, "John Nicholson" 
> <johnnic@> wrote:
> >
> > Preston
> > 
> > 
> > 
> > Thanks for your response. A couple of responses to your
> > suggestions/questions.
> > 
> > 
> > 
> > (1) Yes, I did want the last line to be Ref(Mov(C,30,E),-2) <
> > Ref(Mov(C,30,E),-3)). I want to enter a trade when the 30 week 
> EMA turns
> > upward out of a downward trend. The way (I think) I have written 
> the code,
> > I will get a buy signal when the stock's EMA moves upwards two 
> weeks in a
> > row having previously been trending down.
> > 
> > (2) I see your point about the problems with ANDs and Ors. 
> That is why
> > I enclosed the first line - (Cross(C,Mov(C,30,E)) OR C > Mov
> (C,30,E)) -
> > with brackets. I wanted to ensure that either of these 
conditions 
> would
> > operate with the other conditions. Will that work?
> > 
> > 
> > 
> > I will try your code in Explorer and then run it through 
TradeSim 
> to see if
> > I get the same results.
> > 
> > 
> > 
> > Thanks muchly
> > 
> > 
> > 
> > John
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > _____ 
> > 
> > From: equismetastock@ <mailto:equismetastock%40yahoogroups.com>
> yahoogroups.com 
> [mailto:equismetastock@ <mailto:equismetastock%40yahoogroups.com>
> yahoogroups.com]
> > On Behalf Of pumrysh
> > Sent: Wednesday, 8 November 2006 12:18 PM
> > To: equismetastock@ <mailto:equismetastock%40yahoogroups.com>
> yahoogroups.com
> > Subject: [EquisMetaStock Group] Re: Coding request
> > 
> > 
> > 
> > John,
> > 
> > Did you want the last line to be
> > Ref(Mov(C,30,E),-2) < Ref(Mov(C,30,E),-3));
> > or
> > Ref(Mov(C,30,E),-2) > Ref(Mov(C,30,E),-3));
> > which matches the rest of your code?
> > 
> > One of the problems I see is the use of and/or arguments. 
placing 
> > them together will result in problems since metastock doesn't 
know 
> > what should be "or" versus what should be "and". Easier to 
> seperate 
> > them as I have done below. 
> > 
> > A:=Mov(C,30,E);
> > B:=Sum(A>Ref(A,-1),4)=1;
> > D:=(C>A) OR Cross(C,A);
> > B AND D
> > 
> > Also note that I have summed the reference of todays MA to 
> > yesterdays and done it over the last 4 days. Controversial but 
it 
> > will work. I am sure others will weigh in on this as it could 
> still 
> > be done differently.
> > 
> > Preston
> > 
> > --- In equismetastock@ <mailto:equismetastock%40yahoogroups.com>
> > yahoogroups.com, "johnnic1948" <johnnic@> 
> > wrote:
> > >
> > > Does anyone have any helpful suggestions?
> > > 
> > > --- In equismetastock@ <mailto:equismetastock%
40yahoogroups.com>
> > yahoogroups.com, "johnnic1948" <johnnic@> 
> > > wrote:
> > > >
> > > > Would someone please be kind enough to confirm that the 
> > following 
> > > > simple code does what I want it to do?
> > > > 
> > > > If the closing price crosses above the 30 week EMA or is 
> already 
> > > > above the EMA, and the EMA has turned upwards, then.....
> > > > 
> > > > The code I have written is:
> > > > 
> > > > (Cross(C,Mov(C,30,E)) OR C > Mov(C,30,E)) 
> > > > 
> > > > AND
> > > > (Mov(C,30,E) > Ref(Mov(C,30,E),-1) 
> > > > 
> > > > AND
> > > > Ref(Mov(C,30,E),-1) > Ref(Mov(C,30,E),-2) 
> > > > 
> > > > AND
> > > > Ref(Mov(C,30,E),-2) < Ref(Mov(C,30,E),-3));
> > > > 
> > > > Even if it is correct, is there a more elegant way of 
> achieving 
> > > the 
> > > > same end?
> > > > 
> > > > Thanks
> > > > 
> > > > John
> > > >
> > >
> > 
> > 
> > 
> > 
> > 
> > [Non-text portions of this message have been removed]
> >
> 
> 
> 
> 
> 
> [Non-text portions of this message have been removed]
>

 



[Non-text portions of this message have been removed]



 
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/