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

Dot color problem

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

    Dot color problem

    Plots perfectly but all the dots are green

    protected override void Initialize()
    {
    Add(new Plot(Color.FromKnownColor(KnownColor.SpringGreen), PlotStyle.Dot, "Plot0"));
    Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Dot, "Plot1"));
    }

    protected override void OnBarUpdate()
    {
    if (CurrentBar < 1)
    return;

    if(a > 0 && b > 0)
    {
    Plot0.Set(High[0]);
    }

    if (a < 0 && b < 0)
    {
    Plot1.Set(High[0]);
    }

    }

    it's probably something silly
    Last edited by tortexal; 06-20-2009, 11:24 PM.

    #2
    tortexal, are your conditions properly triggering the Plot1 part? Perhaps you also need to add a neutral Plot as in this sample - http://www.ninjatrader-support2.com/...ead.php?t=3227
    BertrandNinjaTrader Customer Service

    Comment


      #3
      you may be right on the neutral/inbetween dot. I output window'd all the math again to confirm and it's correct. For the time being I made another indicator to plot the 2nd part separately, both now work as they should. I will try the neutral dot AH and report back

      Comment


        #4
        Im trying to create a predictive average with dots, ensign has such an indicator but I have no idea how to write. Been trying all morning and downloaded your 3 color MA which is very close I just cant open to see how to write it...could you help please? thanks.
        Bert

        Comment


          #5
          Welcome to our support forums bert1 - you can open the downloaded indicator by going to Tools > Edit NinjaScript > Indicator. This will open the NinjaScript editor and you can review and amend the code you have. For some great tutorials regarding indicator coding in NinjaScript, please check this link - http://www.ninjatrader-support.com/H...verview18.html
          BertrandNinjaTrader Customer Service

          Comment


            #6
            thank you, unfortunately the code I have is drop down boxes, some Ive spent last 6 hours trying to create this. I'll look again at this turtorial but so far it hasnt sunk in. :-(

            Thanks
            Al

            Comment


              #7
              You can also take a look at the sharing section to see if it has already been created - http://www.ninjatrader-support2.com/...splay.php?f=37

              If you need this professionally coded for you, I suggest you contact one of those consultants - http://www.ninjatrader.com/webnew/pa...injaScript.htm
              BertrandNinjaTrader Customer Service

              Comment


                #8
                thank you for your help, much appreciated
                Bert

                Comment


                  #9
                  One last question, I have an indicator that came from Metatrader based on RSI...Is a code from Meta very difficult to translate for ninja? Also it may be possible that I can get the code for tradestation on same indicator, would that be closer to the ninja language?
                  Thanks again
                  Bert

                  Comment


                    #10
                    Hard to say per se, depends on how familiar you are with MQL4 or Easy Language...most of the needed functions and methods are available per default with NinjaTrader, so I guess the TradeStation code might be easier to follow for a conversion / recreation of the indicator using NinjaScript.
                    BertrandNinjaTrader Customer Service

                    Comment


                      #11
                      Thanks, I got a copy of the tradestation code, its a simple idea. Ive been through the tutorials but still dont see how to create plots over an indicator. What I trying is this, Id like to use the RSI as the base indicator without showing the RSI line...but rather use several EMA's based on RSI to create a cross similar to MACD. Could you perhaps give me a starting point by posting a code similar to this idea?

                      Thanks Again
                      Bert

                      Comment


                        #12
                        Hi Bert, here's a quick idea to get you started - open the MACD indicator, right click in it and save it under a new name. Then replace instances of the code Input with RSI(C, 10, 1) and leave the [0] part intact, as you need this as a double value. Then hit F5 to compile your new code....this should give you a MACD running on RSI...feel free to play around with other combinations and parameters as you need it.
                        BertrandNinjaTrader Customer Service

                        Comment


                          #13
                          thanks, tried it but maybe not changing "Input" correctly as it looks excactly like regular MACD. Its this that I trying to acomplish...use RSI as base indicator but only show 3 EMA's that are offset of each other and derived from the RSI values. Ive played around with this to the point of giving up. I used the tutorial of SMA on VOL but it's not even close to working as I get errors when I use // Use this method for calculating your indicator values. Assign a value to each
                          // plot below by replacing 'Close[0]' with your own formula.
                          Plot0.Set(RSI(14, 1)[0]);
                          Plot1.Set(Plot0[0]);
                          Plot2.Set(Plot1[0]);
                          I have tradestation code is there a way to translate it to ninja trader?

                          Comment


                            #14
                            bert1, you can delete Plot1 and Plot2 and just try this as a start in the OnBarUpdate() -

                            Code:
                             
                            Plot0.Set(MACD(RSI(Close, 10, 1), 10, 20, 5)[0]);
                            An EMA of this would look like this -

                            Code:
                            Plot0.Set(EMA(MACD(RSI(Close, 10, 1), 10, 20, 5), 10)[0]);
                            BertrandNinjaTrader Customer Service

                            Comment


                              #15
                              Thanks Again, I think its working!!! :-)
                              Bert

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by futtrader, 04-21-2024, 01:50 AM
                              4 responses
                              41 views
                              0 likes
                              Last Post futtrader  
                              Started by Option Whisperer, Today, 09:55 AM
                              1 response
                              11 views
                              0 likes
                              Last Post bltdavid  
                              Started by port119, Today, 02:43 PM
                              0 responses
                              1 view
                              0 likes
                              Last Post port119
                              by port119
                               
                              Started by Philippe56140, Today, 02:35 PM
                              0 responses
                              3 views
                              0 likes
                              Last Post Philippe56140  
                              Started by 00nevest, Today, 02:27 PM
                              0 responses
                              2 views
                              0 likes
                              Last Post 00nevest  
                              Working...
                              X