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

how to insert an indicator-(timeframeA) into a strategy-(timeframeB)

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

    how to insert an indicator-(timeframeA) into a strategy-(timeframeB)

    Hello can anyone help me on how to modify the attached sample strategy script so that the indicator ncatRSD, tentatively set at 3 min. timeframe, would work in it. I would like to test this sample strategy on timeframes not based on time, for example: range bar 4.
    I need to modify the strategy script because the ncatRSD indicator accepts only timeframes based on time, and 3 minutes is just my nearest guess of a frequency similar to range 4 bars.
    Thank you in advance for any help.
    guidoisot
    Attached Files

    #2
    Hello,

    Thank you for the question.

    I am unable to test this because I do not have the referenced indicator but if you are trying to make the indicator only use a specific time frame, you would likely need to add a data series in the script and then pass that series to the indicator.

    I can provide a sample showing this for the SMA, likely the same process can apply to this indicator as well.


    Code:
    protected override void Initialize()
    {
    	Add(PeriodType.Minute, 3);
    }
    protected override void OnBarUpdate()
    {
    	double threeMinuteSma = SMA(Closes[1], 12)[0];
    }
    The Closes[1] or secondary series is passed to the indicator for it to use the values from. Likely the indicator you are using has a overload that includes an IDataSeries.

    You can double check this by typing the Indicators name in the NinjaScript editor and then (
    A small window should open showing the possible combinations, if you see one with IDataSeries that would be the one that allows for passing a series to the indicator.

    If it does not have an overload for a DataSeries, you may need to utilize a variable and BarsInProgress or:



    Code:
    private double threeMinuteSma;
    protected override void Initialize()
    {
    		Add(PeriodType.Minute, 3);
    }
    protected override void OnBarUpdate()
    {
    	if(BarsInProgress == 0)
    	{
    		Print(threeMinuteSma);
    	} else if(BarsInProgress == 1)
    	{
    		threeMinuteSma = SMA(12)[0];
    	}
    }
    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thank you very much Jesse for your reply.
      I have tried (even though I do not really understand the meanning of "protected override void Initialize()" and "protected override void OnBarUpdate()") to implement the changes you exemplified, (please see attached screenshot), but it appears they do not work.
      If my question is part of a more general problem, already discussed somewhere else in the forum, ie.: how to set a strategy having prices and various indicators each one based on different timeframes and if you are aware of where in the forum these references are, could you please let me know?
      Thank you.
      guidoisot
      Attached Files

      Comment


        #4
        Hello,

        Thank you for the reply.

        In the provided image, OnBarUpdate is misspelled, can you try to correct its spelling and see if that solved the compile error you are having?

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Hello,

          Thank you for the reply and my apologies for mispelling command.
          There are still other compiling errors which I cannot solve.
          Thanks for your assitance.
          Attached Files

          Comment


            #6
            Hello,

            Based on the error message this indicator may not support passing a DataSeries to it.

            In the error we can see the indicator is expecting:

            (string, int, bool, string)

            But you had provided:

            (string, int, bool, DataSeries)

            which it did not have an overload for.

            When you type the name of the indicator followed by a ( do you see the overloads show up? If so, do you see one that lists IDataSeries?

            In the case you do not, it can not be used this way. Otherwise if you see an overload set like:

            (string, int, bool, string, DataSeries) as an example, you would need to use that specific syntax.

            If there are any other scripts where you had downloaded this indicator, you may need to check those to see if this is ever called in a way like you are, or also check with the author of this script it it can be used in this way.


            I look forward to being of further assistance.
            JesseNinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_Jesse View Post
              Hello,

              Based on the error message this indicator may not support passing a DataSeries to it.

              In the error we can see the indicator is expecting:

              (string, int, bool, string)

              But you had provided:

              (string, int, bool, DataSeries)

              which it did not have an overload for.

              When you type the name of the indicator followed by a ( do you see the overloads show up? If so, do you see one that lists IDataSeries?

              In the case you do not, it can not be used this way. Otherwise if you see an overload set like:

              (string, int, bool, string, DataSeries) as an example, you would need to use that specific syntax.

              If there are any other scripts where you had downloaded this indicator, you may need to check those to see if this is ever called in a way like you are, or also check with the author of this script it it can be used in this way.


              I look forward to being of further assistance.
              If an indicator has an override that includes an IDataSeries, then it almost certainly would be the first parameter that must be passed, as that particular override is created by the NT wrappers, regardless the constructors that may have been explicitly coded.

              Comment


                #8
                Hi,

                can anyone help me out here.
                I always assumed something like the ncatRSD is unable to use in any automated startegy, simply because the indicator doesn't make available the methods needed to access the lines on the chart.

                Or does anyone have an alternative?

                I like the indicator a lot, but don't have time to be behind my screen 24hrs a day to trade it manually..

                Regards,

                Robert

                Comment


                  #9
                  Hi,
                  maybe these links go to indicators you have already seen, in any case I know of (the existence of) these ones:
                  The best futures trading community on the planet: futures trading, market news, trading charts, trading platforms, trading strategies

                  The best futures trading community on the planet: futures trading, market news, trading charts, trading platforms, trading strategies

                  The best futures trading community on the planet: futures trading, market news, trading charts, trading platforms, trading strategies

                  The best futures trading community on the planet: futures trading, market news, trading charts, trading platforms, trading strategies

                  Comment


                    #10
                    Hi,

                    yes I have seen those.

                    The mkSupDemZones is probably the closest. Although een great initiative from the builder to share this with us, our programmeur did say this about the indicator; "the indicator is probably the worst coded indicator I have ever worked with. It only computes on the last bar of the chart, so once the chart is loaded, it then computes. The issue there is, a strategy won't work at all because it needs the indicator to compute on each bar. I haven't run in real-time yet, but in backtest this is the case. Even worse, it creates the zones knowing how the market later effected them, which means what you see is like knowing the future, and changing the past. That's impossible (I wish it weren't). "

                    From experience, running it real-time last few days, the zones are often created extremely late ( hindsight ) up to 40 bars. Also after refreshing a chart a zone can suddenly show up out of the blue.

                    For those reasons i need to have my own custom built SD indicator, which will take a few more days/weeks.

                    Since the ncatRSD indicator seems to work extremely well in real-time, it would have been great to use that code for an automated strategy. Call it the easy way..Now we have to built it ourselves.

                    Anyway, the outcome will be the same; a great strategy, custom built, therefore reliable and with a backtest function.

                    Thanks for your input.

                    Rob

                    Comment


                      #11
                      You are welcome.
                      Since, some time ago, I spent some money for purchasing ncatRSD I have then also been spending a fair amount of my time trying to understand how it works. ...
                      (https://futures.io/elite-automated-n...tml#post539499
                      and
                      https://futures.io/elite-automated-n...tml#post539552)
                      however despite the great help I got from the forum, I could not fix in my mind how it actually works.
                      Too bad because it looks like a great indi, especially if I could ever be able to use it in conjunction with the ncatBollingerTackle (which I also purchased, but likewise I cannot yet really figure out how it works, what its plots are, and how it can be inserted into a strategy) ....
                      The seller told me however that these ncat indicators, when upgraded to NT8, will be all "backtestable". Let's see if they will ever show up again, to let me (/us) know when these upgrades will be available.
                      Earlier on I forgot to tell you that I also looked at using the dValueArea indi for detecting SR zones.
                      Finally there is a young lady (based in London?) who I think has done some competent work on SR zones. She is running a web site http://www.marketstalkers.co.uk, where you can follow some links taking you to a mql5.com page with some info on the indi. Unfortuantely, (as far as I can tell), her SR indi is only available for Metatrader! it would be nice if some generous and skilled programmer on this forum could take some hints from her SR indicator and build a similar (or even a better) one for NT.
                      That's all I can tell you about SR zones.
                      Please let me know if you can come up with something good for SR zone in NT.
                      Thanks. guidoisot
                      Last edited by guidoisot; 07-01-2016, 07:41 AM.

                      Comment


                        #12
                        Originally posted by guidoisot View Post
                        You are welcome.
                        Since, some time ago, I spent some money for purchasing ncatRSD I have then also been spending a fair amount of my time trying to understand how it works. ...
                        (https://futures.io/elite-automated-n...tml#post539499
                        and
                        https://futures.io/elite-automated-n...tml#post539552)
                        however despite the great help I got from the forum, I could not fix in my mind how it actually works.
                        Too bad because it looks like a great indi, especially if I could ever be able to use it in conjunction with the ncatBollingerTackle (which I also purchased, but likewise I cannot yet really figure out how it works, what its plots are, and how it can be inserted into a strategy) ....
                        The seller told me however that these ncat indicators, when upgraded to NT8, will be all "backtestable". Let's see if they will ever show up again, to let me (/us) know when these upgrades will be available.
                        Earlier on I forgot to tell you that I also looked at using the dValueArea indi for detecting SR zones.
                        Finally there is a young lady (based in London?) who I think has done some competent work on SR zones. She is running a web site http://www.marketstalkers.co.uk, where you can follow some links taking you to a mql5.com page with some info on the indi. Unfortuantely, (as far as I can tell), her SR indi is only available for Metatrader! it would be nice if some generous and skilled programmer on this forum could take some hints from her SR indicator and build a similar (or even a better) one for NT.
                        That's all I can tell you about SR zones.
                        Please let me know if you can come up with something good for SR zone in NT.
                        Thanks. guidoisot
                        You may care to take a look at this: http://omegasigmaindicators.com/indi.../supprest.html

                        Comment


                          #13
                          Hi Guys,

                          you are both talking about SR ( support and resistance ), i'm more interested in SD ( supply and demand ) in my view the best form of support and resistance. What many people see as support or resistance is variabel; MA200/50, a round figure ( S&P500 at 2000 ), bollinger band etc, etc.

                          My view is that what a market drives is a disbalance between buyers and sellers. That's it. That's all, 90% of the time..

                          Now i will quote someone; "There can be no other mathematical outcome for price direction, it has to go up because demand at that level exceeds supply. No matter what any indicators, oscillators, trend lines, news, experts, or astrology and magic crystal balls suggest, price has to go up from a level where demand is much greater than supply. Similarly, when price reaches a level where the huge sell orders (bank, institutional etc.) are waiting to be filled, price can only go down, because as soon as the last (novice) buy orders are filled by the exceeding supply, price will collapse and keep going down until it meets demand that can cover all that supply".

                          Would you agree? So orderbook, number of contracts, price per sell/buy order, those elements and the out of balance between these numbers are important. Are there 90% sellers and only 10% buyers ( i know for every teller there is one buyer, but the orders will give away whether we are in an oversold area or overbought, a place where more agressieve buyers will take over.

                          That's what i'm building my indicator/strategy on. This will cost me a few $1000, but i will see hoe much i can share in the next weeks.

                          Let me read the proposed website, a trader can never read enough

                          Good luck!

                          Rob

                          Comment


                            #14
                            Originally posted by robje737 View Post
                            Hi Guys,

                            you are both talking about SR ( support and resistance ), i'm more interested in SD ( supply and demand ) in my view the best form of support and resistance. What many people see as support or resistance is variabel; MA200/50, a round figure ( S&P500 at 2000 ), bollinger band etc, etc.

                            My view is that what a market drives is a disbalance between buyers and sellers. That's it. That's all, 90% of the time..

                            Now i will quote someone; "There can be no other mathematical outcome for price direction, it has to go up because demand at that level exceeds supply. No matter what any indicators, oscillators, trend lines, news, experts, or astrology and magic crystal balls suggest, price has to go up from a level where demand is much greater than supply. Similarly, when price reaches a level where the huge sell orders (bank, institutional etc.) are waiting to be filled, price can only go down, because as soon as the last (novice) buy orders are filled by the exceeding supply, price will collapse and keep going down until it meets demand that can cover all that supply".

                            Would you agree? So orderbook, number of contracts, price per sell/buy order, those elements and the out of balance between these numbers are important. Are there 90% sellers and only 10% buyers ( i know for every teller there is one buyer, but the orders will give away whether we are in an oversold area or overbought, a place where more agressieve buyers will take over.

                            That's what i'm building my indicator/strategy on. This will cost me a few $1000, but i will see hoe much i can share in the next weeks.

                            Let me read the proposed website, a trader can never read enough

                            Good luck!

                            Rob
                            Well, that to which I pointed you is pretty much both of those. It finds S/R by looking at volume and speed of price movement, and the characteristics that usually indicate a point of pause in price movement, and marks those as a horizontal band that is the thickness of the measured noise.

                            IOW, I pretty much agree with your description of how S/R develops, and we have attempted to codify it. Very well, I might add, even if I say so myself.

                            Comment


                              #15
                              Haha,

                              i'm still reading your website, stand-by for a verdict.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by cmtjoancolmenero, Yesterday, 03:58 PM
                              10 responses
                              36 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by DayTradingDEMON, Today, 09:28 AM
                              4 responses
                              24 views
                              0 likes
                              Last Post DayTradingDEMON  
                              Started by geddyisodin, Yesterday, 05:20 AM
                              9 responses
                              50 views
                              0 likes
                              Last Post NinjaTrader_Gaby  
                              Started by George21, Today, 10:07 AM
                              1 response
                              15 views
                              0 likes
                              Last Post NinjaTrader_ChristopherJ  
                              Started by Stanfillirenfro, Today, 07:23 AM
                              9 responses
                              24 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Working...
                              X