Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How strategies are run

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

    How strategies are run

    Hi,

    I'm looking for a couple of clarifications on a strategy I have developed:

    1. My original strategy works fine in backtesting and on historical data, but struggles in a live environment (sim or real trades). The strategy was run on bar close. As I am using Gomi's volume ladder, I have assumed it is something to do with the data not registering in time for when the strategy fires on bar close. Therefore I have adjusted the whole strategy to fire on the start of the next bar (i.e. everything now looks back a bar, and calculate on bar close is set to false). I don't expect you to have in-depth knowledge of the third party indicator, but I wondered if you could comment on my approach from a general perspective? Is there a better way to tell the strategy to fire after all data is "known"?

    2. The strategy also uses MacD values, therefore I have loaded 8 days worth of historical data into the chart to ensure minimal divergences caused by using indicators calculating averages. Will the strategy take these values into account when running live or will it only calculate from the beginning of that day?
    (Running on the sim account seemed to work correct, but the day I changed to the live account, it seemed to run with errors. After spending some time narrowing them down, they appear to be related to which data is used to calculate the MacD. Live appears to have only taken that day's data into account instead of the previous historical data that was loaded into the chart. Is there a setting or something I am missing somewhere?)

    Many thanks in advance

    #2
    1) You can actually split your calculations to work on the bar close, or with each incoming tick.

    Please see our Reference Sample on Separating logic to either calculate once on bar close or on every tick :



    2) It should use the historical values on the chart. Can you please detail how you determined it was only working on the current days data?
    MatthewNinjaTrader Product Management

    Comment


      #3
      Thanks for link Matthew, I will take a look at it in more detail.

      Regarding the second issue: The day in question was last Thursday (30th Aug), but I only noticed the issue earlier this week. Hence I did not do any investigating with the actual chart at the time (gutted I didn't realise then). However, the only way I can make the program reproduce the same trades on historical data is to apply it to a chart that starts on the 30th Aug. I have broken down each requirement for an entry to occur, and looked at them on both a chart starting on the 30th August, and a chart starting 8 days earlier. Each entry constituent has the same value on each chart except for the MacD - which only satisfies the strategy conditions on the chart starting on 30th Aug. I know that's not concrete, but it is the only thing I have to work with!

      Comment


        #4
        Were you manually verifying this information? I'd suggest adding some functions to debug your strategy in real-time vs historical. For example you can Print() these values to the Output window and compare them in real-time vs historical to see what might be changing.

        Debugging your NinjaScript code.

        For strategies add TraceOrders = true to your Initialize() method and you can then view valuable output related to strategy submitted orders through Tools > Output window - TraceOrders

        It may also help to add drawing objects to your chart for signal and condition confirmation - Drawing Objects.

        If you would prefer the debug assist of a professional NinjaScript consultant, please check into the following listings - Click here for a list of certified NinjaScript Consultants
        MatthewNinjaTrader Product Management

        Comment


          #5
          Thanks for the response. In answer to your question, no I am not verifying the information manually. I am drawing objects for each entry requirement on to the chart. This is how I came to realise it is the MacD that seems to be incorrect.

          What would you advise I do if I encounter this error again in real trading? (whilst I have the chart and offending real trades in front of me)

          Many thanks

          Comment


            #6
            I'm not exactly sure what you mean by it was only using the real-time data to calculate. If you see this again moving forward, please post the information you have that demonstrates that and I'd be happy to take a look.
            MatthewNinjaTrader Product Management

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by chbruno, 04-24-2024, 04:10 PM
            4 responses
            50 views
            0 likes
            Last Post chbruno
            by chbruno
             
            Started by TraderG23, 12-08-2023, 07:56 AM
            10 responses
            398 views
            1 like
            Last Post beobast
            by beobast
             
            Started by lorem, Yesterday, 09:18 AM
            5 responses
            20 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by WHICKED, Today, 12:56 PM
            2 responses
            15 views
            0 likes
            Last Post WHICKED
            by WHICKED
             
            Started by Felix Reichert, Today, 02:12 PM
            0 responses
            4 views
            0 likes
            Last Post Felix Reichert  
            Working...
            X