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, 08: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.

    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 ....
      
      [B]&& (PositionsAccount[0].MarketPosition == MarketPosition.Flat)
                       && (PositionsAccount[0].Quantity == 0)
                       && (PositionsAccount[1].MarketPosition == MarketPosition.Flat)
                       && (PositionsAccount[1].Quantity == 0))[/B]
                  {
                      EnterLong(0,Quantity,"EURUSD");
                      EnterShort(1,Quantity,"GBPUSD");
                  }
      Last edited by johnnybegoode; 01-21-2019, 07: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.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        88 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        134 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        68 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        119 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        67 views
        0 likes
        Last Post PaulMohn  
        Working...
        X