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

What is the difference these?

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

    What is the difference these?

    Hello,

    Often we need use indicators in other indicator plots calculation. We do this different ways. Wich is right or economic in point of memory usage:

    1.Usage:
    OnBarUpdate()
    MACD macd = MACD(Input, 12, 26, 5);
    MyPlot.Set(macd[0] * macd[1]);
    2.Usage:
    OnBarUpdate()
    MyPlot.Set(MACD(Input, 12, 26, 5)[0] * MACD(Input, 12, 26, 5)[1]);
    3.Usage:
    Variables
    MACD macd = null;
    Initialize()
    MACD macd = MACD(Input, 12, 26, 5);
    OnBarUpdate()
    MyPlot.Set(macd[0] * macd[1]);

    Also for all usage types tell me please, what is mean use with and without new directive? I mean, for example for 1.Usage, what is the difference above and below 1.Usage sample:

    1.Usage with new directive:
    OnBarUpdate()
    MACD macd = new MACD(Input, 12, 26, 5);
    MyPlot.Set(macd[0] * macd[1]);

    PS:I have an indicator and it has 2 parameters, and when i want to use it other indicator OnBarUpdate method, if i don't write new i receive an error. I think Ninja don't decide wich constructor must be use:

    MyOtherIndicator OnBarUpdate()
    MyIndicator myIndicator = new MyIndicator();
    Plot.Set(myIndicator[0]);

    If i write like this I receive an error:

    MyOtherIndicator OnBarUpdate()
    MyIndicator myIndicator = MyIndicator(); /// There is no constructor witout parameter
    Plot.Set(myIndicator[0]);

    Please explain me all usages and samples means separately.

    Thanks...
    Last edited by aytacasan; 11-14-2010, 01:42 PM.

    #2
    Hi aytacasan,

    Generally, our documentation does show how to access these in a different manner, by explicitly calling the indicators syntax, as in the MACD: http://www.ninjatrader-support.com/H...uide.html?MACD

    If you are having any specific issues with using accessing them in this way, or any other supported way, please let me know and I may be able to offer some suggestions.
    TimNinjaTrader Customer Service

    Comment


      #3
      Tim, since there can be big performance differences and memory usage differences, I think he is asking which example is best to use, not what your example is.

      Dan
      eDanny
      NinjaTrader Ecosystem Vendor - Integrity Traders

      Comment


        #4
        Thank you for you input eDanny.

        aytacasan, please let me know if you'd like me to expand here.
        TimNinjaTrader Customer Service

        Comment


          #5
          Hi,

          Thanks Dany for your clarify.

          Tim, my first post have many different ways. And in terms of develop software all ways have different manner memory usage, so different performance. Please explain all usage step by step with advantage and disadvantage.

          I need this because I'm writing complex indicators, they have complex aritmetic on backgroud. So this is very important for me. Moreover without know this details, we don't have to power of Ninja's flexibility. I mean issue is not simple like "Use same as examples".

          Thanks for your understand.
          Last edited by aytacasan; 11-15-2010, 06:31 AM.

          Comment


            #6
            You may find your answers in this thread.

            Dan
            eDanny
            NinjaTrader Ecosystem Vendor - Integrity Traders

            Comment


              #7
              Hi aytacasan,

              I appreciate your need to get your code written in the most optimal way, however I am not familiar with the way you have suggested, and cannot offer an advice on the difference.
              TimNinjaTrader Customer Service

              Comment


                #8
                Dany thanks for your help. I'll analyze your link I hope i find my answers from there.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by habeebft, Today, 07:27 AM
                1 response
                14 views
                0 likes
                Last Post NinjaTrader_ChristopherS  
                Started by AveryFlynn, Today, 04:57 AM
                1 response
                12 views
                0 likes
                Last Post NinjaTrader_Erick  
                Started by Max238, Today, 01:28 AM
                4 responses
                38 views
                0 likes
                Last Post Max238
                by Max238
                 
                Started by r68cervera, Today, 05:29 AM
                1 response
                10 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by geddyisodin, Today, 05:20 AM
                1 response
                14 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Working...
                X