I'm using a "counter" in my strategy code so as to prevent re-submission of orders on each bar when I do not wish them. It works fine, however I'm having an issue with how to best "reset" the counter so as to enable future trade possibilities...here's what I'm doing:
if("a set of conditions is TRUE" && subsequentCounter < 1)
{
//enter a trade...and...set the counter...
subsequentCounter = 1;
}
My code I've been using to "reset" the counter back to "0" is the following:
if((Position.MarketPosition == MarketPosition.Short) ||
(Position.MarketPosition == MarketPosition.Long))
{
if(subsequentCounter == 1){subsequentCounter = 0;}
} //reset counter if it needs to be after trade triggers
The problem with this (I believe) is that since this code is calculated only upon bar close...if a trade is entered AND exited INTRA-BAR the counter is never going to be "reset"...this causes problems with future trade conditions not triggering trades. I'm looking for suggestions on how to best correct this?
Comment