Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Weird behavior with order entry

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

    Weird behavior with order entry

    Click image for larger version  Name:	nt-capture.png Views:	6 Size:	561.2 KB ID:	1271977Hi all,
    I'm seeing some very weird behavior (with very simple code) with a strategy giving impossible fills.

    I've tried different timeframes (ticks/minutes/etc)
    It tends to only happen when using CrossAbove or CrossBelow
    Any idea what's going on? It's not even entering on crosses sometimes - not to mention the fill price

    Code:
    ////for brevity - in OnStateChange under State == State.DataLoaded
    ema21 = EMA(Close, 21);
    
    //OnBarUpdate()
    if (CrossAbove(Close, ema21, 1))
    {
    EnterLong(2, "Long");
    }



    Last edited by kvroman; 10-08-2023, 11:52 AM.

    #2
    check the close, is it previous close of candle or current candle like 'close[1]' or close[0].

    Comment


      #3
      I changed it to Close[0] - still compiled but didn't fix the issue

      Comment


        #4
        Figured it out. Thanks for helping, sorry for wasting your time!

        Comment


          #5
          Did you apply the close in multiple parts of the code . Also knowing what you want to achieve in the strategy will help in coding the steps .
          Close[0] > ema(9)[0];
          Last edited by Emma1; 10-08-2023, 02:19 PM.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Today, 05:17 AM
          0 responses
          23 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          120 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          63 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
          45 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X