i want to plot the last ask and bid so i canplce my stops without getting hit quickly.
hereis my attempt and following are the issues i have
1. it seems to plot at every bar. i want to plot it as 4 dots identifying the last BID and 4 dots identifying the last ASK price only
2. i only see one of them. its the Bid or ASk. i dunno which one is being displayed. maybe i made a mistake in my plot but cannot figure out.
3. i used the wizard to state i want 1 plot but changed the code to add another. how do i get back to the wizard to modify the indicator.
/// plot the ask bar
///</summary>
[Description("plot the ask bar")]
publicclass PlotAsk : Indicator
{
#region Variables
// Wizard generated variables
privateint 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>
protectedoverridevoid Initialize()
{
Add(new Plot(Color.Blue, PlotStyle.Dot, "Bid line"));
Add(new Plot(Color.Red, PlotStyle.Dot, "Ask line"));
ChartOnly = true;
AutoScale = false;
CalculateOnBarClose = false;
DisplayInDataBox = false;
Overlay = true;
PriceTypeSupported = false;
}
///<summary>
/// Called on each bar update event (incoming tick)
///</summary>
protectedoverridevoid 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(GetCurrentBid());
Plot0.Set(GetCurrentAsk());
}
#region Properties
[Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
[XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
public DataSeries Plot0
{
get { return Values[0]; }
}
[Description("")]
[Category("Parameters")]
publicint MyInput0
{
get { return myInput0; }
set { myInput0 = Math.Max(1, value); }
}
#endregion
}
}
Comment