• 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

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.
    JimNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by jamarc, Today, 02:30 AM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by uday12, Yesterday, 04:19 PM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_PaulH  
    Started by grose, Today, 06:53 AM
    2 responses
    6 views
    0 likes
    Last Post grose
    by grose
     
    Started by Bobisam, Yesterday, 04:57 PM
    1 response
    20 views
    0 likes
    Last Post NinjaTrader_PaulH  
    Started by voltlon, Yesterday, 05:18 PM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_PaulH  
    Working...
    X