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 vegasfoster with 1 posts (0 thanks)
    3. looks_3 Fat Tails with 1 posts (3 thanks)
    4. looks_4 goldenriver with 1 posts (0 thanks)
    1. trending_up 2,447 views
    2. thumb_up 3 thanks given
    3. group 2 followers
    1. forum 5 posts
    2. attach_file 1 attachments




 
Search this Thread
  #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: 168

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?
Kalshi Sets $4.13B All-Time Weekly Record as Polymarket …
Prediction Markets & Event Contracts
Hormuz Surges From 14% to 26.5% Intraday as Irans Answer …
Prediction Markets & Event Contracts
Without Pulisic, USA 61.5% Live vs. Australia -- France …
Prediction Markets & Event Contracts
Iran Airspace Collapses 18 Points to 15.5% While Hormuz …
Prediction Markets & Event Contracts
Second Night of US Strikes Crushes Iran June 15 to 3.6% …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
13 thanks
Darmok and Jalad at Tanagra
3 thanks
Big Mike in Ecuador
1 thanks
30 Sessions
1 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: 168


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:	250
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: 168

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: 845

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
Legendary Market Wizard
 
Experience: Advanced
Platform: NinjaTrader
Broker: Interactive Brokers
Trading: Futures & Stocks
Posts: 9,887 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,117

@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


© 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