+ Reply to Thread
Results 1 to 14 of 14

Count Max Open Trades by Date

  1. #1
    Registered User
    Join Date
    03-06-2014
    Location
    Pakistan
    MS-Off Ver
    Excel 2016
    Posts
    29

    Count Max Open Trades by Date

    i am creating a spreadsheet of stock trades.

    i have a field for the date the trade was opened and the date the trade was closed.

    Is there a way I can calculate the maximum number of trades that were open at one time.

    example


    SNo D/M/Y D/M/Y
    1. open date 1/1/2019 close date 3/1/2019

    2. open date 2/1/2019 close date 3/1/2019

    3. open date 3/2/2019 close date 4/1/2019



    The max number of trades open would be 2 because the Trade 1 is open on 1/1/2019 & close on 3/1/2019 and trade 2 also open on Close with in the time of trade No1 so the Max open in this case = 2 Trades
    see the attachment for more detail
    the data is huge about 8000 rows

    Thank you for any help
    Attached Files Attached Files
    Last edited by mohammadamjad48; 07-07-2021 at 01:16 PM. Reason: Attachment uploaded

  2. #2
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,783

    Re: Count Max Open Trades by Date

    Post a small Excel sheet (not a picture) showing realistic & representative sample data WITHOUT confidential information (10-20 rows, not thousands...) and some manually calculated results. Just before posting, scroll down to GO ADVANCED, click, and then scroll down to MANAGE ATTACHMENTS and click again. Now follow the instructions at the top of that screen.

  3. #3
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,751

    Re: Count Max Open Trades by Date

    whats the date format DD/MM or MM/DD ?
    how do you define a trade as OPEN , why the count of 2
    Not clear to me.

    Also an sample spreadsheet would help with expected results and WHY
    see yellow banner at top of thread
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  4. #4
    Registered User
    Join Date
    03-06-2014
    Location
    Pakistan
    MS-Off Ver
    Excel 2016
    Posts
    29

    Re: Count Max Open Trades by Date

    Dear sir sample file is attached

  5. #5
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Count Max Open Trades by Date

    mohammadamjad48

    There are newer functions/features that may make this easier. Your profile shows Excel 2007. If it is newer please update your profile.
    Dave

  6. #6
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Count Max Open Trades by Date

    In the meantime try this in helper column I to get cumulative max counts of trades open at the same time. In cell I3 and filled down to cell I14.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Then in J3 and filled down to J14 this will return the max counts you indicate.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    See the attached.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    03-06-2014
    Location
    Pakistan
    MS-Off Ver
    Excel 2016
    Posts
    29

    Re: Count Max Open Trades by Date

    Dear Sir, thanks for helping, when i copy the formula for result i see the max Open Count Trades is 55 Nos , but the pairs ID is 1 ~ 10 so the max open in on time is not > then Max Pair ID which is 10.

    i want the Count Max Open Orders in one time and its not grater then Max Pair ID.

    please see the attachment..


    kindly help me for resolving this issue thanks thanks..
    Attached Files Attached Files

  8. #8
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,570

    Re: Count Max Open Trades by Date

    This proposal employs ten helper columns, one for each Pair ID.
    K1:T1 display the maximum number of trades open and are populated using: =MAX(K3:K200)
    K2:T2 are populated with the Pair ID numbers
    K3:T183 are populated using: =IF($B3<>K$2,0,SUM(COUNTIFS($B$2:$B2,K$2,$C$2:$C2,"<="&$C3,$D$2:$D2,">="&$C3),COUNTIFS($B4:$B$200,K$2,$C4:$C$200,"<="&$D3,$D4:$D$200,">="&$D3),1))
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  9. #9
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Count Max Open Trades by Date

    Quote Originally Posted by mohammadamjad48 View Post
    ...... when i copy the formula for result i see the max Open Count Trades is 55 Nos , but the pairs ID is 1 ~ 10 so the max open in on time is not > then Max Pair ID which is 10 ......
    If I understand correctly please try this formula
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    03-06-2014
    Location
    Pakistan
    MS-Off Ver
    Excel 2016
    Posts
    29

    Re: Count Max Open Trades by Date

    Dear Sir, thanks for help, but may problem is still pending,
    i want the Max Open Orders in one time Not by Max Open order By ID,

    i have 10 Different Pairs Back test Trading data,
    i just want to know Max Open Order by date.

  11. #11
    Registered User
    Join Date
    03-06-2014
    Location
    Pakistan
    MS-Off Ver
    Excel 2016
    Posts
    29

    Re: Count Max Open Trades by Date

    Thank you FlameRetired your formula works well for small number of rows but when i apply it to 8000 rows it can not copy the formula down and even don't save.

  12. #12
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Count Max Open Trades by Date

    I do not understand what you mean here:
    when i apply it to 8000 rows it can not copy the formula down and even don't save.

  13. #13
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,570

    Re: Count Max Open Trades by Date

    Perhaps if you could manually calculate the result that you would like to see for the first 20 rows of the data in the Count Max Open Trades by Date.xlsx file attached to post #7, then we would have a better idea of the kind of formulas/code that is needed to replicate that result.

  14. #14
    Registered User
    Join Date
    03-06-2014
    Location
    Pakistan
    MS-Off Ver
    Excel 2016
    Posts
    29

    Re: Count Max Open Trades by Date

    Dear, please see the attached file, here the full data file and formula in I column is not coping to the end i have copied to Row No 2501 and i want to copy to the end which is Row No.7721

    when i try to copy the formula upto end, my Laptop CPU is 100% working show in task manager and after +15m the massage is show that the file cannot save,

    Please tell how to copy this to end.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Count of historical ticket by month based upon an open and closed date
    By Mr.TDP in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-14-2021, 12:14 AM
  2. [SOLVED] Drawdown (without VBA) but where first few trades are negative
    By chipps24 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-02-2015, 03:45 AM
  3. [SOLVED] Need to calculate how many trades are open at the same time.
    By amdoc in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 03-07-2013, 03:53 AM
  4. Delete Expired Trades
    By drchris in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-17-2009, 11:42 AM
  5. How many trades are open
    By censura10 in forum Excel General
    Replies: 1
    Last Post: 09-22-2009, 04:45 PM
  6. tracking open trades
    By jrtaylor in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-20-2009, 09:28 PM
  7. Trades Reconciliation
    By iguss in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-01-2008, 04:28 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1