![]() |
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Nov 2010
Posts: 5
Thanks: 0
Thanked 0 times in 0 posts
|
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. |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
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.
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Nov 2010
Posts: 5
Thanks: 0
Thanked 0 times in 0 posts
|
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. |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
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.
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Nov 2010
Posts: 5
Thanks: 0
Thanked 0 times in 0 posts
|
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. |
|
|
|
|
|
#6 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
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.
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Junior Member
Join Date: Nov 2010
Posts: 5
Thanks: 0
Thanked 0 times in 0 posts
|
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 |
|
|
|
|
|
#8 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
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.
Adam P.
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |