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

[EquisMetaStock Group] Re: MetaStock 8.0: Simulation Function for Trade Entry Price?



PureBytes Links

Trading Reference Links

------------------------------------------------------------------------
You cannot reply to this message via email because you have chosen not
to disclose your email address to the group.

To reply:  http://groups.yahoo.com/group/equismetastock/post?act=reply&messageNum=5912
------------------------------------------------------------------------

There is no function for entry price!  Amazing huh.  So you must go 
to extraordinary measures to get the price to compare with current 
values.  Here is some ideas:
----------------------------------------
The System Tester allows for the placement of maximum stop and profit 
target stops.  The Expert System however does not have this 
capability and the formula below will provide the Indicator that can 
be referenced in the Expert to give the signals for buy, sell, max 
stop, profit stop.
 
 
BT:=If(PREV=0, If(Fml("buy condition here")=1,C,0), If(C>PREV*
(1+profit stop-decimal) OR C<PREV*(1-max stop-decimal) OR Fml("sell 
condition here")=1
OR (Hour()=last trade hour here AND Minute()=last trade minute 
here),0,PREV));
ST:=If(PREV=0, If(Fml("sell condition here")=1,C,0), If(C<PREV*(1-
profit stop-decimal) OR C>PREV*(1+max stop-decimal) OR Fml("buy 
condition here")=1
OR (Hour()=last trade hour here AND Minute()=last trade minute 
here),0,PREV));
BT:=If(BT>0,1,0);
ST:=If(ST>0,1,0);
FT:=If((BT OR ST) AND (BarsSince(Ref(Hour()=last trade hour AND Minute
()=last trade minute,-1))<BarsSince(Ref(BT=1 OR ST=1,-1))),1,0);
FBT:=BT AND FT;
FST:=ST AND FT;
BTN:=Cross(BT<>0,0.5);
BTNP:=BTN AND ST<>1 AND FT<>1;
STN:=Cross(ST<>0,0.5);
STNP:=STN AND BT<>1 AND FT<>1;
BTX:=Cross(BT=0,0.5);
STX:=Cross(ST=0,0.5);
BTPL:=If(ValueWhen(1,BTX,(ValueWhen(1,BTN,C))*(1+profit stop-decimal)
<C),1,
If((ValueWhen(1,BTN AND STN<>1,C))*(1-max stop-decimal)>C,-1,0));
STPL:=If(ValueWhen(1,STX,(ValueWhen(1,STN,C))*(1-profit stop-decimal)
>C),1,
If((ValueWhen(1,STN AND BTN<>1,C))*(1+max stop-decimal)<C,-1,0));
BTPS:=If((BTX AND BTPL=1 AND STN<>1 AND
Hour()<=last trade hour-1),1,0);
STPB:=If((STX AND STPL=1 AND BTN<>1 AND
Hour()<=last trade hour-1),1,0);
BTLS:=If((BTX AND BTPL=-1 AND STN<>1 AND Hour()<=last trade hour-
1),1,0);
STLB:=If((STX AND STPL=-1 AND BTN<>1 AND Hour()<=last trade hour-
1),1,0);
EODS:=If((Hour()=last trade hour AND Minute()=last trade minute) AND 
BarsSince(Ref(BTN,-1))<BarsSince(Ref((BTPS OR BTLS OR STN),-1)),1,0);
EODB:=If((Hour()=last trade hour AND Minute()=last trade minute) AND 
BarsSince(Ref(STN,-1))<BarsSince(Ref((STPB OR STLB OR BTN),-1)),1,0);
 
 
FBT;FST;BTNP;STNP;
BTPS;BTLS;STPB;STLB;
EODB;EODS;
 
{OUTPUT

First Buy Trade; First Sell Trade; Buy Trade Plot; Sell Trade Plot;

Buy Trade Profit Sell; Buy Trade Loss Sell; Sell Trade Profit Buy; 
Sell Trade Loss Buy;

End of Day Buy Exit; End of Day Sell Exit}

The first buy and sell is to allow for automation of Futures trades 
where the first trade of the day will have half the number of 
contracts as the remaining contracts during the day.
The last hour refers to the last hour of the trading day(ie 16 for 
EST).  Last minute can be 0 for 1600 hours or up to 15 if futures 
trades.
 
--------------------------------

It certainly would make life much easier if someday...been waiting 
since 1985 when I started using MS...Equis would provide this 
functionality.
Good luck with your setups and testing.

Bob



--- In equismetastock@xxxxxxxxxxxxxxx, "sihy2 <sihyl@xxxx>" 
<sihyl@xxxx> wrote:
> I have also been struggling with this problem for some time,
> and so far have not been able to come up with a method of 
referencing
> the entry price.  The lack of documentation on the simulation 
functions
> is frustrating as I have no idea how these variables are 
constructed or
> which units they are measured in (points, dollars, ratios etc).  
Any other method
> I can come up with has been scuppered so far because to reference 
an historical
> price in a formula a dynamic variable seems to be required (eg ref
(h,x)) which
> metastock does not support (only static variables are supported eg 
ref(h,-10)).
> Either the system tester needs to be enhanced again to support 
these dynamic
> references, or more info needs to be published for the simulation 
variables
> (as I'm sure you must be able to do it with these as MS 8.0 needs 
this info for
> its stop calculations etc) - unless I'm missing a way of 
referencing it using the
> formula language.
> Anyone got any ideas?
> 
> 
> --- In equismetastock@xxxxxxxxxxxxxxx, sbyh75023 <no_reply@xxxx> 
wrote:
> > Greetings,
> > I have recently acquired MetaStock v8.0 and am trying to write
> > a trading system. Version 8.0 has many built-in simulation 
> > functions which can be called within a new custom formula.
> > I have not been able to find a simulation function which would
> > return the entry (fill) price at which an open trade started.
> > Does anyone have better info or suggestion, in case I have 
> > missed anything.
> > Thanks and regards,
> > Serge ...


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/