int barsAgo = CurrentBar - Bars.GetBar(new DateTime (2010,12,30,16,15,0));
Print("The close price on the 4:15 PM bar was: " + Close[barsAgo].ToString());
What I would like to do is get the close of the bar from a DateTime variable. I have one which I checked is correctly formed (by printing it)and has the same information as the example above. I don't know how to place it in a statement. The following gives me the error, "The name 'dtPreviousClose' does not exist in the current context."
int barsAgo = CurrentBar - Bars.GetBar(dtPreviousClose);
Print("The close price on the 4:15 PM bar was: " + Close[barsAgo].ToString());
I've tried all sorts of variations. If you could tell me how to go about this, I would be appreciative.

Comment