Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Help with a simple breakout strategy please

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

    Help with a simple breakout strategy please

    Hello, currently migrating from Tradestation. I'm trying to build a simple breakout system, can someone show me why I'm not getting any signals?

    thanks.

    // Condition set 1
    if (Close[0] == HighestBar(DefaultInput, 22))
    {
    EnterLong(DefaultQuantity,
    "");
    }
    // Condition set 2
    if (Close[0] == LowestBar(DefaultInput, 22))
    {
    EnterShort(DefaultQuantity,
    "");
    }
    }

    #2
    MP948, HighestBar will return the bar number ago the highest bar occured - for your needs you would want to work with MAX() and MIN() -



    BertrandNinjaTrader Customer Service

    Comment


      #3
      Thank you for getting back to me. I'll see if I can put it together, hopefully it is in the strategy wizard.

      Comment


        #4
        Trying to buy at highest high of last 22 bars and sell at lowest low of last 22 bars.

        Hi, sometimes there should clearly be a signal but it does not materialize. Can you please show me if there is an error?

        // Condition set 1
        if (Close[0] == MAX(High, lookBack)[0])
        {
        EnterLong(DefaultQuantity,
        "Long Bar Break Out");
        }
        // Condition set 2
        if (Close[0] == MIN(Low, lookBack)[0])
        {
        EnterShort(DefaultQuantity,
        "Short Bar Break Out");
        }
        }
        Attached Files
        Last edited by MP948; 08-26-2009, 06:45 PM. Reason: addding ninjascript

        Comment


          #5
          Please give the changed snippet below a try -

          Code:
          // Condition set 1
          if (Close[0] >= MAX(High, lookBack)[1])
          {
          EnterLong(DefaultQuantity, "Long Bar Break Out");
          }
          // Condition set 2
          if (Close[0] <= MIN(Low, lookBack)[1])
          {
          EnterShort(DefaultQuantity, "Short Bar Break Out");
          }
          }
          BertrandNinjaTrader Customer Service

          Comment


            #6
            Thank you, I'll give it a shot.

            Comment


              #7
              Completed System

              The complete system is up and running, thank you for the help.

              Attached is the complete system to be imported. Please post improvements. It shows some promise on GBPJPY with breakouts.

              Still trying to figure out how to fade it and use the 68% win rate to an advantage on the EURUSD.
              Attached Files

              Comment


                #8
                Inline with this thread, how would you use the MAX function to gather say the Highest value between a certain time period and store into a double?

                Code:
                double HH = MAX(High, period)[0];
                what goes in the "period" spot?

                I've seen the time filter strategy, but can't get what I'm looking for out of it.

                Comment


                  #9
                  Period is how many bars you want to look back to get a MAX value from. Here is the documentation for MAX.
                  AustinNinjaTrader Customer Service

                  Comment


                    #10
                    Originally posted by NinjaTrader_Austin View Post
                    Period is how many bars you want to look back to get a MAX value from. Here is the documentation for MAX.
                    I've seen this one, so you can't set a specific zone for the max() function it seems?

                    Comment


                      #11
                      Not sure if I follow exactly what you want, but it sounds like you might want to be storing it as a DataSeries instead of a double.
                      As a DataSeries you can reference a "lookback period" of values. As a double it stores only 1 value.

                      Hope this helps.
                      VT

                      Comment


                        #12
                        Originally posted by VTtrader View Post
                        Not sure if I follow exactly what you want, but it sounds like you might want to be storing it as a DataSeries instead of a double.
                        As a DataSeries you can reference a "lookback period" of values. As a double it stores only 1 value.

                        Hope this helps.
                        VT
                        I couldn't quite figure out the data series portion and using it with MAX, MIN functions just yet. I was looking to capture the highest value between two time values.

                        SO i went a somewhat round about way of doing it. Hey it works Until i get the data series understood. Since i'll be using this on a 5min chart for now, and know the periods I want to look back on. I have several of these where it takes the current time, and looks back the max number of bars I need and gets the high or low value I'm looking for.

                        I used for example:

                        Code:
                        if (ToTime(Time[0])== ToTime(7, 20, 0))
                        {
                        	HH1 = MAX(High,10)[0];
                        	LL1 = MIN(Low,10)[0];	
                        	//Print("The current MAX value is " + HH1.ToString());
                        }

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by cre8able, 02-11-2023, 05:43 PM
                        3 responses
                        236 views
                        0 likes
                        Last Post rhubear
                        by rhubear
                         
                        Started by frslvr, 04-11-2024, 07:26 AM
                        8 responses
                        113 views
                        1 like
                        Last Post NinjaTrader_BrandonH  
                        Started by stafe, 04-15-2024, 08:34 PM
                        10 responses
                        46 views
                        0 likes
                        Last Post stafe
                        by stafe
                         
                        Started by rocketman7, Today, 09:41 AM
                        3 responses
                        11 views
                        0 likes
                        Last Post NinjaTrader_Jesse  
                        Started by traderqz, Today, 09:44 AM
                        2 responses
                        10 views
                        0 likes
                        Last Post NinjaTrader_Gaby  
                        Working...
                        X