NexusFi: Find Your Edge


Home Menu

 





Entry condition error?


Discussion in NinjaTrader

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




 
Search this Thread

Entry condition error?

  #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

Can you help answer these questions
from other members on NexusFi?
Exit Strategy
NinjaTrader
Ninja Mobile Trader VPS (ninjamobiletrader.com)
Trading Reviews and Vendors
ZombieSqueeze
Platforms and Indicators
Deepmoney LLM
Elite Quantitative GenAI/LLM
Futures True Range Report
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
59 thanks
Funded Trader platforms
37 thanks
NexusFi site changelog and issues/problem reporting
24 thanks
GFIs1 1 DAX trade per day journal
22 thanks
The Program
19 thanks
  #3 (permalink)
 
kkfx's Avatar
 kkfx 
Mumbai, India
 
Experience: Intermediate
Platform: MT4, NT8,TradingView
Broker: AMP
Trading: Index,currencies
Posts: 116 since Jul 2010
Thanks Given: 325
Thanks Received: 160



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


© 2024 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 - Privacy Policy - Downloads - Top
no new posts