From c27401a59d0b47bc6d9a2735dc2ae814c05c6019 Mon Sep 17 00:00:00 2001 From: David Brazda Date: Thu, 27 Jun 2024 13:35:53 +0200 Subject: [PATCH] Update README.md --- README.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/README.md b/README.md index 6f8ecac..c51bff5 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,35 @@ ch = chart([pane1, pane2], sync=True, title="Title", size="l", xloc=slice("1-1-2 ``` +## Example with markers + +```python + +#assume i want to display simple entries or exits on series or ohlcv +#based on tuple positions it determines entries or exits (and set colors and shape accordingly) +pane1 = Panel( + ohlcv=(ohlcv_df, clean_long_entries, clean_short_entries) +) +ch = chart([pane1], title="Chart with Entry/Exit Markers", session=None, size="s") +``` +image + +```python +#if you want to display more entries or exits, use tuples with their colors + +# Create Panel with OHLC data and entry signals +pane1 = Panel( + ohlcv=(data.ohlcv.get(), + [(clean_long_entries, "yellow"), (clean_short_entries, "pink")], #list of entries tuples with color + [(clean_long_exits, "yellow"), (clean_short_exits, "pink")]), #list of exits tuples with color +) + +# # Create the chart with the panel +ch = chart([pane1], title="Chart with EntryShort/ExitShort (yellow) and EntryLong/ExitLong markers (pink)", sync=True, session=None, size="s") +``` +image + +
# lightweight-charts-python