I have a back testing strategy that takes a start date and end date as inputs. When I run a back test if there is an open trade at the end date it will close it at the close of todays date even if the end date I specified is prior to today.
So I want to compare barDate to endDate and if they are equal I want to close the open trade at the closing price of barDate.
I have tried if (barDate == endDate) Strategy.doSell(.......)
but it does not execute.
I also tried if (barDate != endDate)
else Strategy.doSell(....)
but that doesn't execute either.
I have put debugPrintln to display the endDate and barDate so I know that they are equal. What is going wrong?
So I want to compare barDate to endDate and if they are equal I want to close the open trade at the closing price of barDate.
I have tried if (barDate == endDate) Strategy.doSell(.......)
but it does not execute.
I also tried if (barDate != endDate)
else Strategy.doSell(....)
but that doesn't execute either.
I have put debugPrintln to display the endDate and barDate so I know that they are equal. What is going wrong?
Comment