Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Setting Conditons as values in Market Analyzer

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

    Setting Conditons as values in Market Analyzer

    Probably going over 'old ground' with this one but, I cant seem to resolve it by myself !

    I'm trying to assign values to this (FibSuperTrend) indicator so that when conditions are met, i.e 'up'/'down' arrows on chart, this will give me a value to use in Market Analyzer 'cell conditions'. Should all be pretty simple stuff and I have other indicators that can do this to look at for examples

    However I'm still at the learning stage with programing and despite my best efforts, cant seem to make it work. Unfortunatley looking at the code for the indicators that already do what I want is confusing, as each one of them does it in a different way, despite having the same outcome.

    So I'm hoping that someone could point me in the right direction with this?

    Many Thanks
    Attached Files

    #2
    Hello kiteflyer,

    Thank you for your post.

    The value will need to be a plot that can be set in the Columns window for the Indicator column of the FibonacciSuperTrend. So in this case you need to create a new plot, something as simple as 1 for Up and 2 for Down arrows.

    If you need an example of creating a plot you can use our Multi-Color Plot sample: http://www.ninjatrader.com/support/f...ead.php?t=3227

    Please let me know if you have any questions.

    Comment


      #3
      Hi Patrick
      Thank you for your response. The thing is, you've just described what I I've just asked and I'm none the wiser!
      The ' Multi-Color Plot sample' I already had, and gives the answer in theory but is just not specific enough, so that I can apply it to this particular indicator. I understand the principal but, cant seem to integrate it into the code without it throwing up errors. I am reading as much as I can to learn to do this for myself but there just seems to be so many different ways to accomplish the same thing!!!!!

      I know this is 'basic stuff' but it doesn't seem like that from where I'm standing.
      Cheers

      Comment


        #4
        Hello kiteflyer,

        Thank you for your response.

        We have Premium Paid Educational events where you will join a NinjaScript expert for a pair of 6-8 hour long intensive courses designed to provide you with an in depth look at programming indicators and automated strategies through the use of NinjaScript:



        If you would like to take on learning NinjaScript on your own, we have a fully documented help guide which will help you get started with Ninja Script. You will find language references to all of the methods and functions you will be using. You will also see a tutorial section which will help you create your first indicator and get you started with some of these concepts.

        A link to our Help Guide can be found below: http://www.ninjatrader.com/support/h...stribution.htm

        I am also linking you to the Educational Resources section of the Help Guide to help you get started with NinjaScript: http://www.ninjatrader.com/support/h..._resources.htm

        You will find Reference Samples online as well as some Tips and Tricks for both indicators and strategies:
        Click here to see our NinjaScript Reference Samples
        Click here to see our NinjaScript Tips

        These samples can be downloaded, installed and modified from NinjaTrader and hopefully serve as a good base for your custom works.

        There is a also a growing library of user submitted custom indicators (100+) that can be downloaded from our support form. Please look in the NinjaScript File Sharing section of our support forum as you may find what you are looking for there.

        If you have limited time or programming capabilities, you can discuss your requirements with any of our certified NinjaScript consultants.
        Click here for a list of certified NinjaScript Consultants

        Please let me know if I may be of further assistance.

        Comment


          #5
          Originally posted by kiteflyer View Post
          Hi Patrick
          Thank you for your response. The thing is, you've just described what I I've just asked and I'm none the wiser!
          The ' Multi-Color Plot sample' I already had, and gives the answer in theory but is just not specific enough, so that I can apply it to this particular indicator. I understand the principal but, cant seem to integrate it into the code without it throwing up errors. I am reading as much as I can to learn to do this for myself but there just seems to be so many different ways to accomplish the same thing!!!!!

          I know this is 'basic stuff' but it doesn't seem like that from where I'm standing.
          Cheers
          Hi kiteflyer

          Patrick has listed some great resources for you and I just thought I'd pipe in with a couple of code ideas (hopefully they help??)

          To create cell, filter conditions in Market Analyzer it becomes much easier if you can reference a specific value when the condition your looking for is met.

          Below is an example using a variable called risingFalling (which you'll need to define risingFalling under variables section) where if risingFalling is equal to 1 this indicates a "rising" condition and if it is equal to -1 this indicates a "falling" condition, and once you update a plot with these values, then they will be able to be referenced in the Market Analyzer to create your cell/filter conditions.

          In the code you could do something along the following lines...

          Under Initialize section add a new plot.... for example....
          Add(new Plot(Color.FromKnownColor(KnownColor.SkyBlue), PlotStyle.Line, "RisingFallingPlot"));

          Under OnBarUpdate section add your conditions to assign a value to the risingFalling variable and then set the plot to this variable.... for example ...

          if ( <enter your own conditions for rising here> )
          {
          risingFalling = 1;
          }
          else
          {
          risingFalling = -1;
          }

          RisingFallingPlot.Set(risingFalling);

          If you have times where it is flat you'll need to add another check in the above if/else.
          Hope this is of some help and gets you going in the right direction.
          Cheers

          Comment


            #6
            Hi Stuart,
            Thanks for your input!
            I had started with this method as in your example,

            Under Initialize section add a new plot.... for example....
            Add(new Plot(Color.FromKnownColor(KnownColor.SkyBlue), PlotStyle.Line, "RisingFallingPlot"));

            but perhaps you could have a look at the indicator that is attached to my first post, because I just can't see where to insert my conditions in the "OnBarUpdate section".

            I have a macd indicator which provides ( 0, 1, 2 ) values to the Market Analyzer and doesn't use the "Add Plot" method at all, so I'm really confused, because I've tried to do A/B comparisons to see if I can l lift bits of code out and copy them across. I know this should be simple but I'm just not getting this. There seem to be many ways of doing this? I know a lot of third party indicators use more advanced coding methods which don't seem to be covered in the NT helpfiles. Which is not a gripe, because to date I've had nothing but good experience with the NinjaTrader customer service guy's.

            If either yourself or anyone else out there could have a look at this for me I would very grateful. Even a good explanation of various ways this could be done would probably be useful to the community. I'm sure I'm not the only numbskull out there!!

            Thanks again

            Comment


              #7
              Originally posted by kiteflyer View Post
              Hi Stuart,
              Thanks for your input!
              I had started with this method as in your example,

              Under Initialize section add a new plot.... for example....
              Add(new Plot(Color.FromKnownColor(KnownColor.SkyBlue), PlotStyle.Line, "RisingFallingPlot"));

              but perhaps you could have a look at the indicator that is attached to my first post, because I just can't see where to insert my conditions in the "OnBarUpdate section".

              ....

              Thanks again

              No worries kiteflyer

              I had a quick look at the indicator you first posted and can see where in the OnBarUpdate section you may be able to add the code.
              From your first post I'm assuming you want a condition/value set, that can be referenced by the Market Analyzer, only when an up or down arrow would be drawn. If I've misinterpreted please let me know.

              I've not tested this but below I have followed on from the code used in my first post but just added the items shown in red below to your OnBarUpdate section that should achieve the above (you'll still need to declare the variable and initialise the plot as mentioned in my first post).
              Code:
               
              .....
              
              if(Trend[0] && !Trend[1])
              {
              UpTrend.Set(SellPrice);
              UpTrend.Set(1, DownTrend[1]);
              if (ShowArrows)
              [COLOR="red"]{[/COLOR]
              DrawArrowUp(CurrentBar.ToString(), true, 0, UpTrend[0] - TickSize, UpColor);
              [COLOR="red"]risingFalling = 1;
              }[/COLOR]
              if (audioAlerts)
              PlaySound(alertFile); 
              } 
              else if (!Trend[0] && Trend[1])
              {
              DownTrend.Set(BuyPrice);
              DownTrend.Set(1, UpTrend[1]);
              if (ShowArrows)
              [COLOR="red"]{[/COLOR]
              DrawArrowDown(CurrentBar.ToString(), true, 0, DownTrend[0] + TickSize, DownColor);
              [COLOR="red"]risingFalling = -1;
              }[/COLOR]
              if (audioAlerts)
              PlaySound(alertFile); 
              } 
              else if (Trend[0])
              [COLOR="red"]{[/COLOR]
              UpTrend.Set(SellPrice > UpTrend[1] ? SellPrice : UpTrend[1]);
              [COLOR="red"]risingFalling = 0;
              }[/COLOR]
              else
              [COLOR="red"]{[/COLOR]
              DownTrend.Set(BuyPrice < DownTrend[1] ? BuyPrice : DownTrend[1]);
              [COLOR="Red"]risingFalling = 0;
              }
              
              RisingFallingPlot.Set(risingFalling);[/COLOR]
              
              .....
              The code in red above should set you in the right direction and give you a plot that can be referenced in Market Analyzer which is set to the value of 1 if an up arrow was to be drawn, -1 if a down arrow was to be drawn and 0 if neither of these conditions are met.

              You can also move the risingFalling = code just above the if (ShowArrows) if that suits better too.

              Hope this gets you going on this one.
              Cheers
              Stuart
              Last edited by GlobalTradingTools_Stuart; 10-09-2013, 01:00 AM.

              Comment


                #8
                Hi Stuart,
                Sorry to be a pain but, I've followed exactly how you described (and yes, these are the conditions that I want to meet i.e up/down arrow) but I'm getting one error,

                " cant recognise "RisingFallingPlot" in this context".

                I'm assuming that I define the variable as 'private int risingFalling;
                Have I got that wrong?

                Thanks
                Last edited by kiteflyer; 10-10-2013, 02:34 AM.

                Comment


                  #9
                  Hi kiteflyer

                  I know why that error is coming up, I was trying to generally point in the right direction but didn't go into detail on all items required sorry.

                  The error is coming up because the new plot is probably not listed in the "Properties" region.
                  After thinking about it more, what I have mentioned will definitely do what you want in market analyzer but will also display with the existing plots in the indicator on a chart, so make your chart bunch up.

                  With multiple plots displayed in the one indicator for varying reasons (eg some for chart, other for market analyzer) it may be easier to just create a secondary indicator specifically for use with the Market Analyzer.

                  I have to run now sorry but will do another update tomorrow once I've had a chance to update with the exact code.
                  Sorry I can't do it right now but will definitely update tomorrow.
                  Cheers
                  Stuart

                  Comment


                    #10
                    Hi kiteflyer

                    I've done a quick rough edit (nothing fancy) of the Fibonacci Super Trend indicator you first posted, to convert it into a separate Market Analyzer version of the indicator for you.
                    Have commented in the code the lines I've added/changed so hopefully that will help you out with the learning side of things too.
                    As I mentioned I've not done anything fancy at all and just done the basics to create a version that will work in the Market Analyzer how you wanted.

                    Once installed, it will appear in your indicator list as "FibonacciSuperTrend_MarketAnalyzer" and is designed for use in the Market Analyzer, rather than on charts (use the original indicator you had for charts).

                    In the Market Analyzer you'll now be able to set Alert, Cell and Filter conditions based on the numeric value of “RisingFallingPlot” (it’s important to make sure you select this particular plot in the Market Analyzer, see attached screen shot).
                    The conditions below are purely based on when the up/down arrows would be displayed (therefore ShowArrows is set to True)...

                    RisingFallingPlot will be equal to the value of:
                    1 if an up arrow was to be drawn,
                    -1 if a down arrow was to be drawn, and
                    0 if neither of these conditions are met.


                    I’ve attached the source code and an image showing the values for a couple of key fields that need to be set for this to work, and example of how it displays in the Market Analyzer before any cell or filter conditions are applied.

                    Hope this is what you were trying to achieve and helps you out with how it can be done in ninjascript.
                    Cheers
                    Stuart
                    Attached Files

                    Comment


                      #11
                      Hi Stuart,

                      Thank you very much for that!

                      I will put it through it's paces and let you know how it's going.

                      I also want to mention that a community like this 'works' when those with the knowledge and skills extend their help to the novices like myself, so that we can all progress! Trading is hard enough as it is!

                      You are a shinning example of that and I hope at some point in the future, I may also be able to offer something back.

                      In the meantime thanks and 'good trading' !!!

                      Comment


                        #12
                        Originally posted by kiteflyer View Post
                        Hi Stuart,

                        Thank you very much for that!

                        I will put it through it's paces and let you know how it's going.

                        I also want to mention that a community like this 'works' when those with the knowledge and skills extend their help to the novices like myself, so that we can all progress! Trading is hard enough as it is!

                        You are a shinning example of that and I hope at some point in the future, I may also be able to offer something back.

                        In the meantime thanks and 'good trading' !!!
                        Hi kiteflyer

                        Thanks so much for your very kind words, really appreciated !!!

                        Is great to be able to pay it forward.
                        Have a great weekend and as you say, good trading.

                        Cheers
                        Stuart

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by kulwinder73, Today, 10:31 AM
                        1 response
                        8 views
                        0 likes
                        Last Post NinjaTrader_Erick  
                        Started by RookieTrader, Today, 09:37 AM
                        3 responses
                        15 views
                        0 likes
                        Last Post NinjaTrader_ChelseaB  
                        Started by terofs, Yesterday, 04:18 PM
                        1 response
                        24 views
                        0 likes
                        Last Post terofs
                        by terofs
                         
                        Started by CommonWhale, Today, 09:55 AM
                        1 response
                        6 views
                        0 likes
                        Last Post NinjaTrader_Erick  
                        Started by Gerik, Today, 09:40 AM
                        2 responses
                        8 views
                        0 likes
                        Last Post Gerik
                        by Gerik
                         
                        Working...
                        X