Add Entry/Exit points to OHLC chart

StanSz

Board Regular
Joined
Sep 18, 2004
Messages
199
I have an OHLC stock chart with candlesticks -- it works well.

Now, I would like to add occasional price entry and exit points to this same candlestock chart.

I have five columns of data, Date (for the labels), and then the OHLC prices.

I have added two additional columns for the price entry and exit points. These columns are empty except for the occasional price which appears whenever there is an entry or an exit indicated on a specific date.

I want to have these entry/exit points appear on the OHLC candlestick charts -- they would end up over the daily date candlestick for whatever date the entry or exit occurs.

By changing the chart type to Line, I can get these entry/exit points to appear on the chart, (when I add an Entry and an Exit series), but in doing so I loose seeing the candlesticks, and I end up with just a line graph. I can't switch back to the OHLC type since I get error messages, and I need to delete the two entry/exit series to return to the candlesticks.

Is there a way for me to keep the candlesticks and yet have the entry/exit points appear. ??

Thanks

Stan
 
This is a follow-up after a PM from @jetpack, regarding this thread.
Features of the example below:


  • Runs automatically when the sheet is activated. Can be adapted to perform on multiple charts.
  • Text in data labels is formatted.
  • Defines data label positioning.
  • Applies to several chart types, not only candlestick.

Code:
'Sheet Module

Private Sub Worksheet_Activate()
Dim d As DataLabels, ch As Chart
Set ch = Me.ChartObjects("chart 4").Chart           ' your chart name here
ch.FullSeriesCollection(2).HasDataLabels = 1
Set d = ch.FullSeriesCollection(2).DataLabels       ' your series index here
d.Position = xlLabelPositionAbove
With d.Format.TextFrame2.TextRange.Font.Fill
    .Visible = msoTrue
    .ForeColor.ObjectThemeColor = msoThemeColorAccent2
    .ForeColor.TintAndShade = 0.1
    .ForeColor.Brightness = -0.3
    .Transparency = 0.2
    .Solid
End With
d.Format.TextFrame2.TextRange.Font.Size = 14
End Sub

Dear worf,

Thanks for the update and the code. I won't get to play with this until the end of the month. But I just wanted to acknowledge your effort, and that of jetpack, and the time and insight involved.

Best wishes in your coding, and trading.

Thanks again.

Stansz
 
Upvote 0

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
thanks alot mate, gunna give it a go later tonight and see how she flies. right *******s i bet. I'll let ya' know how it goes. really appreciate it.
 
Upvote 0
worf, thanks for replying earlier.

ran the code and got the message "Invalid use of Me ..."

using xl 2016
 
Upvote 0
The code goes at the sheet module. Did you place it at a regular module (Module1, Module2…?)
 
Upvote 0

Forum statistics

Threads
1,224,755
Messages
6,180,751
Members
452,996
Latest member
nelsonsix66

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