NT Programming Question - Avoiding Re-entry? - NinjaTrader | futures io social day trading
futures io futures trading


NT Programming Question - Avoiding Re-entry?
Updated: Views / Replies:871 / 5
Created: by Fibbee Attachments:1

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

NT Programming Question - Avoiding Re-entry?

  #1 (permalink)
Elite Member
Boston, MA. United States
 
Futures Experience: Advanced
Platform: Ninja
Favorite Futures: Futures and Forex
 
Fibbee's Avatar
 
Posts: 79 since Sep 2011
Thanks: 68 given, 40 received

NT Programming Question - Avoiding Re-entry?

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?


Last edited by Fibbee; January 10th, 2013 at 12:52 AM.
Reply With Quote
 
  #2 (permalink)
Elite Member
Boston, MA. United States
 
Futures Experience: Advanced
Platform: Ninja
Favorite Futures: Futures and Forex
 
Fibbee's Avatar
 
Posts: 79 since Sep 2011
Thanks: 68 given, 40 received

How to program a strategy to avoid re-entry at the same price?


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,

FIBBEE

One of the ways that success in trading is kept out of your life, is by this desperate need to over complicate your trading and think that things should be harder. - Bob Iaccino
Attached Thumbnails
NT Programming Question - Avoiding Re-entry?-nt.jpg  
Reply With Quote
 
  #3 (permalink)
Elite Member
Frankfurt, Europe
 
Futures Experience: Advanced
Platform: NT, SC, CTS T4
Favorite Futures: ES, CL
 
goldenriver's Avatar
 
Posts: 75 since Mar 2012
Thanks: 111 given, 24 received



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)
Elite Member
Boston, MA. United States
 
Futures Experience: Advanced
Platform: Ninja
Favorite Futures: Futures and Forex
 
Fibbee's Avatar
 
Posts: 79 since Sep 2011
Thanks: 68 given, 40 received

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.

FIBBEE

One of the ways that success in trading is kept out of your life, is by this desperate need to over complicate your trading and think that things should be harder. - Bob Iaccino
Reply With Quote
 
  #5 (permalink)
Elite Member
las vegas
 
Futures Experience: Intermediate
Platform: Sierra Chart
Broker/Data: Velocity/IB
Favorite Futures: 6E
 
Posts: 1,147 since Feb 2010
Thanks: 304 given, 836 received

Answer
This post has been selected as an answer to the original posters question Answer

Should keep from reentering if already in position,

&& Position.MarketPosition == MarketPosition.Flat

Reply With Quote
 
  #6 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,653 since Mar 2010
Thanks: 4,226 given, 25,602 received
Forum Reputation: Legendary

Answer
This post has been selected as an answer to the original posters question Answer

@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
The following 3 users say Thank You to Fat Tails for this post:

Reply



futures io > > > > NT Programming Question - Avoiding Re-entry?

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Question on the execution plot (connection lines between entry and exit) ilikeread NinjaTrader 2 April 6th, 2016 07:38 AM
ThinkScript (TOS) Programming Question Curbfeeler ThinkOrSwim Programming 10 March 8th, 2016 04:19 PM
Programming help for NT Indicators Cudashark NinjaTrader Programming 3 October 11th, 2012 03:45 AM
Programming Conditionals & Exit x Bars after Entry nanook77 Elite Automated Trading 2 November 9th, 2011 12:54 AM
Programming Strats in NT v7 zeller4 NinjaTrader Programming 5 January 18th, 2010 10:09 AM


All times are GMT -4. The time now is 06:31 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts
Page generated 2017-12-17 in 0.10 seconds with 32 queries on phoenix via your IP 54.82.81.154