Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Here's a script to convert indicators and strategies

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • miroslav
    replied
    Hello,

    I had similar issue. You need to have .net frame.4.5 or higher. Download idealy .net frame 4.6 and you should be ok.

    Miroslav

    Leave a comment:


  • bobc635
    replied
    Getting a few errors in preparation

    Hello, I have done the LinqPad download and modified your script as described. When I load the script I get an error that says that "System.Resource.ResourceManager 4.0.0 requires NuGet client version 3.0 or above, but current NuGet version is 2.8.50926.602. How do I get the newer version, or is there some other issue that I have???

    Then, when I run the script I get an error that says the 'CodeAnalysis does not exits in the namespace 'Microsoft'.... THis is all foreign to me, but I can usually hack my way through issues...

    Thanks
    Bob

    Leave a comment:


  • NinjaTrader_PatrickH
    replied
    Hello maaz1598,

    Thank you for your post.

    There would not be a Dispose for indicators, you would instead use the State or Terminated to process any clean up: http://ninjatrader.com/support/helpG...n-us/state.htm

    Leave a comment:


  • maaz1598
    replied
    mysterious disappearance

    i tried the conversion to NT8 it worked perfectly fine for all my strategies expect for one indicator(actually 3 indicators but i dont care about the other 2 ), its not a default NT7 indicator i tried in many different ways to convert it but it dosnt seem to work it keeps giving me error that it cant find anything to override a method called "protected override void Dispose" with my very basic knowledge of C# i cant find this ghost method called Dispose
    it seemed to disappear mysteriously?
    some one please take a look at it

    thank you in advance
    Attached Files

    Leave a comment:


  • Muratello
    replied
    The request a cancellation

    Excuse me, please! The request a cancellation.
    It appears NT7 has accepted ZLRAlert from NT6.5
    It is simple magic what that. I suspect NT7 is secretly in love in Woodie'sCCI.
    This real magic.

    Leave a comment:


  • Muratello
    replied
    Convert indicator ZLRAlert for NT6.5 in NT7

    Hello
    If not will complicate, is possible to convert indicator ZLRAlert for NT6.5 in
    NT7... Well and for NT8.
    Beforehand - huge thank!
    Attached Files

    Leave a comment:


  • NinjaTrader_PatrickH
    replied
    Hello Kuvala,

    Thank you for your post and welcome to the NinjaTrader Support Forum!

    It would be recommended to start a new thread for new items in the future.

    For your errors double click on each and take a screenshot of the line of code that is highlighted. Attach the screenshots to your response.

    Leave a comment:


  • Kuvala
    replied
    Getting error while converting using this tool

    Attached the error details.Need help.
    Attached Files

    Leave a comment:


  • Dolfan
    replied
    ....and part 2


    #region Properties
    [Description("Numbers of bars used for calculations")]
    [Category("Parameters")]
    public int Period
    {
    get { return period; }
    set { period = Math.Max(1, value); }
    }

    [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 UpperMagenta
    {
    get { return Values[0]; }
    }

    [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 UpperRed
    {
    get { return Values[1]; }
    }

    [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 UpperYellow
    {
    get { return Values[2]; }
    }

    [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 Open
    {
    get { return Values[3]; }
    }
    [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 LowerYellow
    {
    get { return Values[4]; }
    }

    [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 LowerRed
    {
    get { return Values[5]; }
    }

    [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 LowerMagenta
    {
    get { return Values[6]; }
    }


    #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 AAASRLines[] cacheAAASRLines = null;

    private static AAASRLines checkAAASRLines = new AAASRLines();

    /// <summary>
    /// Enter the description of your new custom indicator hereSupport and Resistance lines based on performance over the past 2 weeks or other period as denoted in period Type
    /// </summary>
    /// <returns></returns>
    public AAASRLines AAASRLines(int period)
    {
    return AAASRLines(Input, period);
    }

    /// <summary>
    /// Enter the description of your new custom indicator hereSupport and Resistance lines based on performance over the past 2 weeks or other period as denoted in period Type
    /// </summary>
    /// <returns></returns>
    public AAASRLines AAASRLines(Data.IDataSeries input, int period)
    {
    if (cacheAAASRLines != null)
    for (int idx = 0; idx < cacheAAASRLines.Length; idx++)
    if (cacheAAASRLines[idx].Period == period && cacheAAASRLines[idx].EqualsInput(input))
    return cacheAAASRLines[idx];

    lock (checkAAASRLines)
    {
    checkAAASRLines.Period = period;
    period = checkAAASRLines.Period;

    if (cacheAAASRLines != null)
    for (int idx = 0; idx < cacheAAASRLines.Length; idx++)
    if (cacheAAASRLines[idx].Period == period && cacheAAASRLines[idx].EqualsInput(input))
    return cacheAAASRLines[idx];

    AAASRLines indicator = new AAASRLines();
    indicator.BarsRequired = BarsRequired;
    indicator.CalculateOnBarClose = CalculateOnBarClose;
    #if NT7
    indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
    indicator.MaximumBarsLookBack = MaximumBarsLookBack;
    #endif
    indicator.Input = input;
    indicator.Period = period;
    Indicators.Add(indicator);
    indicator.SetUp();

    AAASRLines[] tmp = new AAASRLines[cacheAAASRLines == null ? 1 : cacheAAASRLines.Length + 1];
    if (cacheAAASRLines != null)
    cacheAAASRLines.CopyTo(tmp, 0);
    tmp[tmp.Length - 1] = indicator;
    cacheAAASRLines = 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 hereSupport and Resistance lines based on performance over the past 2 weeks or other period as denoted in period Type
    /// </summary>
    /// <returns></returns>
    [Gui.Design.WizardCondition("Indicator")]
    public Indicator.AAASRLines AAASRLines(int period)
    {
    return _indicator.AAASRLines(Input, period);
    }

    /// <summary>
    /// Enter the description of your new custom indicator hereSupport and Resistance lines based on performance over the past 2 weeks or other period as denoted in period Type
    /// </summary>
    /// <returns></returns>
    public Indicator.AAASRLines AAASRLines(Data.IDataSeries input, int period)
    {
    return _indicator.AAASRLines(input, period);
    }
    }
    }

    // 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 hereSupport and Resistance lines based on performance over the past 2 weeks or other period as denoted in period Type
    /// </summary>
    /// <returns></returns>
    [Gui.Design.WizardCondition("Indicator")]
    public Indicator.AAASRLines AAASRLines(int period)
    {
    return _indicator.AAASRLines(Input, period);
    }

    /// <summary>
    /// Enter the description of your new custom indicator hereSupport and Resistance lines based on performance over the past 2 weeks or other period as denoted in period Type
    /// </summary>
    /// <returns></returns>
    public Indicator.AAASRLines AAASRLines(Data.IDataSeries input, int period)
    {
    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.AAASRLines(input, period);
    }
    }
    }
    #endregion

    Leave a comment:


  • Dolfan
    replied
    Here is the syntax for the NT7 indicator. Use the converter and observe the changes. What is confusing to me is the regions in NT8 that are different and not addressed in the NT8 Changes links where the line by line syntax changes are spelled out, but the region changes are not. Note; there is little proprietary about this code as it is simple enough and provides no strategy.

    Dolfan

    PS Text is too long for single post so I will break it up for you at the "#region Properties"

    //
    // Copyright (C) 2007, NinjaTrader LLC <www.ninjatrader.com>.
    // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
    //

    #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>
    [Description("Enter the description of your new custom indicator hereSupport and Resistance lines based on performance over the past 2 weeks or other period as denoted in period Type")]
    public class AAASRLines : Indicator
    {
    #region Variables

    private int sessionCount = 0;
    private double high = 0;
    private double low = 0;
    private double open = 0;
    private double range = 0;
    private int period = 0;
    // 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(PeriodType.Minute, 1440); // Sets the bars for calculations to 1440 minute Bars

    Add(new Plot(Color.FromKnownColor(KnownColor.Magenta), PlotStyle.Line, "UpperMagenta")); //Values 0
    Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Line, "UpperRed")); //Values 1
    Add(new Plot(Color.FromKnownColor(KnownColor.Yellow), PlotStyle.Line, "UpperYellow")); //Values 2
    Add(new Plot(Color.FromKnownColor(KnownColor.Cyan), PlotStyle.Line, "Open")); //Values 3
    Add(new Plot(Color.FromKnownColor(KnownColor.Yellow), PlotStyle.Line, "LowerYellow")); //Values 4
    Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Line, "LowerRed")); //Values 5
    Add(new Plot(Color.FromKnownColor(KnownColor.Magenta), PlotStyle.Line, "LowerMagenta")); //Values 6


    Overlay = true;

    period = 10;
    }

    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {
    // error handling to ensure that there are enough bars in both data series to calcualte past 2 week performance
    if (CurrentBars[0] <= 10 || CurrentBars[1] <= 10)
    return;

    // only process on primary bar updates
    if (BarsInProgress == 1)
    return;

    // recalaulte only on start of new session (for performance)
    if (Bars.FirstBarOfSession)

    // Workaround to the lines "jumping" between sessions
    // for every plot color, set it to transparent for the first bar of session
    for (int i = 0; i < PlotColors.Length; i++)
    PlotColors[i][0] = Color.Transparent;

    // calcualte the average high/low from last period(s) as denoted above
    // the "SUM" methods below use "highs" and "lows" from 1440 minute data series
    // i.e., highs[1] and lows[1]
    {
    high = Instrument.MasterInstrument.Round2TickSize(SUM(Hig hs[1], period)[0] / period);
    low = Instrument.MasterInstrument.Round2TickSize(SUM(Low s[1], period)[0] / period);
    range = high - low;

    // get the current days opening from the primary bar
    open = CurrentDayOHL(BarsArray[0]).CurrentOpen[0];

    }
    // do not plot if open price has not been set
    if(open == 0)
    return;

    //Support and Resistance Lines as depicted by ranges calculated over the past 2 weeks or other period as noted in "periods".
    {
    UpperMagenta.Set(open + ((range)));
    UpperRed.Set(open + ((range) / 2));
    UpperYellow.Set(open + (((range) / 2) / 2));
    Open.Set(open);
    LowerYellow.Set(open - (((range) / 2) / 2));
    LowerRed.Set(open - ((range) / 2));
    LowerMagenta.Set(open - ((range)));
    }

    }

    #region Properties

    Leave a comment:


  • Dolfan
    replied
    Let me get back to you on this. I haven't even opened Ninja in a few weeks as I have been trading with Rithmic these days.

    Best regards,

    Dolfan

    Leave a comment:


  • aligator
    replied
    Originally posted by Dolfan View Post
    aligator, can you tell me about some of your minor coding solutions? I made an indicator in NT7 that works quite well and seemed to convert using the aforementioned tool here but it doesn't work in NT8. The Ninja team was a great help in my initial NT7 efforts but now, with NT8, the ipso defacto response has turned into, "here is a list of programmers you can hire to help". Needless to say I am frustrated with it.

    Understanding the simple line item changes as displayed in the forum is simple enough and the tool makes it even easier but there are structural changes to the code that are not addressed that have me stumped. For example, there are regions changes that are not outlined in the code changes. I feel like this is where my problem lies but there is little support to help me solve this issue.

    Thanks for any insight you can provide.

    Best regards,

    Dolfan
    I basically use this tool to convert indicators from NT7 to NT8, then compile and try to address the errors, most of which are related to rendering, text, and graphics. My coding skills are limited, so I dig in whatever documentation available and try to find something similar, then play with codes. I do not have strategies and fixing indicators is not really that involved.

    Cheers!

    p.s. I know little about regions but If you wish, I can take a look at your indicator and see if I can get it to work in NT8. Having a 35 years collection of indicators, I have no interest in using your intellectual property - just to help, if I can.
    Last edited by aligator; 09-21-2016, 09:49 AM.

    Leave a comment:


  • Dolfan
    replied
    aligator, can you tell me about some of your minor coding solutions? I made an indicator in NT7 that works quite well and seemed to convert using the aforementioned tool here but it doesn't work in NT8. The Ninja team was a great help in my initial NT7 efforts but now, with NT8, the ipso defacto response has turned into, "here is a list of programmers you can hire to help". Needless to say I am frustrated with it.

    Understanding the simple line item changes as displayed in the forum is simple enough and the tool makes it even easier but there are structural changes to the code that are not addressed that have me stumped. For example, there are regions changes that are not outlined in the code changes. I feel like this is where my problem lies but there is little support to help me solve this issue.

    Thanks for any insight you can provide.

    Best regards,

    Dolfan

    Leave a comment:


  • aligator
    replied
    Originally posted by wbennettjr View Post
    Thanks so much for your assistance Serialcoder!

    I apologize for not responding sooner. For some strange reason, I have not been getting emails about new posts.

    Aligator,

    Do you still have issues with conversion? Let me know and include the stacktrace and I'll look into it.

    Wil
    Thanks Wil, I have managed to get some indicators converted, a slow learning curve though, but your tool has been great and requiring only minor coding to make things work.

    But there are some pesky tricks for rendering and drawing. For example, I can not find any documentation for StringFormat to covert the following one line of code from NT7 to NT8:

    private StringFormat stringFormat = new StringFormat();

    Cheers!
    Last edited by aligator; 09-19-2016, 10:08 PM.

    Leave a comment:


  • Dolfan
    replied
    Sorry I missed this question Patrick. I've all but given up on Ninja at this point since I found some really nice features in Rithmic that I am now utilizing. I think I got an answer from someone else that explains how much Ninja is working on putting together NT8 and are not yet at the point that I would like as far as NT7 like menus and instructions on creating script. There are areas that are constructed differently in NT8 that are not fully explained, yet, so I wait with breathless anticipation for that day.

    Best regards,

    Dolfan

    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by GussJ, 03-04-2020, 03:11 PM
11 responses
3,229 views
0 likes
Last Post xiinteractive  
Started by andrewtrades, Today, 04:57 PM
1 response
14 views
0 likes
Last Post NinjaTrader_Manfred  
Started by chbruno, Today, 04:10 PM
0 responses
7 views
0 likes
Last Post chbruno
by chbruno
 
Started by josh18955, 03-25-2023, 11:16 AM
6 responses
441 views
0 likes
Last Post Delerium  
Started by FAQtrader, Today, 03:35 PM
0 responses
12 views
0 likes
Last Post FAQtrader  
Working...
X