NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 07-11-2012, 07:59 AM   #1
peonia trader
Junior Member
 
Join Date: Nov 2010
Posts: 5
Thanks: 0
Thanked 0 times in 0 posts
Default Enter Filter

Good afternoon.

I enclose a Script, which desire to execute the orders of input points with a filter to limit the number of failed logins.

1. - The case is, that market entry should have a filter to prevent many failed logins, hence the idea of putting a filter input range (filtroM) of 20 points above / below the closing cross bar (bullish / bearish).

EnterLong (Close [0] + filtroM);
EnterShort (Close [0] - filtroM);

The reason that the input commands are in "Stop" is because it throws an order at a price above / below the market.

Obviously entry should be at any post sail beam, thus closing it, is the starting point.

Hence, the firm intends to use (but does not work):

EnterLong Stop (int barsInProgressIndex, liveUntilCancelled bool, int Quantity, double stopPrice, string signalName);

For the order of entry of a candle last longer (and not canceled internally by NT7)

2. - The code attached, it works, but I need to create strategies to ensure compliance with the above.

Could you tell me how is it done?

A greeting.
Attached Files
File Type: zip As7Prueba2.zip (3.1 KB, 2 views)
peonia trader is offline  
Reply With Quote
Old 07-11-2012, 08:17 AM   #2
NinjaTrader_AdamP
NinjaTrader Customer Service
 
NinjaTrader_AdamP's Avatar
 
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
Default

peonia trader,

1. I am not sure I understand this filter. There are unsupported methods to determine connection status, so you could possibly use these, count disconnections, then if there are too many disable your strategy.

When you say "login", could you explain this?

2. Your strategy needs to have this connection count?

I'd be happy to comment further if you could clarify.
NinjaTrader_AdamP is offline  
Reply With Quote
Old 07-11-2012, 08:56 AM   #3
peonia trader
Junior Member
 
Join Date: Nov 2010
Posts: 5
Thanks: 0
Thanked 0 times in 0 posts
Default Enter Filter

Hi AdamP.

1. - Seeking how to make entries with a "filter points" above / below the price depending Long / Short.
Thus many entries to avoid market failures.

But not how to program them into the code and it works.

I think that to run commands above / below the price, orders must be in "Stop"

2. - In addition, the order should remain active until it is filled.

Can you tell me, how I program in the system code?

A greeting.
peonia trader is offline  
Reply With Quote
Old 07-11-2012, 09:09 AM   #4
NinjaTrader_AdamP
NinjaTrader Customer Service
 
NinjaTrader_AdamP's Avatar
 
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
Default

peonia trader,

Yes, in this case you would want to use EnterLongLimit(), EnterLongStop(), EnterShortLimit() and EnterShortStop() depending on how you want to handle this.

These reference samples may help you.

Trading a breakout : http://www.ninjatrader.com/support/f...ead.php?t=3223

Monitoring multiple orders : http://www.ninjatrader.com/support/f...ead.php?t=3225

Using CancelOrder to cancel Stop/Limit orders : http://www.ninjatrader.com/support/f...ad.php?t=18890

You can use the following : http://www.ninjatrader.com/support/h...imeinforce.htm to have an order remain active until its closed.

Please let me know if I may assist further.
NinjaTrader_AdamP is offline  
Reply With Quote
Old 07-16-2012, 12:48 PM   #5
peonia trader
Junior Member
 
Join Date: Nov 2010
Posts: 5
Thanks: 0
Thanked 0 times in 0 posts
Default Exit with filter points

I enclose a system that:
- The entry is long on "Stop" when a bullish crossover filter is reached "filtroM".
- Has a target profit "profitL".
- And out of the market "ExitLong ();" when a bearish cross.

I intend the system to perform:
1. - To exit the market, the reverse of the form that has entered, ie, when a crossbelow and the output occurs in: "Close [0] - filtroM".
with the same filter for the inputs Long, but in reverse.

2. - For the output produced in "Close [0] - filtroM" also need the output the order remains active over a candle.
Thanks for the help.
Attached Files
File Type: zip As7PruebaL.zip (3.0 KB, 1 views)
peonia trader is offline  
Reply With Quote
Old 07-16-2012, 01:03 PM   #6
NinjaTrader_AdamP
NinjaTrader Customer Service
 
NinjaTrader_AdamP's Avatar
 
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
Default

peonia,

Do you have any questions about this or are you posting your work to show?

I'd be happy to answer questions where I am able.
NinjaTrader_AdamP is offline  
Reply With Quote
Old 07-17-2012, 06:56 AM   #7
peonia trader
Junior Member
 
Join Date: Nov 2010
Posts: 5
Thanks: 0
Thanked 0 times in 0 posts
Default Exit with filter points

Hi AdamP.

Yes, indeed, my questions are 1 and 2 points above.
But I do not know what function to use, if I use an ExitLong "Stop" order.
The Output Window tells me that the orders are canceled each other.
Then, what functions should I use?

Thanks
peonia trader is offline  
Reply With Quote
Old 07-17-2012, 07:03 AM   #8
NinjaTrader_AdamP
NinjaTrader Customer Service
 
NinjaTrader_AdamP's Avatar
 
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
Default

peonia,

You can use limit or stop orders here depending on how you want to handle it.

As far as cancelling pending limit or stop orders, you can use the following : http://www.ninjatrader.com/support/h...ancelorder.htm

You can check if you are in a position using : http://www.ninjatrader.com/support/h...etposition.htm

Using this way to check your position, you can then use the ExitLong() or ExitShort() commands. They key is to know you have a position first as a limit order may be a pending order until its filled.

Please let me know if I may assist further.
NinjaTrader_AdamP is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
MTF Filter Possible? tshirtdeal Market Analyzer 10 04-23-2012 06:00 AM
Filter Question gapmeister Market Analyzer 3 02-29-2012 02:12 PM
Time Filter shiptastic Strategy Development 5 01-07-2009 09:41 AM
Filter by contract? Bogan7 Miscellaneous Support 1 02-07-2008 07:58 PM
Tick Filter zoltran Historical NinjaTrader 6.5 Beta Threads 3 11-19-2007 10:56 AM


All times are GMT -6. The time now is 04:45 PM.