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

New User Woes

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

    #46
    thank you josh, much Appreciated:

    When i say does nothing, what i mean is its like the user defined variables no longer make a difference if i change them on the backtest or forward optimize window. If i go in and do it manually i get different results, but if i change those in the window i get the same results over and over.

    IE if i change my trailing stop in the window to 1 tick, it still usues another value from somewhere??

    i am going to redo my whole code today, sine well i learned allot yesterday and perhaps in the learning process messed some things up.


    Thanks for all the help

    Tim

    Comment


      #47
      Im i correct in the thinking that whatever is used as code for an indicator can be used as code for a strategy??

      The macd histogram link you provided is a tad confusing on how to use it as a strategy, although i just started looking so perhaps it will come to me.

      The link provided for having a cross but cross by a certain amount is a tad confusing also, i see all in realtion to bars ago. what i want is a cross but then have the defference of the cross be a certain amount.


      I will delve into this and try a few things out. If anything indicator code can be used as strategy code then i better understand.

      Thanks for all the help

      Tim

      Comment


        #48
        Hi again me the annoying guy.

        Ok redoing now with the stuff learned and using wizrd for first part to make it easier.

        Confusion here:
        && MACD(12, 26, 9).Diff[0] > -0.15)

        This isthe code placed by the wizard, what i have is a macd cross, but then i only wnat it to enter a long trade if the macd histogram is above or below the 0 line by a certain amount or here .15.

        Is this the correct code to use. the backtesting deostn seem right.


        thanks

        tim

        Comment


          #49
          If you want above or below the zero line with a buffer of .15 the code would be

          if (MACD(12, 26, 9).Diff[0] < -0.15 || MACD(12, 26, 9).Diff[0] > 0.15)

          assuming I understand you correctly.

          If you want to make your code easier to maintain, you can also do this:

          double myDiff = MACD(12, 26, 9).Diff[0];
          double myBuffer = 0.15;
          if (myDiff < (0 - myBuffer) || myDiff > myBuffer)

          Comment


            #50
            ok i am a tad confused on the second part, I apologize I am new at this coding thing.

            This is the code i currently have:

            // Condition set 1
            if (CrossAbove(MACD(Fast, Slow, 9), MACD(Fast, Slow, 9).Avg, 1)
            && MACD(Fast, Slow, Smooth).Diff[
            1] > 0.05)
            {
            EnterLong(DefaultQuantity,
            "");


            i see yours doesnt have the && (what does that mean)

            also basically what i am looking for is this:

            when the macd crosses above the average line, then when the diff is above .05 go long.

            Basically i am trying to get only strong plays adn elimainate the times when the lines are close and give bad signals

            Comment


              #51
              When i do both codes backtesting seperate it works fine, it appears i am having trouble coding the combination.

              Either that or how long does the computer wait for a signal.

              IE the macd cross then the .05 doesnt occur for 4 bars is that too long??

              Comment


                #52
                The problem must have something to do with the strategy not waiting for the second signal long enough.

                I am trying to figure this out, and i know i read a thread on it last night last night but i cant seem to find it again now.

                Comment


                  #53
                  Does anyone else get driven nuts by the fact you cant search this forumn with 3 letter words. omg really its annoying sometimes.

                  So here is my question and i hope someone can help.

                  I have two variables in the strategy, after the first is triggered IE a cross how long does the strategy wait for the next critereia to be met

                  Comment


                    #54
                    Hi,

                    Ok well my voyage is gettin near to being complete now

                    Ok so i got everything working right so far and am just now implementing the strategy for daily gain etc. and tweaking tweaking tweaking

                    The only thing left i am trying to find is a possible max drawdown fo strategy which i just remember is in the guide

                    Thanks for all the help

                    Tim

                    Comment


                      #55
                      Glad you got it working. Max drawdown is located in the Account Performance tab of the Control Center if you are running the strategy live or in the Summary tab of the Strategy Analyzer if you are backtesting.
                      Josh P.NinjaTrader Customer Service

                      Comment


                        #56
                        where is teh Insert Condition

                        So in the instructions i see a nice thing that says if you type "if (" and right clcik during indicator designing it opens teh condition builder, i am curious why it doesnt pop up when i try it. It would be great use in the indicator building

                        Comment


                          #57
                          If you are referring to the "Insert Code Snippet" the hotkey for it is F2.
                          Josh P.NinjaTrader Customer Service

                          Comment


                            #58
                            Hi, I would like to that for all the help so far, I feel like i am beginning to understand things better.

                            I may have found a glitch in the strategy wizrd version 6.5

                            When you add to trade only if gain is below 200 currency when it compiles it return with an error.

                            Its the same code you enter manually, but when u choose it in wizard it is not imputing it all correctly

                            Comment


                              #59
                              Hi timmyb,

                              Can you inform me of the exact conditions you are setting in the Condition Builder for this? Thanks.
                              Josh P.NinjaTrader Customer Service

                              Comment


                                #60
                                Ok, say you have a strategy in the builder and (i didnt realize this was there) you want to have it only trade the strategy if the realized gain is under $200. I would assume imo that buy using this you would limit sesssion gains to 200 on that strategy.

                                So you:

                                open strategy analyzer

                                right click strategy then edit

                                then proceed to say the first tab (set1) mine is for a long entry

                                I click ADD, then choose on left side "Strategy" then i choose Realized PnL, type "currency", then "<", then i choose numerical value and enter 200

                                then i press next until it compiles

                                It comes up with Error generating strategy

                                i click the "OK"

                                it bring up the window showing the code

                                this is the error:

                                "Ninjatrader.Strategy.TrdeCollection' does not conatin a definition for "Performance'

                                Code CS0117


                                Now I understand what is wrong, and can fix it, but others who try to use just the wizard may be having issues, and frankly if i could add the code thorugh the wizard without editing that be great, cause i have to unlock my code to edit it. ONce unlocked i just find it harder to tweak the code, Usually i do as much as i can in the wizrd while backtesting to get the guts right, then convert.


                                Let me know what you find, maybe i am just using it wrong int he wizard but, the clicking i did seems to make sense just that its not putting all the code in

                                Tim

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by GussJ, 03-04-2020, 03:11 PM
                                15 responses
                                3,269 views
                                0 likes
                                Last Post xiinteractive  
                                Started by Tim-c, Today, 02:10 PM
                                1 response
                                8 views
                                0 likes
                                Last Post NinjaTrader_ChelseaB  
                                Started by Taddypole, Today, 02:47 PM
                                0 responses
                                2 views
                                0 likes
                                Last Post Taddypole  
                                Started by chbruno, 04-24-2024, 04:10 PM
                                4 responses
                                51 views
                                0 likes
                                Last Post chbruno
                                by chbruno
                                 
                                Started by TraderG23, 12-08-2023, 07:56 AM
                                10 responses
                                402 views
                                1 like
                                Last Post beobast
                                by beobast
                                 
                                Working...
                                X