Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

import dll error override indicator

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

    import dll error override indicator

    I have imported some indicators: HilbertTransform and HomodyneDiscriminator (Import NinjaScript). This indicators have their source code.

    I have developed one indicator MoneyWizard. I have exported the indicator (Export NinjaScript) with the option "Export compiled assembly of selected source file " in a dll file.

    MoneyWizard uses some of the imported indicator with source code.

    Now I'm testing my indicator in other PC.
    If in the other PC don't have installed the other indicators (HilbertTransform and HomodyneDiscriminator), I can import MoneyWizard (dll file).

    But If the other PC have installed the others indicator (HilbertTransform and HomodyneDiscriminator) I can't import MoneyWizard (dll file). I get:

    "Import failed. The NinjaScrit Archive File may contain duplicate method names already exist on your PC o required missing on their your PC or in the import archive.


    In the MoneyWizard.cs export file I see:


    namespace NinjaTrader.Indicator
    {
    public partial class Indicator : IndicatorBase
    {
    private HilbertTransform[] cacheHilbertTransform = null;
    private HomodyneDiscriminator[] cacheHomodyneDiscriminator = null;
    private MoneyWizard[] cacheMoneyWizard = null;

    private static HilbertTransform checkHilbertTransform = new HilbertTransform();
    private static HomodyneDiscriminator checkHomodyneDiscriminator = new HomodyneDiscriminator();
    private static MoneyWizard checkMoneyWizard = new MoneyWizard();


    /// <summary>
    /// Enter the description of your new custom indicator here
    /// </summary>
    /// <returns></returns>
    public HilbertTransform HilbertTransform(int wMAPeriods)
    {
    return HilbertTransform(Input, wMAPeriods);
    }

    /// <summary>
    /// Enter the description of your new custom indicator here
    /// </summary>
    /// <returns></returns>
    public HilbertTransform HilbertTransform(Data.IDataSeries input, int wMAPeriods)
    {
    if (cacheHilbertTransform != null)
    for (int idx = 0; idx < cacheHilbertTransform.Length; idx++)
    if (cacheHilbertTransform[idx].WMAPeriods == wMAPeriods && cacheHilbertTransform[idx].EqualsInput(input))
    return cacheHilbertTransform[idx];

    lock (checkHilbertTransform)
    {
    checkHilbertTransform.WMAPeriods = wMAPeriods;
    wMAPeriods = checkHilbertTransform.WMAPeriods;

    if (cacheHilbertTransform != null)
    for (int idx = 0; idx < cacheHilbertTransform.Length; idx++)
    if (cacheHilbertTransform[idx].WMAPeriods == wMAPeriods && cacheHilbertTransform[idx].EqualsInput(input))
    return cacheHilbertTransform[idx];

    HilbertTransform indicator = new HilbertTransform();
    indicator.BarsRequired = BarsRequired;
    indicator.CalculateOnBarClose = CalculateOnBarClose;
    #if NT7
    indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
    indicator.MaximumBarsLookBack = MaximumBarsLookBack;
    #endif
    indicator.Input = input;
    indicator.WMAPeriods = wMAPeriods;
    Indicators.Add(indicator);
    indicator.SetUp();

    HilbertTransform[] tmp = new HilbertTransform[cacheHilbertTransform == null ? 1 : cacheHilbertTransform.Length + 1];
    if (cacheHilbertTransform != null)
    cacheHilbertTransform.CopyTo(tmp, 0);
    tmp[tmp.Length - 1] = indicator;
    cacheHilbertTransform = tmp;
    return indicator;
    }
    }

    /// <summary>
    ///
    /// </summary>
    /// <returns></returns>
    public HomodyneDiscriminator HomodyneDiscriminator()
    {
    return HomodyneDiscriminator(Input);
    }

    /// <summary>
    ///
    /// </summary>
    /// <returns></returns>
    public HomodyneDiscriminator HomodyneDiscriminator(Data.IDataSeries input)
    {
    if (cacheHomodyneDiscriminator != null)
    for (int idx = 0; idx < cacheHomodyneDiscriminator.Length; idx++)
    if (cacheHomodyneDiscriminator[idx].EqualsInput(input))
    return cacheHomodyneDiscriminator[idx];

    lock (checkHomodyneDiscriminator)
    {
    if (cacheHomodyneDiscriminator != null)
    for (int idx = 0; idx < cacheHomodyneDiscriminator.Length; idx++)
    if (cacheHomodyneDiscriminator[idx].EqualsInput(input))
    return cacheHomodyneDiscriminator[idx];

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

    HomodyneDiscriminator[] tmp = new HomodyneDiscriminator[cacheHomodyneDiscriminator == null ? 1 : cacheHomodyneDiscriminator.Length + 1];
    if (cacheHomodyneDiscriminator != null)
    cacheHomodyneDiscriminator.CopyTo(tmp, 0);
    tmp[tmp.Length - 1] = indicator;
    cacheHomodyneDiscriminator = tmp;
    return indicator;
    }
    }

    /// <summary>
    /// Enter the description of your new custom indicator here
    /// </summary>
    /// <returns></returns>
    public MoneyWizard MoneyWizard(bool activeAlert, bool autoLimit, int daysToLoad, int inputMaxCount, string levels, bool printOutPut, bool showDoji, bool showIndicator, bool showReset, string timeEnd, string timeStart)
    {
    return MoneyWizard(Input, activeAlert, autoLimit, daysToLoad, inputMaxCount, levels, printOutPut, showDoji, showIndicator, showReset, timeEnd, timeStart);
    }

    /// <summary>
    /// Enter the description of your new custom indicator here
    /// </summary>
    /// <returns></returns>
    public MoneyWizard MoneyWizard(Data.IDataSeries input, bool activeAlert, bool autoLimit, int daysToLoad, int inputMaxCount, string levels, bool printOutPut, bool showDoji, bool showIndicator, bool showReset, string timeEnd, string timeStart)
    {
    if (cacheMoneyWizard != null)
    for (int idx = 0; idx < cacheMoneyWizard.Length; idx++)
    if (cacheMoneyWizard[idx].ActiveAlert == activeAlert && cacheMoneyWizard[idx].AutoLimit == autoLimit && cacheMoneyWizard[idx].DaysToLoad == daysToLoad && cacheMoneyWizard[idx].InputMaxCount == inputMaxCount && cacheMoneyWizard[idx].Levels == levels && cacheMoneyWizard[idx].PrintOutPut == printOutPut && cacheMoneyWizard[idx].ShowDoji == showDoji && cacheMoneyWizard[idx].ShowIndicator == showIndicator && cacheMoneyWizard[idx].ShowReset == showReset && cacheMoneyWizard[idx].TimeEnd == timeEnd && cacheMoneyWizard[idx].TimeStart == timeStart && cacheMoneyWizard[idx].EqualsInput(input))
    return cacheMoneyWizard[idx];

    lock (checkMoneyWizard)
    {
    checkMoneyWizard.ActiveAlert = activeAlert;
    activeAlert = checkMoneyWizard.ActiveAlert;
    checkMoneyWizard.AutoLimit = autoLimit;
    autoLimit = checkMoneyWizard.AutoLimit;
    checkMoneyWizard.DaysToLoad = daysToLoad;
    daysToLoad = checkMoneyWizard.DaysToLoad;
    checkMoneyWizard.InputMaxCount = inputMaxCount;
    inputMaxCount = checkMoneyWizard.InputMaxCount;
    checkMoneyWizard.Levels = levels;
    levels = checkMoneyWizard.Levels;
    checkMoneyWizard.PrintOutPut = printOutPut;
    printOutPut = checkMoneyWizard.PrintOutPut;
    checkMoneyWizard.ShowDoji = showDoji;
    showDoji = checkMoneyWizard.ShowDoji;
    checkMoneyWizard.ShowIndicator = showIndicator;
    showIndicator = checkMoneyWizard.ShowIndicator;
    checkMoneyWizard.ShowReset = showReset;
    showReset = checkMoneyWizard.ShowReset;
    checkMoneyWizard.TimeEnd = timeEnd;
    timeEnd = checkMoneyWizard.TimeEnd;
    checkMoneyWizard.TimeStart = timeStart;
    timeStart = checkMoneyWizard.TimeStart;

    if (cacheMoneyWizard != null)
    for (int idx = 0; idx < cacheMoneyWizard.Length; idx++)
    if (cacheMoneyWizard[idx].ActiveAlert == activeAlert && cacheMoneyWizard[idx].AutoLimit == autoLimit && cacheMoneyWizard[idx].DaysToLoad == daysToLoad && cacheMoneyWizard[idx].InputMaxCount == inputMaxCount && cacheMoneyWizard[idx].Levels == levels && cacheMoneyWizard[idx].PrintOutPut == printOutPut && cacheMoneyWizard[idx].ShowDoji == showDoji && cacheMoneyWizard[idx].ShowIndicator == showIndicator && cacheMoneyWizard[idx].ShowReset == showReset && cacheMoneyWizard[idx].TimeEnd == timeEnd && cacheMoneyWizard[idx].TimeStart == timeStart && cacheMoneyWizard[idx].EqualsInput(input))
    return cacheMoneyWizard[idx];

    MoneyWizard indicator = new MoneyWizard();
    indicator.BarsRequired = BarsRequired;
    ...
    }
    }
    ..


    How can I do it?

    Best

    #2
    Hello,

    Thank you for your note.

    It looks like these indicators are referenced by the MoneyWizard script. In which case they are being included with the export as all dependencies will be included with the export.

    If this is the case, you will need to ensure that these indicators are not already on the system you are importing to. If they are, remove them first as they are now included with the exported assembly of MoneyWizard.
    Last edited by NinjaTrader_ChelseaB; 01-21-2015, 11:25 AM.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by helpwanted, Today, 03:06 AM
    1 response
    10 views
    0 likes
    Last Post sarafuenonly123  
    Started by Brevo, Today, 01:45 AM
    0 responses
    9 views
    0 likes
    Last Post Brevo
    by Brevo
     
    Started by aussugardefender, Today, 01:07 AM
    0 responses
    5 views
    0 likes
    Last Post aussugardefender  
    Started by pvincent, 06-23-2022, 12:53 PM
    14 responses
    242 views
    0 likes
    Last Post Nyman
    by Nyman
     
    Started by TraderG23, 12-08-2023, 07:56 AM
    9 responses
    387 views
    1 like
    Last Post Gavini
    by Gavini
     
    Working...
    X