Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Where to start if I want to create a strategy on a trading set-up?

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

    I activated my strategy on a 1-minute chart. The indicator drew the 9:45-10:00 am HH/LL lines so that I can validate my strategy. It did not trigger a buy order at 1.3083 (1 tick above HH 1.3082).

    Comment


      Originally posted by belecona View Post
      I activated my strategy on a 1-minute chart. The indicator drew the 9:45-10:00 am HH/LL lines so that I can validate my strategy. It did not trigger a buy order at 1.3083 (1 tick above HH 1.3082).
      What session template are you using?

      Comment


        I've been using Default 24/7. Thanks.

        Comment


          Originally posted by belecona View Post
          I've been using Default 24/7. Thanks.
          In that case, your code is doing exactly as asked. You said that between 0945 hrs and 1000 hrs, to take the current high from the current day and assign it as the highestHigh. The current day starts when the session template says, so in this case at 0000 hrs. The highest high as at 1000 hrs is 1.3101, and occurred at 0327 hrs. (See attached picture).


          To do what you want to do, I can see 2 resolutions, one robust and elegant, the other not so much.
          1. You can use a custom session template, set to the hours that you want to trade. Not very elegant; rather cumbersome, but workable.
          2. On the 1000 hrs bar, use the MAX and MIN classes to determine the correct values for the high and low over the isolated timespan that you want to use. You can use the GetBar() method to determine the bar number of the starting bar, so that you can get the correct lookback length of bars. Robust and elegant, and works on all timeframes, even those where bars are time-independent.
          Attached Files
          Last edited by koganam; 12-16-2012, 12:33 AM.

          Comment


            Originally posted by koganam View Post
            To do what you want to do, I can see 2 resolutions, one robust and elegant, the other not so much.
            1. You can use a custom session template, set to the hours that you want to trade. Not very elegant; rather cumbersome, but workable.
            2. On the 1000 hrs bar, use the MAX and MIN classes to determine the correct values for the high and low over the isolated timespan that you want to use. You can use the GetBar() method to determine the bar number of the starting bar, so that you can get the correct lookback length of bars. Robust and elegant, and works on all timeframes, even those where bars are time-independent.
            Big Big Thank You for your kind clarification Koganam! I will explore the "robust and elegant" option to fix my strategy. Likely to take me some weeks .. will try.

            Beth

            Comment


              Hello

              I added more script (based on the SampleGetHighLowByTimeRange indicator) to isolate 9:45-10:00 am timespan to identify HH/LL for breakout. It only triggered one trade for the first day (even it's on a 30-day chart). Entry price was right but happened almost 2 hours later. What I did wrong this round?

              // Check to make sure the end time is not earlier than the start time
              if (EndHour < StartHour)
              return;

              //Do not calculate the high or low value when the ending time of the desired range is less than the current time of the bar being processed
              if (ToTime(EndHour, EndMinute, 0) > ToTime(Time[0]))
              return;

              // If the stored date time date is not the same date as the bar time date, create a new DateTime object
              if (startDateTime.Date != Time[0].Date)
              {
              startDateTime = new DateTime(Time[0].Year, Time[0].Month, Time[0].Day, StartHour, StartMinute, 0);
              endDateTime = new DateTime(Time[0].Year, Time[0].Month, Time[0].Day, EndHour, EndMinute, 0);
              }

              // Calculate the number of bars ago for the start and end bars of the specified time range
              int startBarsAgo = GetBar(startDateTime);
              int endBarsAgo = GetBar(endDateTime);

              /* Now that we have the start and end bars ago values for the specified time range we can calculate the highest high for this range
              Note: We add 1 to the period range for MAX and MIN to compensate for the difference between "period" logic and "bars ago" logic.
              "Period" logic means exactly how many bars you want to check including the current bar.
              "Bars ago" logic means how many bars we are going to go backwards. The current bar is not counted because on that bar we aren't going back any bars so it would be "bars ago = 0" */
              double highestHigh = MAX(High, startBarsAgo - endBarsAgo + 1)[endBarsAgo];

              // Now that we have the start and end bars ago values for the specified time range we can calculate the lowest low for this range
              double lowestLow = MIN(Low, startBarsAgo - endBarsAgo + 1)[endBarsAgo];
              Attached Files

              Comment


                Hello

                I moved the codes around and enclosed strategy triggered breakout trades according to the isolated timespan's HH/LL. I feel a little closer to accomplish my objective.

                Questions please:

                1. Only triggered 1 trade when I ran the strategy on a 30-day 1-minute chart.
                2. When it's on a 3-minute chart, it triggered more trades but still not on 30 days. It stopped trading on 23 Nov and did not triggered any trades up to 14 Dec.

                Please enlighten me. Thank you.

                Beth
                Attached Files
                Last edited by belecona; 12-16-2012, 01:55 PM.

                Comment


                  Originally posted by belecona View Post
                  Hello

                  I moved the codes around and enclosed strategy triggered breakout trades according to the isolated timespan's HH/LL. I feel a little closer to accomplish my objective.

                  Questions please:

                  1. Only triggered 1 trade when I ran the strategy on a 30-day 1-minute chart.
                  2. When it's on a 3-minute chart, it triggered more trades but still not on 30 days. It stopped trading on 23 Nov and did not triggered any trades up to 14 Dec.

                  Please enlighten me. Thank you.

                  Beth
                  11/23 was a half day holiday.

                  Comment


                    Hello

                    I market replayed to see if my strategy behaved normal when it's in action. It stopped working (incl the chart stopped plotting) when it reached 12:00 midnight (start of the next trading session).

                    Appreciate any tips to resolve it. Thank you. Have a great week.

                    Beth

                    Comment


                      Beth,

                      What was the date it stopped? If it stopped at 12:00 midnight, are you sure you had replay data for the next day?

                      You can double check the data you have in your system by right clicking on the market replay controller and selecting "Available Data".
                      MatthewNinjaTrader Product Management

                      Comment


                        Good morning Matthew

                        I loaded data from 10-14 Dec. My chart stopped printing (+ strategy stopped triggering signals) at 12:00 midnight when it officially started the 11 Dec trading session. Can tell from the Replay Control button that it continued loading the data. My chart/strategy simply stopped.

                        My strategy has been working only on the first day of the specified timespan when I had it on a 1-minute chart. Please help resolving this myth. Thank you.

                        Have a great week.

                        Beth

                        Comment


                          Beth,

                          When the chart stops, does the data from the Orders tab of the Control Center stop as well? If you check a Time and Sales window for the same instrument, does the data continue to update, or does it stop?
                          MatthewNinjaTrader Product Management

                          Comment


                            Hi Matthew

                            When my chart/strategy stopped, the timer on the Replay Control button continued to update.

                            I'm running my strategy on sim this morning. Will see how it behaves on a real-time sim environment.

                            Beth

                            Comment


                              Hello

                              I ran my strategy on ES and 6E 1-minute charts this morning. 6E triggered a trade when price broke up. Price entry and PT/SL orders were all in good order. Upon exit, it tried to put another stop order (not sure why). Got rejected by the system with the following error message:

                              Buy stop or buy stop limit orders can't be placed below the market.

                              Then the system disabled my strategy because of the OrderRejected error!

                              For ES, my strategy did not trigger a breakout trade when price broke up. Not sure why since it's working on 6E.

                              I am going to modify my strategy to do only 1 trade per morning with specific exit time/point. Maybe the additional script will eliminate the OrderRejected issue. Still I am lost as to why ES did not trigger a trade this morning.

                              Thank you!

                              Beth

                              Comment


                                Beth,

                                Regarding the ES strategy, do you have TraceOrders set to log additional information?

                                If you have not, I would suggest enabling this while you debug these strategies: http://www.ninjatrader.com/support/f...ead.php?t=3627
                                MatthewNinjaTrader Product Management

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                                0 responses
                                651 views
                                0 likes
                                Last Post Geovanny Suaza  
                                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                                0 responses
                                370 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by Mindset, 02-09-2026, 11:44 AM
                                0 responses
                                109 views
                                0 likes
                                Last Post Mindset
                                by Mindset
                                 
                                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                                0 responses
                                574 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by RFrosty, 01-28-2026, 06:49 PM
                                0 responses
                                577 views
                                1 like
                                Last Post RFrosty
                                by RFrosty
                                 
                                Working...
                                X