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

Strategy Wizard inquire

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

    Strategy Wizard inquire

    Hi,

    In Strategy Wizard I want that if first trade is Long then next trade should be taken Short when it comes. Or if first trades is Short then next trade should be taken long.

    awaiting

    #2
    HI mohdfraz, which entry conditions are you using? For a pure reversal strategy you could work with the 'Current market position' from the Strategy category.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Hi Bretrand,
      I got properitory indicator which generate signals at market reversal points. In strategy wizard in Set1 it will generate long signals and in Set2 it will have conditions to generate Short signals. The indicator can generate long or sell signals more than one time to identify the reversal.

      I cannot use "Current Market Position" script because trade is not going to depend or wait for other signal to exit. Position will exit on give Profit target or stop level and then wait for next entery point.

      so i need some way to tell Ninja that if we get first long then second entery should be short and like wise....


      awaiting

      Comment


        #4
        Please check the attached strategy, it uses UserVariables to achieve your Long / Short switch. Thanks!
        Attached Files
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Awesome Bertrand,,, U r the man,,, Thanks alot,,, It worked great,,, Have a great week.. Thanks

          Comment


            #6
            Originally posted by NinjaTrader_Bertrand View Post
            Please check the attached strategy, it uses UserVariables to achieve your Long / Short switch. Thanks!
            This longshort.zip file was exactly what I was looking for, but I cant understand how "variable0 == 0) and (variable0 = 1) translates to the long short switch.

            Comment


              #7
              Hello katsaf,

              Thank you for your post.

              The Variable0 is changed based on if you go long or chart, this is checked in each condition to see if the Variable0 is 1 or 0.
              Code:
              // Condition set 1
                          if (Close[0] > SMA(10)[0]
                              && [B]Variable0 == 0)[/B]//Check if Variable0 is 0, if so then go long
                          {
                              EnterLong(DefaultQuantity, "");
                              [B]Variable0 = 1;[/B]//Set Variable0 to 1 to go short next
                          }
              
                          // Condition set 2
                          if ([B]Variable0 == 1[/B]
                              && Close[0] < SMA(10)[0])//Check if Variable0 is 1, is if so then go short
                          {
                              EnterShort(DefaultQuantity, "");
                              [B]Variable0 = 0;[/B]//Set Variable0 to 0 to go long next
                          }
              Please let me know if I may be of further assistance.

              Comment


                #8
                Thank you! you've been very helpful.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by helpwanted, Today, 03:06 AM
                1 response
                11 views
                0 likes
                Last Post sarafuenonly123  
                Started by Brevo, Today, 01:45 AM
                0 responses
                9 views
                0 likes
                Last Post Brevo
                by Brevo
                 
                Started by aussugardefender, Today, 01:07 AM
                0 responses
                5 views
                0 likes
                Last Post aussugardefender  
                Started by pvincent, 06-23-2022, 12:53 PM
                14 responses
                242 views
                0 likes
                Last Post Nyman
                by Nyman
                 
                Started by TraderG23, 12-08-2023, 07:56 AM
                9 responses
                387 views
                1 like
                Last Post Gavini
                by Gavini
                 
                Working...
                X