Here's the First Goal. To put my indicator on a USD/JPY (just for example) chart, and have it read the Volume from 6J.
Can someone show me how to do this.
Thank you!!
protected override void Initialize() { Add(6J, PeriodType.Minute, 5); }
/// <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(6J 06-14, PeriodType.Minute, 5); Overlay = false; } /// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { //Compare Volume of current bar to 5 minute if (Volumes[0][0] > Volumes[1][0]) Print("The current bar's volume price is greater"); }
protected override void Initialize() { Add("6J 6-14", PeriodType.Minute, 5); } /// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { //Compare Volume of current bar to 5 minute if (Volumes[0][0] < Volumes[1][0]) Print("The current bar's volume price is Smaller"); };
if(CurrentBar < BarsRequired) return;
protected override void Initialize () { Add (new Plot (new Pen (Color.Red, 3), PlotStyle.Line, "VolumePlot")); Add ("6J 06-14", PeriodType.Minute, 5); Overlay = false; } protected override void OnBarUpdate () { if (CurrentBar < BarsRequired) return; if (Volumes [0] [0] > Volumes [1] [0]) VolumePlot.Set (Volumes [1] [0]); Print ("The current bar's volume price is greater"); } #region Properties [Browsable (false)] [XmlIgnore ()] public DataSeries VolumePlot { get { return Values [0]; } } #endregion } }
if (Volumes [0] [0] < Volumes [1] [0])
#region Using declarations using System; using System.ComponentModel; using System.Diagnostics; using System.Drawing; using System.Drawing.Drawing2D; using System.Xml.Serialization; using NinjaTrader.Cbi; using NinjaTrader.Data; using NinjaTrader.Gui.Chart; #endregion // This namespace holds all indicators and is required. Do not change it. namespace NinjaTrader.Indicator { /// <summary> /// Enter the description of your new custom indicator here /// </summary> [Description("Enter the description of your new custom indicator here")] public class CustomVolume : Indicator { #region Variables // Wizard generated variables private int myInput0 = 1; // Default setting for MyInput0 private string InstrumentName = " "; private string contract = " "; // User defined variables (add any user defined variables below) private bool useFutures = true; //Ask User if they want to use Futures Volume for FOREX #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 () { //Adding Volume per instruments InstrumentName = (Instrument.FullName.ToString()); if(InstrumentName == "$USDJPY") {contract = "6J 06-14";} Add (new Plot (new Pen (Color.Red, 3), PlotStyle.Line, "VolumePlot")); Add ( "6J 06-14", PeriodType.Minute, 5); Overlay = false; } protected override void OnBarUpdate () { if (CurrentBar < BarsRequired) return; if (Volumes [0] [0] > Volumes [1][0]) VolumePlot.Set(Volumes [1][0]); Print ("The current bar's volume price is greater"); } #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 VolumePlot { get { return Values [0]; } } [Description("")] [GridCategory("Parameters")] public int MyInput0 { get { return myInput0; } set { myInput0 = Math.Max(1, value); } } [Description("Use Futures Volume For FOREX")] [GridCategory("Parameters")] public bool UseFuturesVolume { get { return useFutures; } set { useFutures = value; } } #endregion } } #region NinjaScript generated code. Neither change nor remove. // This namespace holds all indicators and is required. Do not change it. namespace NinjaTrader.Indicator { public partial class Indicator : IndicatorBase { private CustomVolume[] cacheCustomVolume = null; private static CustomVolume checkCustomVolume = new CustomVolume(); /// <summary> /// Enter the description of your new custom indicator here /// </summary> /// <returns></returns> public CustomVolume CustomVolume(int myInput0, bool useFuturesVolume) { return CustomVolume(Input, myInput0, useFuturesVolume); } /// <summary> /// Enter the description of your new custom indicator here /// </summary> /// <returns></returns> public CustomVolume CustomVolume(Data.IDataSeries input, int myInput0, bool useFuturesVolume) { if (cacheCustomVolume != null) for (int idx = 0; idx < cacheCustomVolume.Length; idx++) if (cacheCustomVolume[idx].MyInput0 == myInput0 && cacheCustomVolume[idx].UseFuturesVolume == useFuturesVolume && cacheCustomVolume[idx].EqualsInput(input)) return cacheCustomVolume[idx]; lock (checkCustomVolume) { checkCustomVolume.MyInput0 = myInput0; myInput0 = checkCustomVolume.MyInput0; checkCustomVolume.UseFuturesVolume = useFuturesVolume; useFuturesVolume = checkCustomVolume.UseFuturesVolume; if (cacheCustomVolume != null) for (int idx = 0; idx < cacheCustomVolume.Length; idx++) if (cacheCustomVolume[idx].MyInput0 == myInput0 && cacheCustomVolume[idx].UseFuturesVolume == useFuturesVolume && cacheCustomVolume[idx].EqualsInput(input)) return cacheCustomVolume[idx]; CustomVolume indicator = new CustomVolume(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.MyInput0 = myInput0; indicator.UseFuturesVolume = useFuturesVolume; Indicators.Add(indicator); indicator.SetUp(); CustomVolume[] tmp = new CustomVolume[cacheCustomVolume == null ? 1 : cacheCustomVolume.Length + 1]; if (cacheCustomVolume != null) cacheCustomVolume.CopyTo(tmp, 0); tmp[tmp.Length - 1] = indicator; cacheCustomVolume = tmp; return indicator; } } } } // This namespace holds all market analyzer column definitions and is required. Do not change it. namespace NinjaTrader.MarketAnalyzer { public partial class Column : ColumnBase { /// <summary> /// Enter the description of your new custom indicator here /// </summary> /// <returns></returns> [Gui.Design.WizardCondition("Indicator")] public Indicator.CustomVolume CustomVolume(int myInput0, bool useFuturesVolume) { return _indicator.CustomVolume(Input, myInput0, useFuturesVolume); } /// <summary> /// Enter the description of your new custom indicator here /// </summary> /// <returns></returns> public Indicator.CustomVolume CustomVolume(Data.IDataSeries input, int myInput0, bool useFuturesVolume) { return _indicator.CustomVolume(input, myInput0, useFuturesVolume); } } } // This namespace holds all strategies and is required. Do not change it. namespace NinjaTrader.Strategy { public partial class Strategy : StrategyBase { /// <summary> /// Enter the description of your new custom indicator here /// </summary> /// <returns></returns> [Gui.Design.WizardCondition("Indicator")] public Indicator.CustomVolume CustomVolume(int myInput0, bool useFuturesVolume) { return _indicator.CustomVolume(Input, myInput0, useFuturesVolume); } /// <summary> /// Enter the description of your new custom indicator here /// </summary> /// <returns></returns> public Indicator.CustomVolume CustomVolume(Data.IDataSeries input, int myInput0, bool useFuturesVolume) { if (InInitialize && input == null) throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method"); return _indicator.CustomVolume(input, myInput0, useFuturesVolume); } } } #endregion
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by sidlercom80, 10-28-2023, 08:49 AM
|
168 responses
2,262 views
0 likes
|
Last Post
by sidlercom80
Today, 12:05 AM
|
||
Started by Barry Milan, Yesterday, 10:35 PM
|
3 responses
10 views
0 likes
|
Last Post Yesterday, 11:58 PM | ||
Started by WeyldFalcon, 12-10-2020, 06:48 PM
|
14 responses
1,429 views
0 likes
|
Last Post
by Handclap0241
Yesterday, 10:43 PM
|
||
Started by DJ888, 04-16-2024, 06:09 PM
|
2 responses
9 views
0 likes
|
Last Post
by DJ888
Yesterday, 10:31 PM
|
||
Started by jeronymite, 04-12-2024, 04:26 PM
|
3 responses
41 views
0 likes
|
Last Post
by jeronymite
Yesterday, 10:10 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