PDA

View Full Version : exit price prevents exploration and database


gawdib
22nd May 2004, 06:04 PM
I cannot get tradesim to work on testing more than one system, if I want the exit price to accurately reflect my trading!

after trying many combinations by myself,
I CAN get one specific system to have the exit price registered correctly in the tradesim database(first example below,),

however when I try the same format for a better system, (see example 2 below) the formulation of the exit price causes metastock explorer to reject 80% of the stocks!

Explorer says that a tradesim msx.dll is causing an internal error. It does not say what type. Nothing shows up in the tradesim error log or message log, if I go ahead and run the ddatabase anyway.

I know the second system other than the exit price is not causing the problem, because if I wrongly put in the exit price , a simple "open", then explorer just rejects the usual 2% of the stock list that i have given the exploration to process..

What is the problem?

I have tried putting the idential exit trigger and exit price from example 1 into example 2, and what happens is that explorer indicates that explorer is rejecting 25% of the stocks!
It all has no logic.
why is tradesim messing up?

I have no trouble using my formulations in metastock 9 system testing and in an expert, as long as I do not try to use the tradesim format.

thank you and regards, geoffrey

example 1 :that works in that it accurately reflects the price at which my trade exits....ie. at the price the day opens or , if the low of the day goes below the previous day's trailing stop, then at the price equal to the trailing stop. explorer rejects the usual 2%:

z1:= Fml(" 4");
z2:=Fml(" 3") ;
x:=Ref((HHV(H,25)/H),-1));
y:=(C-Ref(C,-20))/ATR(70);

entrytrigger:=
Ref(Mov(VOLUME,50,S)>7500 AND C>6
AND ( y<7 ),-1)
AND Ref(Fml(" Trend")=1 AND Mov(Sum( If(L<Ref(HHV(H,15),-1),1,0) ,1),5,S)>18 AND (CMO(C,30)>0 )
AND Ref(Ref((HHV(H,250)/H),-1)/x>0,-1)
,-1) ;
EntryPrice:=OPEN;

ExitTrigger:=
If(Fml("spxc"),LOW<=Ref(z1,-1),LOW<=Ref(z2,-1)) AND L >.5* Ref(L,-1);

ExitPrice :=
If( exittrigger , If(O<If(Fml("spxc"),Ref(z1,-1),Ref(z2,-1)) , O , If(Fml("spxc") , Ref(z1,-1) , Ref(z2,-1))) , C=0) ;

initialstop:=C<.92*entryprice;
ExtFml( "TradeSim.Initialize");
ExtFml("tradesim.settimestop",120);
ExtFml("tradesim.setstartrecorddate",1,1,2000);ExtFml("tradesim.setstoprecorddate",1,1,2003);

ExtFml( "TradeSim.RecordTrades",
"may21c",
LONG,
EntryTrigger,
EntryPrice,
InitialStop,
ExitTrigger,
ExitPrice,
START);

example 2 has been tried with the same sort of exit price formulation, but, unless, I put "open" ,ONLY, in the exit price, the tradesim formulation cause explorer to reject 80% of the stock!

z1:= Fml("Stop 4");
z2:=Fml("Stop 3") ;
yYY:=C-Ref(C,-60);xx:=Ref(ROC(TSF(Fml("spx"),4),1,%)>0,-1);

entrytrigger:=
Ref(Mov(VOLUME,50,S)>6000 AND C>6 AND ( YYy<,-1)
AND Ref(Fml(" Trend")=1 AND Mov(Sum( If(L<Ref(HHV(H,15),-1),1,0) ,1),1,S)>11 AND ROC(CMO(C,30),1,%)>0,-1)
;
EntryPrice:=OPEN;

ExitTrigger:=
Ref(If(Ref(ROC(Fml("vol"),1,$)<0 AND Mov(Fml("vol0"),2,VOL)<Mov(Fml("voltr),4,S),-1),
If(xx,If(LOW<=Ref(z1,-1),1,0),If(LOW<=Ref(z2,-1),1,0)),0)=1
,-1) ;

I have tried many different codings of the exit trigger, but that does not make any difference.

ExitPrice :=
If(exittrigger,If(O<If(xx,Ref(z1,-1),Ref(z2,-1)),O,If(xx,Ref(z1,-1),Ref(z2,-1))),C=0);

initialstop:=C<.92*entryprice;
ExtFml( "TradeSim.Initialize");

{ExtFml("tradesim.enablepricefilter");

putting this in messes things up in yet a different way}

ExtFml( "TradeSim.RecordTrades",
"may22cmoc3",
LONG,
EntryTrigger,
EntryPrice,
InitialStop,
ExitTrigger,
ExitPrice,
START);

David Samborsky
24th May 2004, 01:54 AM
Are you using the latest TradeSim plugin. ie Version V4.2.2 of TradeSim.dll?

Also why don't you check the error log to see why the trades are being rejected.

If you are trying to create a multiple system trade database then read page 55 of the User Manual which explains how to set it up.

gawdib
25th May 2004, 02:38 AM
Dear David:

Thank you for your reply:

1:Are you using the latest TradeSim plugin. ie Version V4.2.2 of TradeSim.dll?


Yes, I have already downloaded 4.2.2.

2.Also why don't you check the error log to see why the trades are being rejected?

Could you tell me how to find this "error log"?

I did an adobe search on the tradesim manual. Nothing came up under "Error log."

However, I did check the tab in explorer that says rejects.
The message that came up is copied below.

I also checked in Tradesim.... the "message log"
and the "rejected trades."
I indicated the results of that below... nothing indicating anything unusual had occurred.

Example:
with this exit price formula:

( If(Ref(LOW<=Ref(fml("x"),-1),-1)
,Ref(fml("x"),-2),
If(Ref(LOW<=Ref(fml("y"),-1),-1),
Ref(fml("y"),-2)
,O ))).
This rejects 75% of the stocks presented to metastock explorer. explorer gives the following message for all the rejects:
Error in column A: An MSX DLL is reporting an internal error. Referenced DLL: "TradeSim.RecordTrades" DLL Message: Invalid security data detected - Check the Error Log for details.

if i run the exploration again and do nothing different than change the exit price to "open", then only the usual 1-2% get rejected!

Then, when I open the explorer rejects tab, after the simple exit price of open, there are none of the above messages. So it makes no sense when it says there is invalid security data.

it makes no sense to me, since the first formula for the exit price gives the exit price a choice of using "open".

I have tried many different ways of writing the code to give "open" as an option each time (under "exitprice"), but I just get a lot of rejections. maybe 25% another time 50%, etc.


if I go into tradesim, then load the explorer file.
The message log only says that the file was loaded successfully.
After I run a simulation,
the rejected trades tab only gives the usual things like insufficient capital or maximum number of open trades already etc.


3
If you are trying to create a multiple system trade database then read page 55 of the User Manual which explains how to set it up.

NO. I have nothing in mind about a multiple system in the same exploration.

In my examples above, I discussed 2 different systems that were used in 2 different explorations. I mentioned them both to try and get across the point that I have tried to get consistent meaningful results for the desired exit price I write into each exploration.But there is no consistency.

Thank you. regards, geoffrey

David Samborsky
26th May 2004, 01:43 AM
Please download document "TB-1 Problems and Issues using the TradeSim/Metastock Plug-In". This should help to answer most of your questions. :wink:

gawdib
26th May 2004, 05:03 AM
athe sub manual allowed me to find the error log,, When I opened it, for all the rejected stocks it stated"Error Detected in [ANDW] caused by Invalid array index."..


that was too vague for me to begin to know what to do with this statement. I have alot of data arrays in my system
Any additional clues would be most appreciated.. thank you regards, geoffrey

David Samborsky
27th May 2004, 01:10 AM
What have you set your data loading options to in the Explorer Options.

gawdib
27th May 2004, 10:45 PM
2000 records, daily data. reducing this number, or putting minimum records does not help.

by the way, I have no problem ploting the exit trigger as a indicator on the chart,

it is tradesim that is messing up on being able to deal with metastock language that tells tradesim to use as the exit price value either the open price OR THE VALUE OF YESTERDAY'S trailing stop band value.
thank you and regards, geoffrey

sectorbets
28th May 2004, 03:59 PM
I've been struggling with with this series of posts. You obviously have a very complex set of criteria that you are trying to test, and I suspect that is why it is difficult to determine exactly why you aren't getting the results you expect. I strongly suggest that you build up the test one step at a time and get each little piece to work exactly as you expect before you try to combine everything into one exploration. If you do that, you will easily find the exact part of you exploration where things are delivering the results you expect.

I also am willing to bet that you will find that your set of criteria are far too complex and that you can actually develop a set of simpler criteria that deliver decent results.

David Samborsky
31st May 2004, 01:31 AM
by the way, I have no problem ploting the exit trigger as a indicator on the chart,
This and the previous post that using the Price Filter reduced the number of rejected securities indicates that you have issues with the way you have specified your entry and exit prices.

Now create an indicator using the RecordTrades function and plonk this indicator down on a security that you having trouble with and then check the errorlog as to where the problem lies.