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

[EquisMetaStock Group] Re: 5 DMA-Close & 6 DMA-Open Crossover



PureBytes Links

Trading Reference Links

=====================
Khalid system signals
=====================
---8<--------------------------

{ Khalid system signals v2.0

 ©Copyright 2006 Jose Silva.
  For personal use only.
  http://www.metastocktools.com }

{ User inputs }
pds1:=Input("SMA periods for Close",1,252,5);
pds2:=Input("SMA periods for Open",1,252,6);
pds3:=Input("Entry delay periods",0,5,0);
pds4:=Input("Exit delay periods",0,21,3);
plot:=Input("Signals:  [1]Clean,  [2]All,  [3]Trade binary",1,3,1);

{ SMAs }
sma5:=Mov(C,pds1,S);
sma6:=Mov(O,pds2,S);

{ Entry conditions }
cond1:=Sum(C>sma5 AND C>sma6,3)=3;
cond2:=Cross(sma5,sma6);

{ Entry/Exit signals }
entry:=Ref(cond1 AND cond2,-pds3);
exit:=Ref(Cross(sma6,sma5),-pds4);

{ Remove ghost signals }
init:=Cum(IsDefined(entry+exit))=1;
bin:=ValueWhen(1,entry-exit<>0 OR init,entry);
long:=bin*(Alert(bin=0,2)
 OR entry*Cum(entry)=1);
short:=(bin=0)*(Alert(bin,2)
 OR exit*Cum(exit)=1);
signals:=long-short;

{ Plot in own window }
0;
If(plot=2,entry,0);
If(plot=1,signals,If(plot=2,-exit,bin))

---8<--------------------------


jose '-)
http://www.metastocktools.com




--- In equismetastock@xxxxxxxxxxxxxxx, "Khalid 
Masood" <dr_khalidmasood@xxx> wrote:

> 
> Hi Jose,
> 
> Thanks for your kind attention & devotion of precious time. I will 
> be obliged if exit mode,besides "cross(sma6,sma5)" allow input of 
> variable time periods, I mean that exit is triggered after 3 or 5 
> days & so on after cross(sma6,sma5)happening.
> 
> Thanks & best Regards
> Khalid
>
>
>
>
> --- In equismetastock@xxxxxxxxxxxxxxx, "Jose Silva" 
> <josesilva22@> wrote:
>
> To avoid possible confusion between entry & exit signals, I would 
> code the signals indicator this way:
> 
> =====================
> Khalid system signals
> =====================
> ---8<--------------------------
> 
> { http://www.metastocktools.com }
> 
> { User inputs }
> pds1:=Input("SMA periods for Close",1,252,5);
> pds2:=Input("SMA periods for Open",1,252,6);
> 
> { SMAs }
> sma5:=Mov(C,pds1,S);
> sma6:=Mov(O,pds2,S);
> 
> { Entry conditions }
> cond1:=Sum(C>sma5 AND C>sma6,3)=3;
> cond2:=Cross(sma5,sma6);
> 
> { Entry/Exit signals }
> entry:=cond1 AND cond2;
> exit:=Cross(sma6,sma5);
> 
> { Plot in own window }
> entry-exit
> 
> ---8<--------------------------
> 
> 
> jose '-)
> http://www.metastocktools.com
> 
> 
> 
> 
> --- In equismetastock@xxxxxxxxxxxxxxx, "Athena 
> Research" <athena.investments@> wrote:
>
> Hi Khalid,
> 
> Please take the following code as correct code as Close price was
> used with 6DMA in previous code. Sorry for posting wrong code.
> 
> cond1:= Sum((C> Mov(C,5,S)) AND (C> Mov(O,6,S)),3)=3;
> Cond2:= Alert(Cross(Mov(C,5,S), Mov(O,6,S)),3);
> 
> Entry:= cond1 AND cond2;
> 
> Exit:= Cross(Mov(O,6,S), Mov(C,5,S));
> 
> Entry; Exit
> 
> 
> 
> Thanks and Regards,
> Amit Trivedi
> President & CEO
> Athenasolutionz.com - "We sell hope, in the stock market."
>
>
> 
> ----- Original Message ----- 
> From: Khalid Masood 
> To: equismetastock@xxxxxxxxxxxxxxx 
> Sent: Monday, September 18, 2006 5:30 AM
> Subject: [EquisMetaStock Group] 5 DMA-Close & 6 DMA-Open 
> Crossover
>
>
> Hi,
>
> I want to code an indicator with following parameters:
>
> For Entry:
> 
> (1). Today's close is above (5day simple closing moving average & 
>   6day simple open moving average) for last three days.
> 
> (2). 5day closing moving average crosses above 6day open moving 
>   average.
> 
> For Exit:
>
> 6day open moving average crosses above 5day close moving average.
> 
> I have tried but unsucessfull,please help & thanks in advance.
>
> Regards
> Khalid







 
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/