Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Problem with script?

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

    Problem with script?

    I have a problem with my strategy.

    On chart it looks like the order has been closed, but on Super Dom the order is still there. And after this, on chart the order appears to exit again.

    Please look on the attached chart:

    Click image for larger version

Name:	FDAX 12-11 (2 Range)  11_9_2011.jpg
Views:	1
Size:	110.5 KB
ID:	897928

    I have a single target long (in the place where you see the arrow), but I have two orders on exit.

    Here are my entry conditions:

    Code:
    protected override void OnBarUpdate()
            {
                
                EntryHandling = EntryHandling.UniqueEntries;
                
                ManageOrders();
                ManageExit();
                
                
                
                
                if ((Position.MarketPosition == MarketPosition.Short |
                    Position.MarketPosition == MarketPosition.Flat) &&
                    ErgodicEntryNo && CrossAbove(QQE(RSI_Period, SF).Value1, QQE(RSI_Period, SF).Value2, LookBackCross) &&
                    EMA(EMAperiod1)[0] > EMA(EMAperiod2)[0] 
                    )
                    
                
                    GoLong();
                    
                
                
                else if ((Position.MarketPosition == MarketPosition.Long |
                    Position.MarketPosition == MarketPosition.Flat) &&
                    ErgodicEntryNo && CrossAbove(QQE(RSI_Period, SF).Value2, QQE(RSI_Period, SF).Value1, LookBackCross) &&
                    EMA(EMAperiod1)[0] < EMA(EMAperiod2)[0] 
                    )
                    
                
                    GoShort();
                
                else if ((Position.MarketPosition == MarketPosition.Short |
                    Position.MarketPosition == MarketPosition.Flat) && 
                    ErgodicEntryNo && QQE(RSI_Period, SF).Value1[0] > QQE(RSI_Period, SF).Value2[0] &&
                    CrossAbove(EMA(EMAperiod1), EMA(EMAperiod2), LookBackCross)
                    )
                    
                
                    GoLong();
                    
                
                
                else if ((Position.MarketPosition == MarketPosition.Long |
                    Position.MarketPosition == MarketPosition.Flat) &&
                    ErgodicEntryNo && QQE(RSI_Period, SF).Value1[0] < QQE(RSI_Period, SF).Value2[0] &&
                    CrossAbove(EMA(EMAperiod2), EMA(EMAperiod1), LookBackCross) 
                    )
                                
                    GoShort();
                
                // entry ergodic
                
            else if ((Position.MarketPosition == MarketPosition.Short |
                    Position.MarketPosition == MarketPosition.Flat) &&
                    ErgodicEntry && CrossAbove(QQE(RSI_Period, SF).Value1, QQE(RSI_Period, SF).Value2, LookBackCross) &&
                    EMA(EMAperiod1)[0] > EMA(EMAperiod2)[0] &&
                    Ergodic(3, 5, 14).Main[0] >= 25
                    )
                                
                    GoLong();
                    
                
                
                else if ((Position.MarketPosition == MarketPosition.Long |
                    Position.MarketPosition == MarketPosition.Flat) &&
                    ErgodicEntry && CrossAbove(QQE(RSI_Period, SF).Value2, QQE(RSI_Period, SF).Value1, LookBackCross) &&
                    EMA(EMAperiod1)[0] < EMA(EMAperiod2)[0] &&
                    Ergodic(3, 5, 14).Main[0] <= -25
                    )
                    
                
                    GoShort();
                
                else if ((Position.MarketPosition == MarketPosition.Short |
                    Position.MarketPosition == MarketPosition.Flat) &&
                    ErgodicEntry && QQE(RSI_Period, SF).Value1[0] > QQE(RSI_Period, SF).Value2[0] &&
                    CrossAbove(EMA(EMAperiod1), EMA(EMAperiod2), LookBackCross)&&
                    Ergodic(3, 5, 14).Main[0] >= 25
                    )
                    
                
                    GoLong();
                    
                
                
                else if ((Position.MarketPosition == MarketPosition.Long |
                    Position.MarketPosition == MarketPosition.Flat) &&
                    ErgodicEntry && QQE(RSI_Period, SF).Value1[0] < QQE(RSI_Period, SF).Value2[0] &&
                    CrossAbove(EMA(EMAperiod2), EMA(EMAperiod1), LookBackCross) &&
                    Ergodic(3, 5, 14).Main[0] <= -25
                    )
                    
                
                    GoShort();
                
              
                
            }
    Can someone help?
    Attached Files

    #2
    Hello,

    Is this reproducible, or does this only happen on occassion?

    Was the order that is show on the SuperDOM actually sent from this strategy?

    What is your strategy position currently at from the Strategies tab? What is your Account position?
    MatthewNinjaTrader Product Management

    Comment


      #3
      Originally posted by NinjaTrader_Matthew View Post
      Hello,

      Is this reproducible, or does this only happen on occassion?

      Was the order that is show on the SuperDOM actually sent from this strategy?

      What is your strategy position currently at from the Strategies tab? What is your Account position?
      It only happens on occasion.

      Yes, the order was sent from this strategy.

      I don't have the strategy loaded on chart anymore. But I know that `buy to cover` (see the arrow on chart) did not appear on super DOM. It was just on chart. On super DOM the order was still there.

      Thank you.

      Comment


        #4
        Hello,

        The next time this occurs, please check the Accounts tab vs the Strategy tab.

        It may be that your strategy and your account are out of sync.

        Please review our Forum Post on Strategy Position vs. Account Position for more information:

        MatthewNinjaTrader Product Management

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by gentlebenthebear, Today, 01:30 AM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by Aviram Y, Today, 05:29 AM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by cls71, Today, 04:45 AM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by TradeForge, Today, 02:09 AM
        1 response
        22 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by elirion, Today, 01:36 AM
        2 responses
        14 views
        0 likes
        Last Post elirion
        by elirion
         
        Working...
        X