Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 6/19/2005(UTC) Posts: 39
|
HI,
can you telle me the place where could be the formula for the price of a security soon entered in portofolio ?
Best regards,
Pierre
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 1/19/2005(UTC) Posts: 1,065 Location: Koh Pha-Ngan, Earth
Was thanked: 2 time(s) in 2 post(s)
|
Here is an example using code adapted from
http://metastocktools.co...taStock/TradeSignals.txt :
[code:1:0e5153795e]MetaStock -> Tools -> Indicator Builder -> New ->
Copy and paste complete formulae between "---8<---" lines.
========================
System trade entry price
========================
---8<--------------------------
{ System trade entry price v2.5 }
{ ©Copyright 2005 Jose Silva }
{ For personal use only }
{ http://www.metastocktools.com }
{ Note on simultaneous entry/exit on same bar:
#1 Ignore:
entry/exit signals cancel each other;
#2 Preference given to:
new entry if currently Short,
new exit if currently Long.}
{ Signals reference example }
entry:=C>Mov(C,21,E);
exit:=C<Mov(C,10,E);
{ User inputs }
choose:=Input("Simultaneous entry/exit: [1]Ignore, [2]Preference",1,2,2);
delay:=Input("Entry and Exit delay",-1,5,0);
{ Initialize }
Init:=Cum(IsDefined(entry+exit))=1;
{ #1 - Ignore entry/exit on same bar }
bin1:=ValueWhen(1,entry-exit<>0 OR Init,
entry-exit);
long1:=bin1=1 AND (Alert(bin1<>1,2) OR Init);
{ #2 - Preference to first entry/exit }
long:=entry AND (Alert(entry=0,2) OR Init);
short:=exit AND (Alert(exit=0,2) OR Init);
bin2:=ValueWhen(1,long-short<>0 OR Init,
long-short);
long2:=bin2=1 AND (Alert(bin2<1,2) OR Init);
{ Select #1 or #2 }
entry:=If(choose=1,long1,long2);
{ Plot in chart window }
ValueWhen(1,Ref(entry,-delay),C)
---8<--------------------------
[/code:1:0e5153795e]
If the exit references the entry signal, then the MS code would need to use the PREV function.
jose '-)
http://www.metastocktools.com
.
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 6/19/2005(UTC) Posts: 39
|
Hi José,
Thanks ; I'll try your long work this afternoon .
Pierre
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.