NexusFi: Find Your Edge


Home Menu

 





Trouble using custom drawing in MultiCharts.NET


Discussion in MultiCharts

Updated
    1. trending_up 1,907 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 4 posts
    2. attach_file 0 attachments




 
 

Trouble using custom drawing in MultiCharts.NET

 
Antny
Springfield United States
 
Posts: 2 since Sep 2014
Thanks Given: 0
Thanks Received: 0

I have not had any luck getting an answer elsewhere, so....I thought I would try here.

All I am trying to do is figure out how to get a simple filled trapezoid to render on a chart. I have referenced all the examples the MultiCharts.NET has in this area, but to no avail. The biggest problem I am having is, the code I have shows no errors, so I don't even have a clue where I might be screwing up.

Here is what I am requesting. Can someone have a look at my code and show me why/what/how so I can make this platform useful? Any help will be greatly appreciated. Here is my source code.

 
Code
using System;
using System.Drawing;
using PowerLanguage.Function;
using System.Drawing.Drawing2D;

namespace PowerLanguage.Indicator
{
  public class NewTest_CustomDraw : IndicatorObject, IChartCustomDrawer
  {
    public NewTest_CustomDraw( object _ctx ) : base(_ctx)
    {
    }

    protected override void Create()
    {
      ChartCustomDraw.Register( this );
    }

    protected override void StartCalc()
    {                                                         
    }

    protected override void CalcBar()
    {
      ChartCustomDraw.ReDraw();
    }

    protected override void Destroy()
    {
      ChartCustomDraw.Unregister( this );
    }
    
    void IChartCustomDrawer.Draw( DrawContext context, EDrawPhases phase )
    {
        if (Bars.LastBarOnChart)
        {
            if (phase == EDrawPhases.BeforeFGShapes && context.DrawRect == context.FullRect)
            {
                Diamond g = new Diamond();

                PointF one = context.Environment.ChartPoint2Point(new ChartPoint { Price = Bars.Low[0], Time = Bars.Time[0] });
                PointF two = context.Environment.ChartPoint2Point(new ChartPoint { Price = Bars.High[10], Time = Bars.Time[10] });
                PointF three = context.Environment.ChartPoint2Point(new ChartPoint { Price = Bars.Low[27], Time = Bars.Time[27] });
                PointF four = context.Environment.ChartPoint2Point(new ChartPoint { Price = Bars.High[49], Time = Bars.Time[49] });

                g.RenderPoly(context.graphics, one, two, three, four);
            }
        }
    }
  }

  public class Diamond
  {
    public Diamond()
    {
    }

    public void RenderPoly(Graphics g, PointF x, PointF a, PointF b, PointF c)
    {
        PointF[] setPoints = new PointF[] {x, a, b, c};
		g.FillPolygon(Brushes.AliceBlue, setPoints);
    }
  }
}


Can you help answer these questions
from other members on NexusFi?
NexusFi Journal Challenge - April 2024
Feedback and Announcements
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
ZombieSqueeze
Platforms and Indicators
Deepmoney LLM
Elite Quantitative GenAI/LLM
Are there any eval firms that allow you to sink to your …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
61 thanks
Funded Trader platforms
38 thanks
NexusFi site changelog and issues/problem reporting
27 thanks
GFIs1 1 DAX trade per day journal
18 thanks
The Program
18 thanks
 
Antny
Springfield United States
 
Posts: 2 since Sep 2014
Thanks Given: 0
Thanks Received: 0

12 views and nobody has any ideas. It isn't looking hopeful at this point.

 
 
Jura's Avatar
 Jura   is a Vendor
 
Posts: 775 since Apr 2010
Thanks Given: 2,352
Thanks Received: 690


For those who come across this topic and are inclined to spend time to answer it, the question of the topic starter has already been answered on the MultiCharts forum.

 
 
Jasonnator's Avatar
 Jasonnator 
Denver, Colorado United States
 
Experience: Intermediate
Platform: NT8 + Custom
Broker: NT Brokerage, Kinetick, IQFeed, Interactive Brokers
Trading: ES
Posts: 159 since Dec 2014
Thanks Given: 40
Thanks Received: 166

I am working on this as well. One of my systems is trading patterns so it'd be nice to be able to draw them programatically. I called MC support and asked if it would be against the EULA if I extended the drawing interfaces and classes. They said it wouldn't despite the code being in a compiled dll (which is not obfuscated). I specifically asked if it was within the EULA to decompile it, create a project then extend the functionality. Again, they said no problem and that I could share the project. Their only concern was whether I had purchased a license or not, which I have.

If anyone else is interested in contributing to extending multicharts .net drawing capabilities, I be up for getting a github repository going.

Jason

 
 
Jasonnator's Avatar
 Jasonnator 
Denver, Colorado United States
 
Experience: Intermediate
Platform: NT8 + Custom
Broker: NT Brokerage, Kinetick, IQFeed, Interactive Brokers
Trading: ES
Posts: 159 since Dec 2014
Thanks Given: 40
Thanks Received: 166

Quick down and dirty solution here. Code is attached.


 



Last Updated on May 4, 2015


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts