Page 1 of 1

exit next day code - tips please

Posted: 13 Dec 2011
by thutch
I have a simple line of code that checks for an exit condition using:

"if marketposition<>0 and date > entrydate(0) then ..."

I had a booboo recently where I had to restart MC intraday and then manually input the position at the broker for the strategy, which meant that the above code read 'entrydate(0)' to be today rather than yesterday. So my exit did not trigger on the day it should have.

Would one of you MC geniuses know of any more reliable way to go about coding this so it continues to read the entry date as yesterday in the event that MC is restarted today?

thank you

PS I have several strategies running on the same symbol, so I can't rely on the marketposition at broker to be correct for each strategy (it is correct in aggregate for all strategies)