+ Reply to Thread
Results 1 to 48 of 48

how to add position lines to an excel stock chart?

  1. #1
    Registered User
    Join Date
    02-23-2004
    Location
    helsinki, finland
    MS-Off Ver
    2016
    Posts
    59

    how to add position lines to an excel stock chart?

    i would like to add lines where i held a position but dunno how. maybe someone here can help. fyi - the chart is NVDA yearly. it already contains 3 series of data for Hi, Lo & Cls. if i try to add anything to it, i lose the existing data. what gives?
    Attached Images Attached Images

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: how to add position lines to an excel stock chart?

    "lines where i held a position" What do you mean by this? Do you mean the number of shares held on each date?

    Please attach your file so we can see what data you have, see yellow banner at the top of the page.
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    02-23-2004
    Location
    helsinki, finland
    MS-Off Ver
    2016
    Posts
    59

    Re: how to add position lines to an excel stock chart?

    yes, i do mean shares held on each day. attaching the spreadsheet is complex, as it holds a ton of other data as well... that's why i attached a picture. to my understanding, it's an excel standard stock chart, but will work on it to see if i can extract the data...

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: how to add position lines to an excel stock chart?

    Here is an example of a stock chart with a line chart that gives holdings by day. Technically you cannot make a combo chart with a stock chart, but there is a workaround of creating the additional series then formatting it as a line on a secondary y axis. Then you have to tweak the min/max of each set axis to prevent overlapping so it is all readable.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    02-23-2004
    Location
    helsinki, finland
    MS-Off Ver
    2016
    Posts
    59

    Re: how to add position lines to an excel stock chart?

    almost what i wanted. but i'd like the position line to be with the stock bars, showing entry and exit points.

    attached now a spreadsheet. excel fails to show the closing prices, but for the purposes of this, maybe it does not matter...
    Attached Files Attached Files
    Last edited by zdoe; 09-12-2021 at 03:48 PM.

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: how to add position lines to an excel stock chart?

    "i'd like the position line to be with the stock bars, showing entry and exit points."

    I don't know what you mean by that. Do you have an example, even if it has nothing to do with your data and is from somewhere else? But the chart I gave you is the only way to show another series with a stock charts. It sounds like you may need a combo chart, which cannot be done with a stock chart.

  7. #7
    Registered User
    Join Date
    02-23-2004
    Location
    helsinki, finland
    MS-Off Ver
    2016
    Posts
    59

    Re: how to add position lines to an excel stock chart?

    i mean something like this (with straight lines instead of the curved ones). maybe it has to be a combo chart...
    Attached Images Attached Images

  8. #8
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: how to add position lines to an excel stock chart?

    That might be possible. No idea what time zone you are in (one reason that we ask for location in your profile) but I'll have a second look on Monday.

  9. #9
    Registered User
    Join Date
    02-23-2004
    Location
    helsinki, finland
    MS-Off Ver
    2016
    Posts
    59

    Re: how to add position lines to an excel stock chart?

    thank you. i'm currently in europe 5 hours ahead of EDT.

  10. #10
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: how to add position lines to an excel stock chart?

    As I explained earlier you cannot use hi/lo/close charts as a combo chart. However, you can add a series and format the series as a line. To do what you are asking for I had to create another set of data to generate the data for the line. See attached.

    You will probably want to change the formatting to your liking.

    This chart will not show if you divest your position one day then reacquire the next day. It will be one continuous line.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    02-23-2004
    Location
    helsinki, finland
    MS-Off Ver
    2016
    Posts
    59

    Re: how to add position lines to an excel stock chart?

    yeah, thanks. it does look like what i was looking for. i need to adjust the pos prices - but as this is about things in the past, that's doable. i will likely have another version in a few days, will upload it then.

  12. #12
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: how to add position lines to an excel stock chart?

    The position lines follow the daily close price. Not sure if that is what you wanted. You also said "straight lines instead of the curved ones," not sure what you have in mind there. Straight line from the acquisition price to the disposition price? That's a bit harder.

  13. #13
    Registered User
    Join Date
    02-23-2004
    Location
    helsinki, finland
    MS-Off Ver
    2016
    Posts
    59

    Re: how to add position lines to an excel stock chart?

    the position lines should follow a linear gain/loss by day of holding the pos - e.g. yes, i would like straight lines from acquisition to disposal. the lines in my image were just what i could do in a few seconds with the mouse.

  14. #14
    Registered User
    Join Date
    02-23-2004
    Location
    helsinki, finland
    MS-Off Ver
    2016
    Posts
    59

    Re: how to add position lines to an excel stock chart?

    ok - played around with it a bit, but stopped (for now) when i wasn't able to make excel count the duration of holding each pos. i shortened the overall time frame & copy pasted the values to how the lines are generated. weekends screw up the lines not to be straight, and day highs go out of whack due to what i did. work-in-progress...
    Attached Files Attached Files
    Last edited by zdoe; 09-15-2021 at 08:12 AM.

  15. #15
    Registered User
    Join Date
    02-23-2004
    Location
    helsinki, finland
    MS-Off Ver
    2016
    Posts
    59

    Re: how to add position lines to an excel stock chart?

    back on the case. but when i replace the data on the chart with mine, i get this:
    sorry the image - still the fastest to provide.
    here the pos are at the entry price...
    Attached Images Attached Images

  16. #16
    Registered User
    Join Date
    02-23-2004
    Location
    helsinki, finland
    MS-Off Ver
    2016
    Posts
    59

    Re: how to add position lines to an excel stock chart?

    now i played around with it more. reversed the time span, etc. but any time i try to replace the lines source data, the lines disappear - such as going J to K even though K has the data of L.

    do you know why, @69StringJazzer? am i running to excel limitation?
    Attached Files Attached Files
    Last edited by zdoe; 10-01-2021 at 07:56 AM.

  17. #17
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: how to add position lines to an excel stock chart?

    any time i try to replace the lines source data, the lines disappear
    If my example shows the type of chart that you need, but you are changing data so it doesn't work, you need to attach the actual data that is giving you trouble. All you attached is my file with a couple of more columns of data.

  18. #18
    Registered User
    Join Date
    02-23-2004
    Location
    helsinki, finland
    MS-Off Ver
    2016
    Posts
    59

    Re: how to add position lines to an excel stock chart?

    the previous attachment was the file where i tried it, with the chronology reversed - but yes, largely yours. moving the source data to another column makes the lines disappear. here it is once more.
    Attached Files Attached Files

  19. #19
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: how to add position lines to an excel stock chart?

    I don't understand what you mean by "the lines disappear". I see the lines are still there.

  20. #20
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: how to add position lines to an excel stock chart?

    Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

  21. #21
    Registered User
    Join Date
    02-23-2004
    Location
    helsinki, finland
    MS-Off Ver
    2016
    Posts
    59

    Re: how to add position lines to an excel stock chart?

    @69stringJazzer, replacing the source on column j with identical new column q makes the lines disappear. see attached.
    Attached Files Attached Files

  22. #22
    Registered User
    Join Date
    02-23-2004
    Location
    helsinki, finland
    MS-Off Ver
    2016
    Posts
    59

    Re: how to add position lines to an excel stock chart?

    @bsalv, i didn't yet read it very carefully, but when he's adding an index-line to the stock-chart, he's doing something like what i'd like to achieve.

  23. #23
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: how to add position lines to an excel stock chart?

    that graph took me an hour to make, following peltrier's instructions.
    Now it's 2 lines and 1 scatter.
    The open and close aren't included yet, but that was just a matter of time.
    I looked at the graph in #7, not the one in #15.
    Last edited by bsalv; 10-25-2021 at 12:03 AM.

  24. #24
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: how to add position lines to an excel stock chart?

    Now there is a 2nd serie added, to make a difference between gain (red) and loss (blue).
    Your graph and my graph are now on the same page.
    In "pos" columns E:F, you find the close-prices on those specific dates.
    In "QrStckYhCSV"
    - I : match the date with those in "POS"
    - J : gain (+) or loss (-)
    - K : if the date is between an entry and an exitdate in "POS"
    - L:M : regression of the close-price in case of "+" or "-"
    Attached Files Attached Files

  25. #25
    Registered User
    Join Date
    02-23-2004
    Location
    helsinki, finland
    MS-Off Ver
    2016
    Posts
    59

    Re: how to add position lines to an excel stock chart?

    fab, @bsalv. and in this one the trend+ & trend- -lines don't disappear if i move the data to be in another column. eventually i'd like lines that show linear gain/loss of the pos over time. the chart is missing the open/close -data - did you build it from scratch using peltier's instructions, or is it straight off the tin one?
    Attached Files Attached Files

  26. #26
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: how to add position lines to an excel stock chart?

    the chart is built from scratch following peltrier.
    I added a 5th and a 6th serie "close" and "open" without a line, only a "-" as marker (black and green). (just select the column and copy with CTRL+C, go to the chart paste special etc and adjust the charateristics of the serie. I'm not so familiar with stockcharts, but is that oké like that ?

    I didn' understand "lines that show linear gain/loss of the pos over time". You can create a new column with the desired values and add that one also to the chart.
    Attached Files Attached Files

  27. #27
    Registered User
    Join Date
    02-23-2004
    Location
    helsinki, finland
    MS-Off Ver
    2016
    Posts
    59

    Re: how to add position lines to an excel stock chart?

    building from scratch - heroic! will attempt it today, based on yours and peltier.

    by linear lines i mean a straight line between pos entry/exit with gain/loss increment per trading day - not tied to OHLC-values. what i was trying to demonstrate on the image of 9/12.

    i'll post it here if i achieve something.

  28. #28
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: how to add position lines to an excel stock chart?

    see formula in column L and read the help for the "forecast"-function, to calculate a straight line for each day in a period.
    In attachment a simple example of the forecast-function, so that you can better understand the complex formula of column L
    Attached Files Attached Files

  29. #29
    Registered User
    Join Date
    02-23-2004
    Location
    helsinki, finland
    MS-Off Ver
    2016
    Posts
    59

    Re: how to add position lines to an excel stock chart?

    will study your latest file tonight. i did play around with the chart today. succeeded in adding new series to yours, but dunno how to make the corresponding lines vanish - or how to add the o c ticks.
    Attached Files Attached Files

  30. #30
    Registered User
    Join Date
    02-23-2004
    Location
    helsinki, finland
    MS-Off Ver
    2016
    Posts
    59

    Re: how to add position lines to an excel stock chart?

    now i succeeded formatting the chart to my liking. getting my data to it is for tomorrow the earliest.
    Attached Files Attached Files

  31. #31
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: how to add position lines to an excel stock chart?

    Great job.
    How long took it you to achieve this result ?

  32. #32
    Registered User
    Join Date
    02-23-2004
    Location
    helsinki, finland
    MS-Off Ver
    2016
    Posts
    59

    Re: how to add position lines to an excel stock chart?

    several hours, let's say 3. but maybe it's worth it if it results in better trades.

  33. #33
    Registered User
    Join Date
    02-23-2004
    Location
    helsinki, finland
    MS-Off Ver
    2016
    Posts
    59

    Re: how to add position lines to an excel stock chart?

    can't say i understand your use of the forecast function - though i can see its usefulness. the basic difference in what you're doing to mine is that you take the closing prices on the trade day, instead of the actual entry/exit prices. here's the file i played around with... not ready. couldn't figure out how to calculate the values i'd want. the chart behaves strangely, i get the vertical lines from zero for the pos-lines, if i replace n/a() with "". go figure.
    Attached Files Attached Files

  34. #34
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: how to add position lines to an excel stock chart?

    Please Login or Register  to view this content.
    You need 2 dates for the known X and 2 prices for the known Y.
    In the offset-function, you give an absolute address, here $c$3 en $E$3 in sheet "pos" and you go as many rows down as needed for the right date. That number is given in column I of "QrStock..." and you want that cell and the cell at the right, so 2 cells, that's the last argument of that function.

    Now you want the entry and exit price of tab "pos", so the columns H:I instead of columns E:F, modify the red pos!$E$3 into pos!$H$3 and the formula 'll take those 2 prices.

    If you don't use n/a, the serie goes to 0 instead of creating a gap, those vert. lines you mentioned.
    You can change the behaviour of excel concerning n/a and gaps, see https://techcommunity.microsoft.com/...ls/ba-p/108453

    Do you understand the functions "forecast" and "offset" when you read the help ?


    EDIT : as result of my trial, when the result of a formula is "", then the cell isn't blank and the curve goes to zero (your vertical lines), so in the formula you need to replace all the ""-results with a "n/a"-result.
    In some of the cells, i deleted the formula which resulted in a "" and the curve gives a gap.
    Attached Files Attached Files
    Last edited by bsalv; 10-31-2021 at 02:59 AM.

  35. #35
    Registered User
    Join Date
    02-23-2004
    Location
    helsinki, finland
    MS-Off Ver
    2016
    Posts
    59

    Re: how to add position lines to an excel stock chart?

    i do understand forecast (with your excellent help, and tutorial @ https://exceloffthegrid.com/interpol...cast-function/) and offset in their simple form. had to create an x y table from the dates in pos to better figure it out.

    now i got the desired end result (which was already on your last file), but i still don't fully understand how. if i copy/paste the offset formulas on their own, i get #VALUE. why?

    =IF([@[+/-]]="+",FORECAST(K55,OFFSET(pos!$H$3,QrStckYhCSV!$I55,,,2),OFFSET(pos!$C$3,QrStckYhCSV!$I55,,,2)),NA())
    Last edited by zdoe; 10-31-2021 at 11:11 AM.

  36. #36
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: how to add position lines to an excel stock chart?

    if your formula
    Please Login or Register  to view this content.
    is the one in cell L55, then it's ok, if not then that's why.

  37. #37
    Registered User
    Join Date
    02-23-2004
    Location
    helsinki, finland
    MS-Off Ver
    2016
    Posts
    59

    Re: how to add position lines to an excel stock chart?

    it is indeed from L55. see the file on this msg. that's one where i copy/pasted from L85.
    Attached Files Attached Files
    Last edited by zdoe; 10-31-2021 at 01:54 PM.

  38. #38
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: how to add position lines to an excel stock chart?

    so? Now it's working, or does it still give a problem ?

  39. #39
    Registered User
    Join Date
    02-23-2004
    Location
    helsinki, finland
    MS-Off Ver
    2016
    Posts
    59

    Re: how to add position lines to an excel stock chart?

    it's working! i was just wondering about copy/pasting the offset -formulas on their own.

    and i tried the chart's OHLC-series on another data set, but the formats don't seem to stick.
    Last edited by zdoe; 10-31-2021 at 05:55 PM.

  40. #40
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: how to add position lines to an excel stock chart?

    can you give me an example ?

  41. #41
    Registered User
    Join Date
    02-23-2004
    Location
    helsinki, finland
    MS-Off Ver
    2016
    Posts
    59

    Re: how to add position lines to an excel stock chart?

    hold on. i have to create a file for that. sleeping on it overnight, i think the issue arises if the date-axis is in reverse chronological order - something that peltier refers to, but i could not find the setting for that.

  42. #42
    Registered User
    Join Date
    02-23-2004
    Location
    helsinki, finland
    MS-Off Ver
    2016
    Posts
    59

    Re: how to add position lines to an excel stock chart?

    hold on. i have to create a file for that. sleeping on it overnight, i think the issue arises if the date-axis is in reverse chronological order - something that peltier refers to, but i could not find the setting for that.

  43. #43
    Registered User
    Join Date
    02-23-2004
    Location
    helsinki, finland
    MS-Off Ver
    2016
    Posts
    59

    Re: how to add position lines to an excel stock chart?

    deleted duplicate post caused by the "tokens" that this site uses.
    Last edited by zdoe; 11-02-2021 at 06:54 PM.

  44. #44
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: how to add position lines to an excel stock chart?

    when you select the x-axis and right-click to modify the settings
    Attached Images Attached Images

  45. #45
    Registered User
    Join Date
    02-23-2004
    Location
    helsinki, finland
    MS-Off Ver
    2016
    Posts
    59

    Re: how to add position lines to an excel stock chart?

    now found the menu ok. chart still f'd, but makes at least some sense now...
    Attached Images Attached Images

  46. #46
    Registered User
    Join Date
    02-23-2004
    Location
    helsinki, finland
    MS-Off Ver
    2016
    Posts
    59

    Re: how to add position lines to an excel stock chart?

    played around with it some more. the source data on my last post was corrupt - no problem in the chart traveling.
    Attached Files Attached Files

  47. #47
    Registered User
    Join Date
    02-23-2004
    Location
    helsinki, finland
    MS-Off Ver
    2016
    Posts
    59

    Re: how to add position lines to an excel stock chart?

    here is the end result. thanks everybody - couldn't have done it without the help of the smart folks in this forum, specially @bsalv.

    please note that the entries/exits are "idealized," i didn't actually make those trades.
    Attached Images Attached Images

  48. #48
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: how to add position lines to an excel stock chart?

    https://www.excelforum.com/excel-for...ml#post5596839 #15, the small imperfections you see in the red line are the weekends/holidays.
    When the real dates are used in the forecast-function, then the red lines would be 100% straight.

+ 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. Help with Total Days a Stock position was held
    By onp in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-23-2021, 09:55 PM
  2. Replies: 1
    Last Post: 04-11-2019, 12:17 PM
  3. Stock Chart combined Dow Jones Stock Chart ?
    By HerryMarkowitz in forum Excel Charting & Pivots
    Replies: 17
    Last Post: 10-14-2014, 07:30 AM
  4. macro to add horizontal lines to stock chart
    By freak11 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-21-2013, 06:49 AM
  5. add horizontal lines to stock chart
    By freak11 in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 09-15-2013, 07:32 AM
  6. Display data receipt - issue & stock position
    By avk in forum Excel General
    Replies: 3
    Last Post: 07-26-2010, 02:58 PM
  7. Set position of excel chart to cell A1
    By Jasonm in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-09-2006, 09:35 PM

Tags for this Thread

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