Delete observation within the following 10 days.

Lenaukr

New Member
Joined
Nov 8, 2015
Messages
1
Dear members

I am struggling to do the following in Excel.
I am testing stock trading strategy.

I have generated variable Trade_1. It takes value 1 for buy signal and -1 for sell.

My next step is to generate Trade_2. It is almost the same as Trade_1. The only difference is that I need to replace any signal with =. for the following 10 days.
In other words after a first buy/sell signal one should wait for the next 10 days and ignore any signals within this period.


Each%2010%20days_excel_zps2t7zeibb.gif



The column I is my objective. The signals in red cells I deleted manually to show my end goal.

I have to do it over 100 stocks so the prosess should be automated to reduce human error.

Any tought how to do it?

Thank you.

Lena
 
Last edited:

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Welcome to the forum.

In column I enter =G62 (or against the 1st occurrence)
In the next cell in column I enter
=IF(AND(ISNUMBER(H63),COUNTBLANK(H$63:H63)-(COUNT(I$62:I62)*10)>=10),H63,"")

 
Last edited:
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top