• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Cut another Trade after profit is reached.

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

    Cut another Trade after profit is reached.

    Hello,

    i need Help

    I have a signal to go long , short in my Strategy AND i will take i.e. 5 ticks of profit. How do I make sure it DOES NOT take another 5 ticks of the next bar (or maybe not) i.e. I only want 5 ticks ONCE until I get another signal in the opoosit direction, an so on.

    Please send my the code. I think it must be placed under the first and second condition.

    This is an example

    // Condition set 1
    if (Close[0] > HMA(Median, 1)[0])
    {
    EnterLong(DefaultQuantity, "Buy");
    }

    // Condition set 2
    if (Close[0] < HMA(Median, 1)[0])
    {
    EnterShort(DefaultQuantity, "Sell");
    }
    }

    thanks a lot

    #2
    Hi Deogenes,

    Thanks for the post and welcome to the NT forums. I'm not entirely clear on this:
    How do I make sure it DOES NOT take another 5 ticks of the next bar
    Are looking to enforce only one signal per direction? So it will always alternate long > short > long > short?
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Hi Ryan,

      yes, but only if a new Signal is made ( something crossing, higher, lower ...) to generate in the opposit direction. Here i will take another bit of profit and so far.

      Comment


        #4
        Thanks for the reply. It sounds like you want to use CrossAbove or CrossBelow rather than > <.

        These functions will capture the specific bar that indicators change directions. You could use the strategy wizard condition builder to create crossing expressions, or refer to this sample here:
        http://www.ninjatrader.com/support/f...ead.php?t=3224

        These will likely work with your specific conditions, but you can also use bool flags or user variables to create sequences in code. This sample can help with user variables in the strategy wizard:
        http://www.ninjatrader.com/support/f...ad.php?t=15417
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Thanks Ryan,

          i have just looked at the Samples. I think it is the right way to get what i want. I try something, and give you later a feed back.

          Comment


            #6
            It doesen´t work !

            My Indicator ist the ATR. The thing i want, is:
            If c > ATR Enter Long ; set profit target 8 ticks and do not trade(!!)
            till you get:
            If c < ATR Enter Short set profit target 8 ticks and do not trade(!!) till you get ... Enter Long and so on.

            I´am not a Programmer, so i need to know wher to set what.

            Thanks a lot

            Comment


              #7
              That type of condition compares two different types of values. They're unlikely to ever cross, and comparison with > or < is unlikely to be meaningful.

              Close is the traded price of an instrument. ATR is built from an average of high - low over a series of bars. Add ATR to a chart from your indicator list and you can see the types of values you get compared to the close price.
              Ryan M.NinjaTrader Customer Service

              Comment


                #8
                But it works very good. How can i send you a chart, so that you can see exaktly how it looks like, till yet.

                Comment


                  #9
                  You can post a chart to the forums and we're happy to take a look. When posting click the paper click icon (or manage attachment button) and can then choose an image to post.

                  We will not be able to offer you custom coding services, however. We're happy to point you in the right direction where you can learn more and are usually always able to offer feedback on progress shared.

                  If you are not a programmer, this material can offer a learning curve, and you may want to start with only the strategy wizard condition builder when building strategies. This is a point and click interface that does not require programming, but also does not have all the flexibility of working with code.

                  If you have limited programming experience and would prefer to explain your strategy requirements to a dedicated professional, you can always consider one of our 3rd party NinjaScript consultants. A complete list is available below:
                  http://www.ninjatrader.com/partners#...pt-Consultants
                  Last edited by NinjaTrader_RyanM1; 06-07-2012, 02:44 PM.
                  Ryan M.NinjaTrader Customer Service

                  Comment


                    #10
                    OK Ryan,
                    i have posted a Chart (under Charting). Thank you.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by hir04068, Today, 06:58 AM
                    0 responses
                    4 views
                    0 likes
                    Last Post hir04068  
                    Started by escobar63, Yesterday, 05:06 PM
                    1 response
                    11 views
                    0 likes
                    Last Post NinjaTrader_PaulH  
                    Started by Brutus, Today, 06:00 AM
                    1 response
                    4 views
                    0 likes
                    Last Post NinjaTrader_PatrickG  
                    Started by phesi, Today, 03:36 AM
                    2 responses
                    9 views
                    0 likes
                    Last Post phesi
                    by phesi
                     
                    Started by Guru73, Today, 01:35 AM
                    1 response
                    9 views
                    0 likes
                    Last Post NinjaTrader_Marco  
                    Working...
                    X