• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

EntriesPerDirection and EntryHandling failed during simulated trading.

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

    EntriesPerDirection and EntryHandling failed during simulated trading.

    EntriesPerDirection and EntryHandling failed during simulated trading.
    Strategy opened more than 1 Entry Per Direction when I have opened positions that weren't closed.
    Instruments: EURUSD and GBPUSD

    Code:
    protected override void OnStateChange()
    {
        if (State == State.SetDefaults)
        {
            EntriesPerDirection = 1;
            EntryHandling = EntryHandling.AllEntries;
        }
    }
    I'm connected to NT FXCM Demo.
    The server disconnects on Friday after FX market closes and reconnects and opens on Sunday.
    Is that why EntriesPerDirection and EntryHandling failed during simulated trading?
    This is a "multi-instrument" pair trading strategy.
    Attached Files
    Last edited by johnnybegoode; 01-16-2019, 07:16 PM.

    #2
    Hello johnnybegoode,

    Thank you for the question.

    I wanted to check, is this an image of the real-time results?

    If there were a disconnect and the strategy was disabled then re-enabled that would be one case where you could see multiple entries in the same direction as the strategy would effectively be reset. In the strategies virtual performance it would only be in the direction by one while the account may have two in that direction. As I don't have any details on the setup or syntax used this is only a guess at what may have occurred. Can you provide more details on the events that transpired, was the script disabled and re-enabled?

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      It is real-time.
      FXCM disconnects after market closes.
      I did disable and re-enable the strategy.
      I let it run unattended.

      Q1:
      Would adding to (State == State.Configure) reinforce 1 Entry Per Direction?
      Or would it not make a difference?
      Code:
      else if (State == State.Configure)
                  {
                      EntriesPerDirection = 1;
                      EntryHandling = EntryHandling.AllEntries;
                  }
      Q2:
      Would checking before opening orders reinforce 1 Entry Per Direction further?
      Would these 4 lines of checks work?
      Code:
      if          (
      
                  //          Conditions ....
      
      && (PositionsAccount[0].MarketPosition == MarketPosition.Flat)
                       && (PositionsAccount[0].Quantity == 0)
                       && (PositionsAccount[1].MarketPosition == MarketPosition.Flat)
                       && (PositionsAccount[1].Quantity == 0))
                  {
                      EnterLong(0,Quantity,"EURUSD");
                      EnterShort(1,Quantity,"GBPUSD");
                  }
      Last edited by johnnybegoode; 01-21-2019, 06:41 PM.

      Comment


        #4
        Hello johnnybegoode,

        Thank you for your response.

        Entry Handling and Entries Per Direction will only affect the orders submitted and not how many positions can be opened. As you indicate in your second question in your latest post you do in fact need to verify the positions if you do not want to scale into an open position. So the answer to your first question is to use your approach in the second question.

        Please let me know if you have any questions.
        Patrick H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by TikDaddy, Today, 02:08 PM
        3 responses
        10 views
        0 likes
        Last Post TikDaddy  
        Started by Brillo, Today, 01:52 PM
        1 response
        14 views
        0 likes
        Last Post NinjaTrader_Jim  
        Started by TazoTodua, 02-09-2018, 08:40 AM
        10 responses
        883 views
        0 likes
        Last Post NinjaTrader_JoshG  
        Started by TazoTodua, Yesterday, 04:35 AM
        6 responses
        18 views
        0 likes
        Last Post eDanny
        by eDanny
         
        Started by MattP, Today, 12:25 PM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_PatrickG  
        Working...
        X