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

Need your help with coding my strategy

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

    Need your help with coding my strategy

    Hi, I am trying to build a strategy I have been working on it for a week with no luck. I need to build a buy/sell strategy based on the Doji comparison (Current Doji and Previous Doji), with the following input:

    Current Doji (which is happening now): this point is the point of entering a buy or sell position based on; the previous Doji position
    1- If Current Doji > the previous Doji = Enter Short position one candle after current Doji candle
    2- If Current Doji < Previous Doji = Enter long Position one candle after current Doji candle.
    3- Profit = 5 ticks (not 5 candles)
    4- Stop loss = 5 ticks (not 5 candles)

    Example: if the Current Doji price = 60.1 and Previous Doji price = 55.8 then:
    • Current Doji price (Position) > Previous Doji Price (Position) in this case Short position to be created with 5 tick profit & loss.

    Example: if the Current Doji price = 55.8 and Previous Doji price = 60.1 then:
    • Current Doji price (Position) < Previous Doji Price (Position) in this case Long position to be created with 5 tick profit & loss.
    I don’t have any experience in C#, and I have tried to get it done with my basic knowledge but couldn’t.
    Last edited by Saroo970; 01-06-2018, 08:01 PM.

    #2
    Hello Saroo970,

    Thank you for your note.

    This should be able to be be built in the Strategy Builder.

    I put together some screen shots of how you might go about setting it up.

    You could create a variable called Doji1, with a default value of 0. See screen shot.

    Then if you get a doji, I used High=High, save the value of this variable to the current High.

    Then in a new set of conditions and actions, you could check that that Doji1 isn't 0 (meaning a previous doji was found and set the variable). In this same set, you would check if the current bar had a doji, as well as whether the Doji1 variable is below this dojis price (high).

    Please see the screen shots and let us know if you need further assistance.
    Last edited by NinjaTrader_AlanP; 01-09-2018, 09:00 AM.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Many thanks, i am going to build it and try it now

      Comment


        #4
        Can we do it on NT7, as i am not using NT8.

        Comment


          #5
          Hello Saroo970,

          It would be the same in NT7, except you wouldn't create a Variable but rather use the predefined Variables. Save to Variable0 rather than Doji1.

          I have attached a screen shot showing the difference in NT7.

          Please let us know if you need further assistance.
          Attached Files
          Alan P.NinjaTrader Customer Service

          Comment


            #6
            Hi Alan, Something went wrong... i am attaching what i have done, plz help me to correct it.
            Attached Files
            Last edited by Saroo970; 01-07-2018, 09:02 PM.

            Comment


              #7
              Hello Saroo970,

              In set 1 you set Var0 to 0 upon your if statement being true.

              You may want to see the 4th screen shot in my original reply.

              Please let us know if you need further assistance.
              Alan P.NinjaTrader Customer Service

              Comment


                #8
                Hi Alan, Just to get it right:

                Part1
                In user define inputs:
                Create a Doji1 ----- int = 0
                ---------------------------------------------
                Part 2
                In the set1:
                When the following conditions are true:
                High [0] == High [0]

                Do the following:
                Variable0=0
                -------------------------------------------------------------------

                Part 3
                In Set2
                When the following conditions are true:
                Doji1 = Variable0
                High [0] == High [0]
                High [0]>Doji1

                Do the following:
                Enter long position

                Is this correct, if no can you please just correct the inputs.
                My second part Q of the strategy was: what about the second condition of entering short?
                Last edited by Saroo970; 01-08-2018, 06:54 PM.

                Comment


                  #9
                  Hello Saroo970,

                  I was unable to find a way to build this strategy in the strategy builder in NT7. I wrote an indicator in the NS Editor which when two highs are the same, will save a value of that high and wait for a second condition of two matching highs, taking place above the first matching highs price.

                  The indicator will draw a green arrow on the first matching Highs and a red arrow when the second set of matching highs take place above the first, and after both have been drawn, will reset the variables to look for the next signal.

                  If you would like I can have someone reach out with a list of third parties that would be interested in writing this strategy for you.

                  Please let us know if you need further assistance.
                  Attached Files
                  Alan P.NinjaTrader Customer Service

                  Comment


                    #10
                    Many thanks, Alan, I was sure its difficult to build.
                    Last edited by Saroo970; 01-09-2018, 12:11 PM.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Barry Milan, Yesterday, 10:35 PM
                    5 responses
                    16 views
                    0 likes
                    Last Post NinjaTrader_Manfred  
                    Started by DanielSanMartin, Yesterday, 02:37 PM
                    2 responses
                    13 views
                    0 likes
                    Last Post DanielSanMartin  
                    Started by DJ888, 04-16-2024, 06:09 PM
                    4 responses
                    13 views
                    0 likes
                    Last Post DJ888
                    by DJ888
                     
                    Started by terofs, Today, 04:18 PM
                    0 responses
                    12 views
                    0 likes
                    Last Post terofs
                    by terofs
                     
                    Started by nandhumca, Today, 03:41 PM
                    0 responses
                    8 views
                    0 likes
                    Last Post nandhumca  
                    Working...
                    X