NexusFi: Find Your Edge


Home Menu

 





Entry condition error?


Discussion in NinjaTrader

Updated
    1. trending_up 2,602 views
    2. thumb_up 0 thanks given
    3. group 1 followers
    1. forum 2 posts
    2. attach_file 1 attachments




 
Search this Thread
  #1 (permalink)
 gomad 
Tirgu Mures, Romania
 
Experience: Intermediate
Platform: Ninja
Broker: ZenFire
Trading: CL, GC
Posts: 36 since Sep 2010
Thanks Given: 42
Thanks Received: 7

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:



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?


Started this thread Reply With Quote

 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
24 thanks
2026 Jlab journal
10 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
6 thanks
Trying to learn Volume and price action correlation
5 thanks
  #3 (permalink)
 
kkfx's Avatar
 kkfx 
Mumbai, India
 
Experience: Intermediate
Platform: MT4, NT8,TradingView
Broker: AMP
Trading: Index,currencies
Posts: 117 since Jul 2010
Thanks Given: 326
Thanks Received: 163



Quoting 
Can someone help?

If you have tested this on a market replay, then problem is probably with fills.

Go to tools----> options------> simulator tab-----> check " enforce immediate fills "
and then again test on a market replay.

Of course under real market conditions, you may get similar 2 fills when you exit with market order.


Reply With Quote




Last Updated on November 14, 2011


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts