exit next day code - tips please

Studies that have been contributed to the community by other users. If you’ve got something useful to share, that’s great!
Posts: 52
Joined: 16 Sep 2011
Has thanked: 16 times
Been thanked: 10 times

exit next day code - tips please

Postby thutch » 13 Dec 2011

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)

Return to “User Contributed Studies and Indicator Library”