Adaptative Dynamic loop mechanism
Show older comments
Hello,
I am struggling with the code with some dynamic/adaptative buy and sell signals. I would be very grateful if you could help me if you have some ideas to do that.
I have 2 arrays, a buy array with 2 columns, date and price, and other sell array, with same 2 columns. These 2 arrays are of different sizes.
So what I want to do, is to take the first cell in the first array say, its 01/03/2014, I will look for the first date after this date in the sell array first column say 01/05/2014, in order to get the correspond sell signal. Then I need to get the next buy date, which will be the first date superior than 01/05/2014 in the buy array, then look for the first sell date after 01/05/2014 in the sell array 1st column, then again go back to the buy array to get buy signal after 01/05/2014 in buy arrays 1st column etc etc.
I have tried with a loop on buy then on sell, but I am struggling to make it stop at the first date superior to the buy date. I am bit confused on how to implement this.
Could anyone help me please?
D
Accepted Answer
More Answers (0)
Categories
Find more on Dates and Time in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!