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

    Hello

    Tried to resolve the Market Replay myth - why my strategy stopped triggering any signals after one day. I noticed I did not have Level 2 data. I followed your suggestion to download replay data (checked Level 2).

    When I right-clicked the Replay controller, it only showed 14 Dec for Level 2 data. How can I get more Level 2 data for testing? Please enlighten me. Thank you.

    Have a nice evening.

    Beth (I need a break and resume tomorrow.)

    Comment


      Hello,
      Originally posted by belecona View Post
      SetStopLoss("",CalculationMode.Price,lowestLow-1*TickSize, false);

      The above will work for a LongStop order. Instead of running a second strategy for ShortStop order, how can I add a similar code to exit a ShortStop order in one strategy? Please advise. Thank you.
      You would need to use signal names that tie your entry and exits.
      Code:
      if(something)
      {
        EnterShortStop(entryPrice, [B]"myShort"[/B]);
        SetStopLoss([B]"myShort"[/B], CalculationMode.Price, highestHigh+1*TickSize, false);
      }
      You only need level 2 data if you need access to bid/ask data. Otherwise you can just download the level 1.

      What expiry are you using? The 03-13 went into effect on the 14th. If your data stops at that point you would need to rollover from the 12-12.

      Please let me know if I can be of further assistance.
      LanceNinjaTrader Customer Service

      Comment


        Thanks Lance! Now I know I can use SetStopLoss for both Long/Short orders haha. I was using 6E Dec contracts because I wanted to test more days. When I had my strategy on a 30-day 1-minute chart (back to early/mid Nov), the historical performance list only showed 1 trade which happened on the first trading day.

        When I market replayed my strategy (say started on 10 Dec), it triggered one trade on 10 Dec and it stopped running (incl chart stopped plotting) when we reached 12:00 midnight. The timer on the Replay Control continued running while Bid/Ask on the Control Center stopped as well.

        Not sure what's missing/wrong that has caused the above issues. Appreciate your tips on locating my bugs. Thank you.

        Have a nice afternoon.

        Beth

        Comment


          Hello,

          Originally posted by belecona View Post
          When I had my strategy on a 30-day 1-minute chart (back to early/mid Nov), the historical performance list only showed 1 trade which happened on the first trading day.
          There are a number of reasons why this occurred, and unfortunatly I would need to look at your full source code to know why.

          When I market replayed my strategy (say started on 10 Dec), it triggered one trade on 10 Dec and it stopped running (incl chart stopped plotting) when we reached 12:00 midnight. The timer on the Replay Control continued running while Bid/Ask on the Control Center stopped as well.
          What chart template are you using?

          From the information here it sounds like your system is not "re-arming" itself to perform more than one trade.

          Additionally, is your strategy set to Exit On Close?
          LanceNinjaTrader Customer Service

          Comment


            Hi Lance

            Thanks for your prompt response. I'm off-site today and will attach the most updated strategy file tonight for your kind review. Thank you.

            I've been using Default 7/24 for my charts. I do not have my strategy set to Exit on Close. However, I do activate Exit on Close on the Options tab under Control Center. Sincerely hope that you can locate the bugs on my strategy.

            Beth

            Comment


              Hello

              I ran the most updated strategy on a 5-day ES 1-minute chart (started 11 Dec). Here it comes a recap:

              1. Its Buy Stop order on 11 Dec got cancelled .. not sure why. Then it triggered a trade on 12 Dec.
              2. Entry stop and exit stop orders on 12 Dec were at the correct price.
              3. Stopped triggering signals after 12 Dec.

              Enclosed error message on Log explained why 11 Dec order has been ignored (though I don't understand why). I have enclosed my strategy for your test-run.

              Thank you very much for enlightening me so that my breakout strategy will be functional soon. Night-night.

              Beth
              Attached Files

              Comment


                Originally posted by belecona View Post
                Hello

                I ran the most updated strategy on a 5-day ES 1-minute chart (started 11 Dec). Here it comes a recap:

                1. Its Buy Stop order on 11 Dec got cancelled .. not sure why. Then it triggered a trade on 12 Dec.
                2. Entry stop and exit stop orders on 12 Dec were at the correct price.
                3. Stopped triggering signals after 12 Dec.

                Enclosed error message on Log explained why 11 Dec order has been ignored (though I don't understand why). I have enclosed my strategy for your test-run.

                Thank you very much for enlightening me so that my breakout strategy will be functional soon. Night-night.

                Beth
                These are the lines causing you to have only one trade:
                Code:
                 
                && Performance.AllTrades.TradesPerformance.Currency.CumProfit - priorTradesCumProfit <= cumprofittarget
                && Performance.AllTrades.TradesPerformance.Currency.CumProfit - priorTradesCumProfit >= (-1*cumlosstarget)
                Figure out why that condition is never true after day1, and you will have a resolution.

                If you want to see how I isolated it to that in the first instance, ask, and I wll post the modified file, so that you can see what I did.

                Comment


                  Hi Koganam

                  Thanks for test-running my strategy. Would be great if you may share how to identify the issue.

                  It's a myth to me why the same Performance code on my other strategies had not caused the "stop" issue when I ran them. I just ran my Inside Bar strategies on the same ES chart, they had trades everyday. Some friends ran them on a live environment before.

                  Beth
                  Attached Files

                  Comment


                    I will compare both strategies and see if I might have missed some lines when I did cut-and-paste.

                    Comment


                      Originally posted by belecona View Post
                      Hello

                      I ran the most updated strategy on a 5-day ES 1-minute chart (started 11 Dec). Here it comes a recap:

                      1. Its Buy Stop order on 11 Dec got cancelled .. not sure why. Then it triggered a trade on 12 Dec.
                      2. Entry stop and exit stop orders on 12 Dec were at the correct price.
                      3. Stopped triggering signals after 12 Dec.

                      Enclosed error message on Log explained why 11 Dec order has been ignored (though I don't understand why). I have enclosed my strategy for your test-run.

                      Thank you very much for enlightening me so that my breakout strategy will be functional soon. Night-night.

                      Beth
                      I further isolated it to this block, where you are trying to do money management. The block is never entered, because your condition can never be true. This arises from the way you have defined your times. They have ended up overlapping.

                      Due to this condition:

                      Code:
                      [FONT=Courier New][COLOR=#008000][FONT=Courier New][COLOR=#008000]//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[/COLOR][/FONT]
                      [/COLOR][/FONT][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]if[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] (ToTime(EndHour, EndMinute, [/FONT][FONT=Courier New][COLOR=#800080][FONT=Courier New][COLOR=#800080]0[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]) > ToTime(Time[[/FONT][FONT=Courier New][COLOR=#800080][FONT=Courier New][COLOR=#800080]0[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]]))[/FONT]
                      [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]return[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New];[/FONT]
                      the first bar that can reach your money management block is at 1001 hrs, which is higher than your timestart value, which you defined as 1000 hrs. Ergo, an impossible condition.

                      One resolution (not a good one, as it is ad hominem) is to forcibly adjust the condition to read:
                      Code:
                      [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]if[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] (ToTime(EndHour, EndMinute, [/FONT][FONT=Courier New][COLOR=#800080][FONT=Courier New][COLOR=#800080]0[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]) - [/FONT][FONT=Courier New][COLOR=#800080][FONT=Courier New][COLOR=#800080]100[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] > ToTime(Time[[/FONT][FONT=Courier New][COLOR=#800080][FONT=Courier New][COLOR=#800080]0[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]]))[/FONT]
                      [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]return[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New];[/FONT]
                      You are better off adjusting the time variables themselves so that they make sense, as the adjustment I just showed will apply to ONLY 1-minute charts.
                      Last edited by koganam; 12-18-2012, 08:59 PM. Reason: Corrected spelling and capitalization.

                      Comment


                        Originally posted by belecona View Post
                        Hi Koganam

                        Thanks for test-running my strategy. Would be great if you may share how to identify the issue.

                        It's a myth to me why the same Performance code on my other strategies had not caused the "stop" issue when I ran them. I just ran my Inside Bar strategies on the same ES chart, they had trades everyday. Some friends ran them on a live environment before.

                        Beth
                        I have posted the entire file as I modified it to try to clear up the problem. Swap lines 105 and 106 (enabled state), and you will have your original file with the debugging statements that I added. It should demonstrate that it still fails, and if you read the output window, you will see why, at the very first bar that prints.

                        The file that I have posted works properly and has a nice return, albeit, your losses are larger than your wins. You might want to run an optimization to see if you can get better results with a larger profit target or a different StopLoss method. Be careful not to curve-fit. That means that you probably want to do either a walk-forward test, or better yet, what you already do with MarketReplay.
                        Attached Files

                        Comment


                          Big Big Thank You Koganam. After updating the script to yours, my strategy did not stop at the first trading day anymore .. haha ..

                          The only outstanding myth is the first signal (entry) did not match my condition + the enclosed error message on the log.

                          I'm keeping my fingers and toe-sies crossed .. hoping I may be able to resolve them this week. Thank you everyone.

                          Night-night.

                          Beth
                          Attached Files

                          Comment


                            My trillion thanks again Koganam for the updated cs file. I will run it tomorrow.

                            Have been working on my strategies over the weekend and this week (in my dreams too). Got complaints from UKNOWHO .. have to stop now.

                            Beth

                            Comment


                              Originally posted by belecona View Post
                              Big Big Thank You Koganam. After updating the script to yours, my strategy did not stop at the first trading day anymore .. haha ..

                              The only outstanding myth is the first signal (entry) did not match my condition + the enclosed error message on the log.

                              I'm keeping my fingers and toe-sies crossed .. hoping I may be able to resolve them this week. Thank you everyone.

                              Night-night.

                              Beth
                              Actually, it does match your entry condition!
                              Code:
                              if[FONT=Courier New][COLOR=#000000] (High[[/COLOR][/FONT][FONT=Courier New][COLOR=#800080][FONT=Courier New][COLOR=#800080]0[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#000000]]>[SIZE=3][COLOR=red][B]=[/B][/COLOR][/SIZE]highestHigh)[/COLOR][/FONT]
                              High[0] was equal to the highestHigh.

                              Both that entry and the ignored orders in the log seem to be due to the nature of the essentially backtesting engine. (i.e., historical orders are essentially backtest orders). Try to see what happens in Market Replay.
                              Last edited by koganam; 12-18-2012, 09:34 PM.

                              Comment


                                Thanks Koganam for your clarification. I will sim run the strategy tomorrow. Let's see what may happen.

                                Have a nice evening.

                                Beth (grateful)

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                                0 responses
                                649 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
                                576 views
                                1 like
                                Last Post RFrosty
                                by RFrosty
                                 
                                Working...
                                X