PDA

View Full Version : "Closing" prices of open trades


sectorbets
6th March 2007, 12:17 PM
I may misunderstand, but it seems that open trades are priced at my closing price criteria rather than at the closing market price...if this is correct, could you consider changing your code so that open trades are priced at the market, which would better reflect the portfolio value?

thank you
Rick

smith1973
7th April 2007, 12:08 PM
I agree, at the moment, if you want to get rid of errors in the log cause by exit prices of open trades being outside the last bar H-igh-Low range, I put in code to reset the exit price to the High/Low or close of the day.

eg

ExitTrigger:= L <= ref(L,-3);
ExitPrice:= ref(L,-3) {example normal exit price};
ExitPrice:= if(ExitPrice < Low, Close, ExitPrice);
{activates only for open trades which may have an exit price calculated that is less than today's low, but is forced to close anyway by Tradesim}


Mind you, the errors don't seem to do anything, but if you want to define the open trade exit price, you need to code it in manually.

If TS doesn't give the option in the future, at least there is a workaround.

Cheers, Dave

David Samborsky
8th April 2007, 06:28 AM
The following maybe of some guidance

ExitTrigger:= (your exit trigger formula);
NormalExitPrice:= (normal trade exit price formula);
OpenExitPrice:=(open trade exit price formula);

ExitPrice:= if(ExitTrigger,NormalExitPrice,OpenExitPrice);

sectorbets
8th April 2007, 03:50 PM
It's perfect....thank you so much

Rick

smith1973
9th April 2007, 03:52 AM
Thanks David, I like that method better. I had to keep remembering which way my profitstop went to adjust for the open trade ie was i long/short/ limit exit/ stop exit. This way just checks for the trigger & sets the price accordingly.

Cheers, Dave