1

I need to draw a timeline as shown below.

Can someone help me with this? Thanks...

enter image description here

2
  • Quite easy with Tikz. What have you tried so far?
    – JeT
    Jul 4, 2021 at 16:55
  • Regarding the content, you can take position right after the open, ie 9.30am (not 9.45)
    – JeT
    Jul 4, 2021 at 16:58

1 Answer 1

4

enter image description here If you want to do an example much larger than this then you should probably define more styles and nodes but this should get you started.

\documentclass[tikz, border=20]{standalone}
\usetikzlibrary{calc}
\begin{document}

    \begin{tikzpicture}
        \tikzset{grayed out/.style={gray}}
        \tikzset{arrow/.style={line width=0.2cm, ->, >=latex}}
        \tikzset{event/.style={red, fill=red, minimum size=0.3cm}}
        % Arrows
        \draw[arrow, grayed out] (0, 0) -- (4, 0);
        \draw[arrow] (4.5, 0) -- (9.5, 0);
        \draw[arrow, grayed out]  (10, 0) -- (14.5, 0);
        \draw[arrow] (15, 0) -- (19, 0);
        
        % Vertical lines
        \draw[grayed out, dashed, ultra thick] (2, 2) -- (2, -2);
        \draw[grayed out, dashed, ultra thick] (12, 2) -- (12, -2);
        \draw[ultra thick] (4.25, 2) -- (4.25, -2);
        \draw[ultra thick] (9.75, 2) -- (9.75, -2);
        \draw[ultra thick] (14.75, 2) -- (14.75, -2);
        
        % Marks
        \node[event] (buy) at (4.75, 0) {};
        \node[event] (sell) at (15, 0) {};
        \node[below right] at ($(buy) - (0.5, 0.2)$) {\parbox{3cm}{\centering BUY / SHORT\\09:45 am}};
        \node[below right] at ($(sell) - (0.5, 0.2)$) {\parbox{3cm}{\centering SELL / COVER\\09:45 am}};
        
        \node[grayed out, below] at (1, -0.2) {Afterhours};
        \node[grayed out, below] at (3, -0.2) {Premarket};
        \node[grayed out, below] at (11, -0.2) {Afterhours};
        \node[grayed out, below] at (13, -0.2) {Premarket};

        % Market times
        \node[above] at (4.25, 2) {\parbox{3cm}{\centering Market Opens\\ 9:30 am}};
        \node[above] at (9.75, 2) {\parbox{3cm}{\centering Market Closes\\ 16:00 pm}};
        \node[above] at (14.75, 2) {\parbox{3cm}{\centering Market Opens\\ 9:30 am}};
    \end{tikzpicture}
\end{document}
1
  • 1
    Perfect! This provides a great start!
    – PiE
    Jul 4, 2021 at 17:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.