Texasguy
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Timeinforce syntax
Collapse
X
-
Hello Texasguy,
Welcome to the support forums.
The TIF setting specifically could not be used in this way, but you can create logic to cancel orders after a certain number of bars.
There are NinjaScript methods to know how many bars it has been since an entry or an exit.
These items can be used in both manual coding and the strategy builder to check a number of bars have passed after an entry or exit to allow an action. If the limit order in question is a protective order as an example, you could use the BarsSinceEntryExecution to control if the limit is active after more than 4 bars from the entry point.
I look forward to being of further assistance.JesseNinjaTrader Customer Service
-
Thank you. I will try this. One other question. I tried to follow the video on the simple SMA crossover video. When creating the trade counter it gives me the error that the name bars, as in (bars.firstbarofsession), does not exist in the current context. Do I have to create a reference to "bars" under variables like I did with Private int Counter = 0 command?
{
if (bars.firstbarofsession)
counter = 0;
if (counter <= 10);
// Condition set 1
if (CrossAbove(EMA(8), EMA(21), 1))
{
EnterLongLimit(DefaultQuantity, Median[1], "");
}
Comment
-
Hello,
Thank you for the reply.
I noted that this is both lowercase and is the NT7 usage.
The capitalization of names in NinjaScript/C# is very important, this cannot be found in your code because the syntax is not correct. Bars need to be capitalized, also the property firstbarofsession would need to be spelled IsFirstBarOfSession.
I look forward to being of further assistance.JesseNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by ninza33, Today, 07:16 AM
|
2 responses
5 views
0 likes
|
Last Post Today, 08:05 AM | ||
Started by ellington, Today, 07:40 AM
|
0 responses
2 views
0 likes
|
Last Post
by ellington
Today, 07:40 AM
|
||
Started by Atticus20, Today, 07:27 AM
|
0 responses
7 views
0 likes
|
Last Post
by Atticus20
Today, 07:27 AM
|
||
Started by linkcou, Today, 07:01 AM
|
0 responses
7 views
0 likes
|
Last Post
by linkcou
Today, 07:01 AM
|
||
Started by brunoviveiros, 02-17-2020, 05:31 AM
|
4 responses
66 views
0 likes
|
Last Post Today, 06:25 AM |
Comment