Is it possible to add a date to the time axis by the cursor (for minute charts)? I know it's not possible by default, my question is if it can be programmed?
Thank you
Indicator 'Datum': Error on calling 'OnRender' method on bar 327: You are accessing an index with a value that is invalid since it is out-of-range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart. |
protected override void OnRender(ChartControl chartControl, ChartScale chartScale) { for (int index = Math.Max(1,ChartBars.FromIndex); index <= CurrentBars[0]; index++) { double widthOfPartBar1 = chartControl.GetBarPaintWidth(ChartBars) / 2.3; float offsetWidth1 = Math.Max(2f,(int)widthOfPartBar1); float xStart = chartControl.GetXByBarIndex(ChartBars, index); float xoff1 = xStart - offsetWidth1; float yStart = ChartPanel.H - 20; [B]DateTime timeValue = Time.GetValueAt(index);[/B] [B]int day = timeValue.Day;[/B] string dayString = day.ToString(); [B]int month = timeValue.Month;[/B] string monthString = month.ToString(); string dateString = dayString+"."+monthString+"."; //TextLayouts // define the point for the text to render SharpDX.Vector2 startPoint1 = new SharpDX.Vector2(xoff1, yStart); // construct the text format with desired font family and size SharpDX.DirectWrite.TextFormat textFormat = new SharpDX.DirectWrite.TextFormat(Core.Globals.Direct WriteFactory, "Arial", 18); // construct the text layout with desired text, text format, max width and height // SharpDX.DirectWrite.TextLayout textLayout1 = new SharpDX.DirectWrite.TextLayout(Core.Globals.Direct WriteFactory, timeValue, textFormat, ChartPanel.W, ChartPanel.H); SharpDX.DirectWrite.TextLayout textLayout1 = new SharpDX.DirectWrite.TextLayout(Core.Globals.Direct WriteFactory, dateString, textFormat, ChartPanel.W, ChartPanel.H); // create a rectangle which will automatically resize to the width/height of the textLayout SharpDX.RectangleF rectangleF1 = new SharpDX.RectangleF(xoff1, yStart, textLayout1.Metrics.Width, textLayout1.Metrics.Height); // define the brush used for the text and rectangle SharpDX.Direct2D1.SolidColorBrush customDXBrush1 = new SharpDX.Direct2D1.SolidColorBrush(RenderTarget, SharpDX.Color.White); // execute the render target text layout command with desired values RenderTarget.DrawTextLayout(startPoint1, textLayout1, customDXBrush1); // always dispose of textLayout, textFormat, or brush when finished textFormat.Dispose(); textLayout1.Dispose(); customDXBrush1.Dispose(); } }
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by algospoke, 04-17-2024, 06:40 PM
|
6 responses
49 views
0 likes
|
Last Post
by algospoke
Today, 06:18 PM
|
||
Started by arvidvanstaey, Today, 02:19 PM
|
4 responses
11 views
0 likes
|
Last Post Today, 04:08 PM | ||
Started by samish18, 04-17-2024, 08:57 AM
|
16 responses
61 views
0 likes
|
Last Post
by samish18
Today, 03:30 PM
|
||
Started by jordanq2, Today, 03:10 PM
|
2 responses
9 views
0 likes
|
Last Post
by jordanq2
Today, 03:23 PM
|
||
Started by traderqz, Today, 12:06 AM
|
10 responses
21 views
0 likes
|
Last Post
by traderqz
Today, 02:49 PM
|
Futures, foreign currency and options trading contains substantial risk and is not for every investor. An investor could potentially lose all or more than the initial investment. Risk capital is money that can be lost without jeopardizing one’s financial security or lifestyle. Only risk capital should be used for trading and only those with sufficient risk capital should consider trading. Past performance is not necessarily indicative of future results. View Full Risk Disclosure.
CFTC Rules 4.41 - Hypothetical or Simulated performance results have certain limitations, unlike an actual performance record, simulated results do not represent actual trading. Also, since the trades have not been executed, the results may have under-or-over compensated for the impact, if any, of certain market factors, such as lack of liquidity. Simulated trading programs in general are also subject to the fact that they are designed with the benefit of hindsight. No representation is being made that any account will or is likely to achieve profit or losses similar to those shown.
This website is hosted and operated by NinjaTrader, LLC (“NT”), a software development company which owns and supports all proprietary technology relating to and including the NinjaTrader trading platform. NT is an affiliated company to NinjaTrader Brokerage (“NTB”), which is a NFA registered introducing broker (NFA #0339976) providing brokerage services to traders of futures and foreign exchange products. This website is intended for educational and informational purposes only and should not be viewed as a solicitation or recommendation of any product, service or trading strategy. No offer or solicitation to buy or sell securities, securities derivative or futures products of any kind, or any type of trading or investment advice, recommendation or strategy, is made, given, or in any manner endorsed by any NT affiliate and the information made available on this Web site is not an offer or solicitation of any kind. Specific questions related to a brokerage account should be sent to your broker directly. The content and opinions expressed on this website are those of the authors and do not necessarily reflect the official policy or position of NT or any of its affiliates.
Vendors along with their websites, products and services, collectively referred to as (“Vendor Content”), are independent persons or companies that are in no manner affiliated with NT or any if its affiliates. NT or any of its affiliates are not responsible for, do not approve, recommend or endorse any Vendor Content referenced on this website and it’s your sole responsibility to evaluate Vendor Content. Please be aware that any performance information provided by a vendor should be considered hypothetical and must contain the disclosures required by NFA Rule 2-29(c). If you are interested in learning more about, or investigating the quality of, any such Vendor Content you must contact the vendor, provider or seller of such Vendor Content. No person employed by, or associated with, NT or any of its affiliates is authorized to provide any information about any such Vendor Content.
Comment