View Full Version : DrawHorizontalLine affects auto mode price scale
ATI user
10-14-2009, 07:24 AM
DrawHorizontalLine("priceline",true,Close[0],Color.Gold,DashStyle.DashDotDot,1);
the above line in my cs indicator causes the price scale to change from normal for the day, say 9900 to 9950 for the YM to 9900 to 20000...which compresses the chart of course
changing bool back to false solves problem
NinjaTrader_Ray
10-14-2009, 07:28 AM
DrawHorizontalLine("priceline",true,Close[0],Color.Gold,DashStyle.DashDotDot,1);
the above line in my cs indicator causes the price scale to change from normal for the day, say 9900 to 9950 for the YM to 9900 to 20000...which compresses the chart of course
changing bool back to false solves problem
What value has been passed in for Close[0] and setting the bool to true will include this line value in the automatica scale generation...so that is expected. Just need to know the line value.
ATI user
10-14-2009, 08:53 AM
Per email from Josh I printed out all values of Close[0]....see pic
during this time span, the scale when back and forth from normal up to 10,000
however, no abnormal/out of range values were printed
NinjaTrader_Josh
10-14-2009, 09:06 AM
Do you have a demo script we could try on our end? Thank you.
ATI user
10-14-2009, 09:21 AM
ran this code below and did not have a problem
same code in my cs does have problem
so must be some conflict within my code
......................
public class MyCustomIndicator : Indicator
{
#region Variables
// Wizard generated variables
private int myInput0 = 1; // Default setting for MyInput0
// User defined variables (add any user defined variables below)
#endregion
/// <summary>
/// This method is used to configure the indicator and is called once before any bar data is loaded.
/// </summary>
protected override void Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
CalculateOnBarClose = false;
Overlay = false;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Use this method for calculating your indicator values. Assign a value to each
// plot below by replacing 'Close[0]' with your own formula.
Plot0.Set(Close[0]);
DrawHorizontalLine("priceline",true,Close[0],Color.Gold,DashStyle.DashDotDot,1);
Print (Close[0]);
NinjaTrader_Josh
10-14-2009, 09:42 AM
ATI user,
Maybe look around for other objects that may be using the AutoScale as well.