Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Miscelleneous Questions
Collapse
X
-
Miscelleneous Questions
If you are running a strategy/indicator with "Calculate on bar close" set to false (tick by tick updates) then you can check the property FirsTickOfBar. There is no way to tell if a tick closes a bar since for time based intervals, there is no way to know this until you receive the first tick of the bar.How do I determine whether OnBarUpdate() is called for a bar that has just completed (or just started forming) versus just a tick update?
Check the Position.MarketPosition property to monitor when you go from not flat to a flat position and then submit your new entry order. With a release in the fall, you will be able to monitor order status events to determine when an order is filled.I am entering into a long position in my script and then adding a stop loss and target profit to it. I can do that fine. Next, when either the SL or target profit gets reached, I want to trigger another action such as enter a new Long order. How would I do this?
In C# this is called a static member. Here is a quick reference I found via Google.If I have different Ninja strategies running in the same chart or different charts, how can I have the strategies communicate with each other? In esignal, there is a way to set up global var's that all strategies have access to. Is there a similar thing in Ninjascript? I am also a newbie at c# so I am not aware yet how to use variables across namespaces.
Yes it can, this is a function of C#. What you need to do is add a reference to your DLL via the NinjaScript Editor, right click and select "Add Reference". This only needs to be done once since this is global.Can ninjascripts call external DLLs that I write? Again, I've done this in esignal but struggling to find this capability in ninjascript. Can you point me to the docs if they exist telling me the interface description, etc.RayNinjaTrader Customer ServiceTags: None
-
One thing that I have not seen clarified about the MarketPosition.Flat function is that does it work for the account that the strategy is running on, or does that apply to all the active accounts you have in Ninja Trader?
In my testing, I have been making the assumption that it is for the particular account that the strategy is running on.
For example, if I had a Sim101 and a Sim102 and the strategy is running on Sim101, it only checks on Sim101 and not for both Sim101 and Sim102.
-
Ok, so does the MarketPosition.Flat work based on both the account and strategy?
So if I have 2 strategies running on the same account (say StrategyA and StrategyB), StrategyA will only check for positions initiated by itself so even if there are open positions created by StrategyB, it will still say that the positions are flat for StrategyA.
Sorry if this is getting too confusing, but apparently the strategy was still firing off orders left and right even though I'm checking for open positions. Also, does MarketPosition.Flat work if the orders were initiated by an ATM strategy?
Comment
-
Correct if StrategyA is flat.So if I have 2 strategies running on the same account (say StrategyA and StrategyB), StrategyA will only check for positions initiated by itself so even if there are open positions created by StrategyB, it will still say that the positions are flat for StrategyA.
No it will not since an ATM stategy's position is not monitored by the Position property of the parent NinjaScript strategy. Use GetAtmStrategyMarketPosition() method instead.Also, does MarketPosition.Flat work if the orders were initiated by an ATM strategy?
RayNinjaTrader Customer Service
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
574 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
332 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
553 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
551 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment