Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trade based on 2nd chart

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

    Trade based on 2nd chart

    Just wondering if it is possible to execute a trade on one market/chart from another.

    For example, if i want to fire off a trade in the ES or YM each time the $TICK chart moves a certain way how would I do that. I understand a lot about ninja script but don't have any idea how to reference multiple charts in a strategy or if its even possible.

    #2
    Hello,

    Yes, this is possible. Please refer to this link:
    DenNinjaTrader Customer Service

    Comment


      #3
      first of all thank you very much for your help, it works fantastic.

      However there is one other thing I'm wondering if it is possible. Can I have an automated program like this stop executing once it hits x number of targets or stop losses?

      For example say I want it to not trade anymore until I restart it once it gets stopped out three times in a row. Will it remember something like a counting variable as it continues to make trades? If it does, is there a simpler way than doing something like:

      when position is not flat checking if the close[0] is == to stop add one to the stopped out variable. Once stopped out if variable is > 2 it will not be able to reach the trading code.

      PS my automator calculates intrabar

      Comment


        #4
        shazzmoe,

        You can do that, but you will need to program your own counter yourself. Whenever you get stopped just increase a counter variable by 1. Then in your trading conditions tell it to not be true if the counter >= 3 for instance.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          That's good to know this is doable, but I should have asked more specifically how do I know (in my code) that it has hit a stop?

          also, i can't find anything on timers. I know how to exit a position at a specific time, but is is possible to exit after a trade has been active for 30mins?
          Last edited by shazzmoe; 02-16-2010, 10:50 AM.

          Comment


            #6
            shazzmoe, please see the reference titled monitoring stop-loss and profit-target orders for your first question. As for the timer, this reference sample goes over custom events and timer objects. You could also use BarsSinceEntry() if using minute-based bars.
            AustinNinjaTrader Customer Service

            Comment


              #7
              First of all thanks again for all your support, I now have a program that should do exactly what I want it to do.

              However I have noticed that when I place the automator on a chart it automatically runs through the past data. For example, I have it to stop trading after X number of trades. But because It looks at the past data it starts out thinking it has done all its trades and thus will never trade. When I set my chart to not go back more than 40 bars (when there have been no acceptable trades) it outputs the correct variables for me and I'm assuming will trade properly at this point.

              Is there a way to prevent this? I would really like my chart to look back more than a couple bars if possible.

              Comment


                #8
                shazzmoe,

                Whenever you run a strategy it will always look through all your historical bars as if it were real-time bars for processing.

                If you want to prevent historical processing but still have historical bars, add this to the beginning of OnBarUpdate().

                Code:
                if (Historical)
                     return;
                Josh P.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by NRITV, Today, 01:15 PM
                2 responses
                6 views
                0 likes
                Last Post NRITV
                by NRITV
                 
                Started by frankthearm, Today, 09:08 AM
                7 responses
                30 views
                0 likes
                Last Post NinjaTrader_Clayton  
                Started by maybeimnotrader, Yesterday, 05:46 PM
                5 responses
                25 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by quantismo, Yesterday, 05:13 PM
                2 responses
                18 views
                0 likes
                Last Post quantismo  
                Started by adeelshahzad, Today, 03:54 AM
                5 responses
                33 views
                0 likes
                Last Post NinjaTrader_BrandonH  
                Working...
                X