NexusFi: Find Your Edge


Home Menu

 





NT Programming Question - Avoiding Re-entry?


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Fibbee with 3 posts (0 thanks)
    2. looks_two Fat Tails with 1 posts (3 thanks)
    3. looks_3 goldenriver with 1 posts (0 thanks)
    4. looks_4 vegasfoster with 1 posts (0 thanks)
    1. trending_up 1,874 views
    2. thumb_up 3 thanks given
    3. group 2 followers
    1. forum 5 posts
    2. attach_file 1 attachments




 
Search this Thread

NT Programming Question - Avoiding Re-entry?

  #1 (permalink)
 
Fibbee's Avatar
 Fibbee 
Boston, MA. United States
 
Experience: Intermediate
Platform: Ninja
Trading: Futures and Forex
Posts: 159 since Sep 2011
Thanks Given: 102
Thanks Received: 166

I was hoping someone could help me figure out how to program (if possible) a strategy using the NT Swing indicator that will not take the same trade twice.

In other words, If I want to enter a long when resistance is broken and I have programmed the strategy to place the buy stop above the swing high, how do I code for not re-entering at the same price if the trade moves beyond resistance a little bit and then trades back below the level, closing a bar that is now < the swing high and subsequently placing a new buy stop at the same price.

This is what I am starting with..

// Condition set 1
if (Close[0] < Swing(3).SwingHigh[0])
{
EnterLongStop(DefaultQuantity, Swing(3).SwingHigh[0] + 1 * TickSize, "Long");
}

Obviously the strategy is doing exactly what it is supposed to do when the price closes below a swing high it will plot a new buy stop.. The question is how to stop it from re-entering at the same price?

Visit my NexusFi Trade Journal Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
MC PL editor upgrade
MultiCharts
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
ZombieSqueeze
Platforms and Indicators
How to apply profiles
Traders Hideout
Trade idea based off three indicators.
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
33 thanks
Tao te Trade: way of the WLD
24 thanks
My NQ Trading Journal
14 thanks
HumbleTraders next chapter
11 thanks
GFIs1 1 DAX trade per day journal
11 thanks
  #2 (permalink)
 
Fibbee's Avatar
 Fibbee 
Boston, MA. United States
 
Experience: Intermediate
Platform: Ninja
Trading: Futures and Forex
Posts: 159 since Sep 2011
Thanks Given: 102
Thanks Received: 166


Fibbee View Post
I was hoping someone could help me figure out how to program (if possible) a strategy using the NT Swing indicator that will not take the same trade twice.

In other words, If I want to enter a long when resistance is broken and I have programmed the strategy to place the buy stop above the swing high, how do I code for not re-entering at the same price if the trade moves beyond resistance a little bit and then trades back below the level, closing a bar that is now < the swing high and subsequently placing a new buy stop at the same price.

I have attached a picture that will hopefully help...

Thanks,

Attached Thumbnails
Click image for larger version

Name:	nt.JPG
Views:	171
Size:	40.6 KB
ID:	99167  
Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #3 (permalink)
 
goldenriver's Avatar
 goldenriver 
Frankfurt, Europe
 
Experience: Advanced
Platform: NT, SC, CTS T4
Trading: ES, CL
Posts: 75 since Mar 2012
Thanks Given: 111
Thanks Received: 25



Quoting 
// Condition set 1
if (Close[0] < Swing(3).SwingHigh[0])
{
EnterLongStop(DefaultQuantity, Swing(3).SwingHigh[0] + 1 * TickSize, "Long");
}

Try something like this:

// Condition set 1
if(CrossAbove(Close, Swing(3).SwingHigh),1)
{
EnterLongStop(DefaultQuantity, Swing(3).SwingHigh[0] + 1 * TickSize, "Long");
}

or

if(CrossBelow(Close, Swing(3).SwingHigh),1)
{
EnterLongStop(DefaultQuantity, Swing(3).SwingHigh[0] + 1 * TickSize, "Long");
}

maybe it works...

Reply With Quote
  #4 (permalink)
 
Fibbee's Avatar
 Fibbee 
Boston, MA. United States
 
Experience: Intermediate
Platform: Ninja
Trading: Futures and Forex
Posts: 159 since Sep 2011
Thanks Given: 102
Thanks Received: 166

No, that's just a different way of plotting the entry order but does nothing to stop the re-entry.

It must be less than/greater than so that the order is placed and standing before the break.

Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #5 (permalink)
 vegasfoster 
las vegas
 
Experience: Intermediate
Platform: Sierra Chart
Broker: Velocity/IB
Trading: 6E
Posts: 1,145 since Feb 2010
Thanks Given: 304
Thanks Received: 844

Should keep from reentering if already in position,

&& Position.MarketPosition == MarketPosition.Flat

Reply With Quote
  #6 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102

@Fibbee: You can add the following code:

 
Code
protected override void Initialize()
{
     EntriesPerDirection = 1; 
     EntryHandling = EntryHandling.AllEntries; 
}


This will make sure that you will not enter long, if you are already long.

Reply With Quote
Thanked by:




Last Updated on January 11, 2013


© 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