Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Entries per direction / ExitLong / ExitShort don't work properly real time

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

    Entries per direction / ExitLong / ExitShort don't work properly real time

    Hi!

    I have the following Problem: My strategy has entries per direction = 1. However, sometimes the strategy didn't exit the whole position or the strategy entered multiple times when trading real time (no sim account!). See attatched the real time trade performance report where you can see the problems.

    For example: The strategy entered on 19 July 2018 with 8 GER30 Short and made an Exit on 20 July 2018 with only 7 GER30 Long instead of 8 GER30 Long. I don't understand how that is possible because I have only "ExitShort()" in the code with no specification with size or anything.

    Also afterwards the positions went up to 32 GER30 short which shouldn't be possible when having entries per direction = 1.

    In the strategy analyzer everything was fine. I checked the parameteres and they are identical in both the strategy analyzer and the real time trade performance report. So these problems only occur when trading real time.

    The code of the strategy is basically as follows:


    double entryPrice = Close[0];
    int size = (int) (this.Capital / entryPrice);

    // Long
    if (IsFlat)
    {
    if (CONDITION)
    EnterLong(size, "Buy");
    }

    if (CONDITION)
    ExitLong();


    //Short
    if (IsFlat)
    {
    if (CONDITION)
    EnterShort(size, "Sell");
    }

    if (CONDITION)
    ExitShort();

    }

    bool IsFlat { get { return base.Position.MarketPosition == MarketPosition.Flat; }}
    bool IsLong { get { return base.Position.MarketPosition == MarketPosition.Long; }}


    Can anyone help me with this problem? I want the strategy to exit the whole position and not to enter multiple times in the same direction.

    Thanks!

    #2
    Hello KirkHammett,

    Thanks for your post.

    Strategy Analyzer vs. Realtime data will not be an apples to apples comparison as it would be comparing trades made with historical OHLC values vs. actual market dynamics. We should attempt to reproduce with the Playback Connection, and if the Playback Connection shows the issue, then we can start taking debugging steps. If the issue is only seen with real accounts, we should then identify how the issue can be encountered.

    Could you provide us answers to the following questions so we can be of further assistance?
    1. Do you see this issue when using the Playback Connection to reproduce this occurrence?
    2. Do you see this issue when using the Sim101 account with Live data or is this only prevalent when submitting orders to a live or paper trading account?
    3. If this is only seen when trading to a live account, who is your broker?
    Publicly available information on the Playback Connection can be found here - https://ninjatrader.com/support/help.../?playback.htm

    I look forward to your reply.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    29 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    124 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