Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Paper trading Strategies

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

    Paper trading Strategies

    Hello,

    I just enabled several strategis on my paper account and I wanted to be sure I'm doing this right. I have added a code to "return" if "historical" so to avoid the portfolio sync issue. However something doesn't feel right (I might be wrong...). I'm afraid that the strategy will never trigger because it includes two different days: something has to happen yesterday to trigger a signal today. How do I ensure that the strategy is working properly?

    Hope I mead myself clear!

    Thanks.
    Tex

    #2
    Hello,

    Not sure I understand the question exactly.

    Are you aware what if(!Historical) return exactly does? It stops processing on historical data to get to the current state.

    Your code would only run live, you wouldn't be able to run historically with that statement so you have to pick one or the other.

    You may need to look at another one of the strategy sync options.


    Strategy Position vs. Account Position:


    1st solution:

    You can include the following statement in your code to avoid the strategy to be calculated on historical data.

    // Only run on real-time data
    if (Historical)
    return;
    Add the statement to the top of OnBarUpdate()

    2nd solution:
    You can set 'On starting a real-time strategy' to 'Wait until flat before executing live'.
    This option can be found at Tools-->Options-->Strategies-->NinjaScript-tab.

    3rd solution, would be submitting manual orders to sync the strategy and account positions described in the link

    4th solution, would be to enable Sync account position to true.

    BrettNinjaTrader Product Management

    Comment


      #3
      Thanks for the info. I have enable the option "Wait until flat..." to TRUE. I have also changed the "Sync with account" to FALSE. If I understand correctly when I enable a strategy NT should just wait for a condition based on historical data indicated by the strategy options "Min bars" and "Max bars...". I still got a few "Your position in not in sync...". What am I missing?

      Comment


        #4
        Correct with WaitUntilFlat used, it would monitor for the fresh entry signal generated live only and execute it then, it would not attempt managing a virtual position coming from historical data. Which provider / broker and instrument are you testing with?

        Comment


          #5
          TD Ameritrade...

          Comment


            #6
            Thanks, so the TDA account you execute to is not in a flat state as you start the strategy?

            Comment


              #7
              I'm sorry (still learning!). The connection is TD Ameritrade but the account is Sim101 and it was flat. BTW do we refer to "flat" for the entire account or for that spefici instrument?

              Comment


                #8
                No worries, it could be meant for multiple things, an account is flat, an account is flat for a given instrument or a strategy position would be flat. Here for the TDA live account it would be in context for the executed to symbol / instrument, with WaitUntilFlat set the account should be in a flat state as well when the strategy is started. For the Sim101 internal account those considerations though would not apply.

                It would help if we could review your diagnostic trace / log files for this case, would you mind contacting us via Help >> Mail to Support from within your NT Control Center? Then those files would be automatically forwarded to us.

                Comment


                  #9
                  Done! Sent log via NT support. Please let me know.

                  Thanks.
                  Tex

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by NullPointStrategies, Today, 05:17 AM
                  0 responses
                  26 views
                  0 likes
                  Last Post NullPointStrategies  
                  Started by argusthome, 03-08-2026, 10:06 AM
                  0 responses
                  123 views
                  0 likes
                  Last Post argusthome  
                  Started by NabilKhattabi, 03-06-2026, 11:18 AM
                  0 responses
                  64 views
                  0 likes
                  Last Post NabilKhattabi  
                  Started by Deep42, 03-06-2026, 12:28 AM
                  0 responses
                  41 views
                  0 likes
                  Last Post Deep42
                  by Deep42
                   
                  Started by TheRealMorford, 03-05-2026, 06:15 PM
                  0 responses
                  46 views
                  0 likes
                  Last Post TheRealMorford  
                  Working...
                  X