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

[EquisMetaStock Group] Re: Creating an expert advisor



PureBytes Links

Trading Reference Links

Ashish, below is your system signals indicator.

=============
Ashish system
=============
---8<-----------------------------

{ Ashish system trade signals v1.0

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

{ User inputs for indicator output }
pds:=Input("SMA periods",1,252,50);
plot:=Input("Signals:  [1]Clean,  [2]All,  [3]Trade binary",1,3,1);
delay:=Input("Entry and Exit delay",0,5,0);

{ SMA }
sma:=Mov(C,pds,S);

{ Bar crosses clear above SMA }
signalUp:=Cross(L,sma);

{ Breach of signal High }
signalHi:=ValueWhen(1,signalUp,H);
entry:=Cross(C,signalHi);

{ Bar crosses clear below SMA }
signalDw:=Cross(sma,H);

{ Breach of signal Low }
signalLo:=ValueWhen(1,signalDw,L);
exit:=Cross(signalLo,C);

{ Clean 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 }
Ref(If(plot=2,entry,0),-delay);
Ref(If(plot=1,signals,
 If(plot=2,-exit,bin)),-delay)

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


To reference the indicator's default signals in your expert advisor:

======
Trends
======
---8<------------------
y:=FmlVar("Ashish system","BIN");
buy:=y=1;
sell:=y=-1;
buy;
{sell}
---8<------------------


=======
Symbols
=======
---8<------------------
x:=Fml("Ashish system");
buy:=x=1;
sell:=x=-1;
buy;
{sell}
---8<------------------


If you are not sure about the necessary basics needed to implement 
the above, please consult your MetaStock manual and/or the MetaStock 
formula primer available from the files section.


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





--- In equismetastock@xxxxxxxxxxxxxxx, ashish gupta <loveashu_1@xxx> 
wrote:
>
> Hi all,
>    
>   I want to create an expert advisor/indicator in metastock.
>    
>   Buy Signal
>   Buy when a full bar is made above the 50 day Moving average
> (i.e. low of the bar should be above the 50 DMA) and high of that
> bar is breached.
>    
>   Sell Signal
>   Buy when a full bar is made below the 50 day Moving average
> (i.e. high of the bar should be below 50 DMA) and low of that bar
> is breached.
>    
>   I know how to write equation for the bar above/below 50 DMA 
>   For Buy - Low > Mov(C,50,S)
>   For Sell - High < Mov(C,50,S)
>    
>   but i dont know what and how to add the breach condition in the
> above formula.
>    
>   Please advise me how to do create this expert advisor.
>    
>   Thanx
>    
>   Regards,
>   Ashish Gupta
> 
> 
> Ashish Gupta
> 9810046324








 
Yahoo! Groups Links

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

<*> 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/