Profile Picture

DefaultDrawingPane Modification

Posted By steveo 8 Years Ago
Message
Posted Tuesday July 07 2009
I want to change the DefaultDrawingPane based on parameters that are entered on the parameters screen when an indicator is dragged from the indicator pane to the chart pane.  At times, I may want it to be the Price Pane and other times, I will want the indicator to be drawn in its own pane.  I initially set the value of the DefaultDrawingPane in the class definition using the YYEIndicatorAttribute template.

I am somewhat new to C# but it looks like, from the documentation, it might be possible through the IndicatorPlugin interface or IndicatorAttribute class. I just can't figure out how to use these to expose the property to reset it.

Is there a way to either SET the DefaultDrawingPane based on an argument passed to the class constructor or CHANGE the DefaultDrawingPane based on the argument passed to the constructor?  

Thanks in advance for any assistance provided

c# newbie Steveo

Posted Wednesday July 08 2009
The attributes are used as defaults. You can certainly change them or have the user enter them. It would be similar to asking the user for the number of periods in their simple moving average. Use a ConstructorArgument. Each indicator has a ChartSettings instance that holds the chart information. So if the user selects a pane name, you could set ChartSettings.ChartPaneName in the constructor.

steveo (7/7/2009)
I want to change the DefaultDrawingPane based on parameters that are entered on the parameters screen when an indicator is dragged from the indicator pane to the chart pane. At times, I may want it to be the Price Pane and other times, I will want the indicator to be drawn in its own pane. I initially set the value of the DefaultDrawingPane in the class definition using the YYEIndicatorAttribute template.

I am somewhat new to C# but it looks like, from the documentation, it might be possible through the IndicatorPlugin interface or IndicatorAttribute class. I just can't figure out how to use these to expose the property to reset it.

Is there a way to either SET the DefaultDrawingPane based on an argument passed to the class constructor or CHANGE the DefaultDrawingPane based on the argument passed to the constructor?

Thanks in advance for any assistance provided

c# newbie Steveo
Posted Wednesday July 08 2009
Thanks Bill.  I continue to have a problem though.  The chart below shows the same indicator plotted in two chart panes.  For the one in the Price Pane, I set the Drawing pane in the dialog box that comes up when I drag the indicator to the chart.  This works the way I want and would expect.  For the indicator in the pane below the volume pane, this is how it was drawn using the defaults that come up in the dialog box.  Both Indicators were of type 3 when they go through the code.  The 'GannTrend' can be seen as the chart name in the properties section in the lower right of the screen

Below is the Indicator Attributes and the constructor I am using.  When I step through the code, it looks like it changes the 'ChartPaneName' to the correct value ('PricePane') in the code but it does not draw the indicator in the price pane unless I change it to Price Pane in the dialog box.  As an aside, I have tried 'PricePane' and 'Price Pane'. 

I have tried this both going through the VS debugger as well as stand-alone and get the same results.  Pardon the looks of the code below but I am curious because it seems like I am doing the right thing but either referencing the wrong object or missing a line of code that I need.  Thanks for taking a look at this and as an aside, I like the product but need to improve my c# knowledge

Thanks

Steve

namespace myIndicator

{

[YYEIndicatorAttribute(System.Drawing.KnownColor.Blue,

YYEIndicatorAttribute.EIndicatorGroup.Other, GroupName = "Gann", Author = "steveo", DefaultDrawingPane = "GannTrend",Name = "Gann Swing Direction Indicator", Version = "1.0", Id = "90dd0e3f-cb04-47ee-9055-b2836e89038b",)]

[Serializable]

[SeriesInputAttribute("Open", 1, Value = BarElement.Open)]

[SeriesInputAttribute("High", 2, Value = BarElement.High)]

[SeriesInputAttribute("Low", 3, Value = BarElement.Low)]

[SeriesInputAttribute("Close", 4, Value = BarElement.Close)]

public class GannTrend : SeriesCalculatorBaseWithValues

{

private int indType = 1;

// index values

private int OPEN_SERIES = 0;

private int HIGH_SERIES = 1;

private int LOW_SERIES = 2;

private int CLOSE_SERIES = 3;

// Class variables

private int cnt = 0;

private int wasInsideDay = 0;

private double peak = double.NaN;

private double valley = double.NaN;

private double svpk = double.NaN;

private double todaysSlope = double.NaN;

private double yesterdaysSlope = double.NaN;

// CONSTRUCTOR

public GannTrend(int indicatorType)

: base(4)

{

if (indicatorType >= 1 && indicatorType <= 4)

{

this.indType = indicatorType;

switch (this.indType)

{

case 1:

this.ChartSettings.ChartPaneName = "GannSlope";

break;

case 2: this.ChartSettings.ChartPaneName = "GannTrend";

break;

case 3: this.ChartSettings.ChartPaneName = "PricePane";    // I have tried with 'Price Pane' and get same result

break;

case 4: this.ChartSettings.ChartPaneName = "PricePane";

break;

default: throw new ArgumentException("Indicator Type must be between 1 and 4");

}}

else

{throw new ArgumentException("Indicator Type must be between 1 and 4");

}}

Posted Thursday July 09 2009
There's nothing I can see wrong with your code, but RightEdge doesn't support exactly what you are trying to do. When you drag an indicator onto the chart it pops up the dialog where you can set the indicator parameters and chart settings. The default selection is based on what you specified in the attribute. The indicator hasn't been constructed yet so it can't be based on your constructor logic. When you hit OK on the dialog, the indicator is created. Your custom code runs to set the chart settings, but after that RightEdge uses the chart pane that was selected in the dialog, since the user could have overridden the default.

If you use create the indicator from code in a system, your defaults will work as you want.

Thanks,
Daniel
Posted Thursday July 09 2009
Daniel

Thanks for the reply.  I will just get in the habit of making sure I set the drawing pane in the dialog box.  I am just trying to be lazy.

Thanks

Steve



Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems