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

[EquisMetaStock Group] Re: Indicator Code for Fixed ATR Initial Stop



PureBytes Links

Trading Reference Links


Try something like this:

===================================
Initial Stop - Date & Price inputs
===================================
---8<-----------------------------------

{ Initial Stop based on Date & price inputs.
  http://www.metastocktools.com }

{ User inputs }
price1:=Input("Purchase Price",0,100000,2);
day:=Input("start Day",1,31,1);
mnth:=Input("start Month",1,12,1);
yr:=Input("start Year",1800,2200,2007);
multi:=Input("ATR Multiple",0,10,3);
pds:=Input("ATR Periods",1,2520,14);

{ Date signal }
start:=Year()>yr
 OR (Year()=yr AND (Month()>mnth
  OR Month()=mnth AND DayOfMonth()>=day));
date:=start AND Alert(start=0,2);

{ Restrict out of range date signal to chart }
date:=If(LastValue(Cum(date))>0,date,
 Cum(1)=LastValue(Cum(1)));

{ Restrict price to entry day's range }
price1:=Min(Max(price1,L),H);

{ Initial stop }
initStop:=
 ValueWhen(1,date,price1-ATR(pds)*multi);

{ Plot on price chart }
initStop

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


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




--- In equismetastock@xxxxxxxxxxxxxxx, "nic_cantatore" <ncantatore@xxx> 
wrote:
>
> Hi,
> 
> I have been trying to create an indicator for a fixed intial stop.
> 
> Long trades: for example I want my initial fixed stop to be 3 times ATR
> (10) below from my entry price given the entry price and date and to 
> have this as a indicator line going across to the right on my chart in 
> a straight line. I do not want to trail the stop, only to use this 
> indicator as the initial fixed stop. 
> 
> Below is the code I have tried and it does not work. Any assistance 
> would be appreciated.
> 
> Day := Input("Day of Month" ,1,31,15);
> Month := Input("Month" ,1,12,8);
> Year := Input("Year",1990,2100,2007);
> ATR := Input("ATR Multiple",.1,5,3);
> entry:= Input("Purchase Price", 0,9999,1.00);
> initialstop :=entry - ATR*ATR(10);
> 
> Cheers
> NicC




 
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/