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

[Metastockusers] Re: Buy, Sell Signal



PureBytes Links

Trading Reference Links


Bernard, try this MS system signals indicator:

===================================
System trade signals - Long & Short
===================================
---8<------------------------------

{ Example of breakout system trade signals }
{ +1 signal   = Long entry  }
{ -1 signal   = Long exit   }
{ -0.5 signal = Short entry }
{ +0.5 signal = Short exit  }

{ Do not trade this system - code example only }
{ ©Copyright 2004 Jose Silva }
{ For personal use only }
{ http://users.bigpond.com/prominex/pegasus.htm#metastock }

{ User inputs }
pds1:=Input("Entry Long EMA periods",2,252,21);
pds2:=Input("Exit Long EMA periods",2,252,10);
pds3:=Input("Entry Short EMA periods",2,252,7);
pds4:=Input("Exit Short EMA periods",2,252,15);
delay:=Input("Entry and Exit delay",0,5,0);
plot:=Input("Signals:  [1]Clean,  [2]All",
 1,2,1);


{ Long entry logic example }
LongIn:=Cross(C,Mov(C,pds1,E));

{ Long exit logic example }
LongEx:=Cross(Mov(C,pds2,E),C);

{ Short entry logic example }
ShortIn:=Cross(Mov(C,pds3,E),C);

{ Short exit logic example }
ShortEx:=Cross(C,Mov(C,pds4,E));


{ Clean Long signals }
Init:=Cum(LongIn+LongEx>-1)=1;
InInit:=Cum(LongIn)=1;
flag:=BarsSince(Init OR LongIn)
 <BarsSince(Init OR LongEx)+InInit;
LongSignals:=(InInit AND Alert(InInit=0,2)
  OR flag AND Alert(flag=0,2))
   -(flag=0 AND Alert(flag,2));
Long:=Ref(If(plot=1,
 LongSignals,LongIn-LongEx),-delay);

{ Clean Short signals }
Init:=Cum(ShortIn+ShortEx>-1)=1;
InInit:=Cum(ShortIn)=1;
flag:=BarsSince(Init OR ShortIn)
 <BarsSince(Init OR ShortEx)+InInit;
ShortSignals:=(flag=0 AND Alert(flag,2))
 -(InInit AND Alert(InInit=0,2)
   OR flag AND Alert(flag=0,2));
Short:=Ref(If(plot=1,
 ShortSignals,ShortEx-ShortIn),-delay)*.5;

{ Plot in own window }
0;Short;Long

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

jose '-)


--- In Metastockusers@xxxxxxxxxxxxxxx, "Bernard Ng" <bernieng@xxxx> 
wrote:
> 
> Dear Sir/Madam,
> 
> How can i create an indicator with the buy, sell, short and buy to 
> cover signal into it.
> 
> For example, 
> 
> If my buy signal is C>10 day EMA, sell signal is C<10 day EMA
> and my short signal is C< 20day EMA and buy to cover order C< 15day 
> EMA.
> 
> I want to create the indicator with signal(eg Arrows) for the 
> signals.
> 
> Thanks
> 
> 
> Bernard Ng





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/zMEolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

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

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

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