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
Leeloo's account with ríthmic does not execute operations
Collapse
X
-
Hello franatas,
Thanks for your post.
Please answer all of the questions below so I may accurately assist you.- What version of NinjaTrader are you using?
- If you open up a chart window, do you see realtime data populating on the chart when connected to your Leeloo account?
- Do you receive an error on screen? Are there errors on the Log tab of the Control Center? If so, what do these errors report?
- Have you added debugging prints to the strategy to understand how it is behaving?
I look forward to assisting further.Brandon H.NinjaTrader Customer Service
-
-
Here I leave the version, and how it can be seen when activating the strategy, it also shows me the possible entries that occurred before activating
Last edited by NinjaTrader_BrandonH; 06-06-2023, 10:17 AM.
Comment
-
Hello franatas,
Thanks for your notes.
I see in the screenshots you shared that your strategies are set to be enabled on the Sim101 account which is why they are running on the Sim101 account.
If you want the strategy to run on your Leeloo account and place orders to the Leeloo account, you will need to set the Account property in the Strategies window to use the Leeloo account when enabling the strategy.
Disable a strategy on the Strategies tab of the Control Center, right-click on the strategy in the Strategies tab of the Control Center, select 'Edit strategy', set the 'Account' property drop-down menu to your Leeloo account, and click OK. Then, when you enable the strategy, it will enable on your Leeloo account instead of the Sim101 account.
See this help guide page for more information about running a NinjaScript strategy: https://ninjatrader.com/support/help...t_strategy.htm
Brandon H.NinjaTrader Customer Service
Comment
-
-
Hello franatas,
Thanks for your note.
Anytime you go to enable a NinjaScript strategy on a chart, you must always ensure that you are setting the Account drop-down property in the Strategies window to the account that you want to enable the strategy on.
The strategy will run on whatever account you have selected in the Strategies window when enabling the strategy regardless of what account you have selected in Chart Trader.
Review this help guide page for more information: https://ninjatrader.com/support/help...t_strategy.htmBrandon H.NinjaTrader Customer Service
Comment
-
Hello Franatas,
Thanks for your note.
PositionAccount.Quantity could be used to get the number of positions on an account in the strategy.
For example:
// Prints out the current market position
Print(PositionAccount.MarketPosition.ToString() + " " + PositionAccount.Quantity.ToString());
Note that NinjaScript strategies are only able to see the orders placed on an account/instrument combination by that specific instance of the strategy. It cannot see orders placed by other strategies or see manually placed orders.
For example, say you have two strategies running on the ES instrument and each strategy placed 1 Long order, putting you in a total account position of 2 Long on that instrument. PositionAccount.Quantity would return a value of 2 since you are 2 Long on the ES instrument on that account.
Say you have two strategies. One is running on the NQ instrument and the other is running on the ES instrument. Each strategy places 1 Long order so you are in a 1 Long position on NQ and are in a 1 Long position on ES. When the strategy running on the ES prints PositionAccount.Quantity, it will return a value of 1 since there is 1 Long position on that instrument/account combination and it cannot see orders placed by the strategy running on the other instrument.
See this help guide page for more information: https://ninjatrader.com/support/help...t_quantity.htmBrandon H.NinjaTrader Customer Service
Comment
-
Let's say you have a strategy in two instruments. One is running on the NQ instrument and the other is running on the ES instrument.::
I do not understand that if PositionAccount.MarketPosition adds the positions of an account and I have the same strategy in two instruments in the same account, it does not add all the positions
If I work in a funding account that allows me a maximum of 3 contracts, we need to obtain all the positions and pending orders so as not to break the account in case of a signal in one instrument when another has 3 open positions
even in a real account if I want an account to only have a maximum of 3 positions and working on several instruments would not be worth it either
Comment
-
something else: EnterLongStopLimit(Convert.ToInt32(BuyContracts), EntryPrice + 2 * TickSize, EntryPrice, @"LONGS"); would this be well posed?
I have not been able to see it in the market, but I understood that if it is a stop limit and slippage occurs, the order in this case cannot be executed above two ticks from the entry price, is that correct? And if so, would the order be discarded?
Comment
-
Hello franatas,
Thanks for your notes.
PositionAccount.MarketPosition will check what market position you are in for the instrument/account combination the strategy is running on.
After further research, I have found that you could loop through <Account>.Positions to accomplish this. You could create class-level double variables named something like 'esQty', 'nqQty', and 'totalQty'. Then loop through <Account>.Positions and in the loop check if position.Instrument.FullName is equal to the instrument (such as "NQ 06-22") and assign position.Quantity to the variable nqQty variable.
Then, you could add together the variables holding quantities and assign that to the totalQty variable.
For example:
Code://class-level variables private Account myAccount; private double esQty; private double nqQty; private double totalQty; //OnStateChange() // Find our Sim101 account lock (Account.All) myAccount = Account.All.FirstOrDefault(a => a.Name == "Sim101"); //OnBarUpdate() foreach (Position position in myAccount.Positions) { Print(String.Format("Position: {0} at {1} and the instrument is {2}", position.MarketPosition, position.Quantity, position.Instrument)); if (position.Instrument.FullName == "NQ 06-23") nqQty = position.Quantity; if (position.Instrument.FullName == "ES 06-23") esQty = position.Quantity; } totalQty = nqQty + esQty; Print("totalQty " + totalQty);
Account: https://ninjatrader.com/support/help...ount_class.htm
<Account>.Positions: https://ninjatrader.com/support/help...tsub=myAccount. PositionsBrandon H.NinjaTrader Customer Service
Comment
-
great, just a small detail, it would be possible to obtain the name of the account dosde the strategy is being executed automatically, that would avoid me having a code for each account name, if this is possible it would be great, and if not with This would fix me, thank you very much BrandonH your performance is wonderful
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by inanazsocial, Today, 01:15 AM
|
0 responses
2 views
0 likes
|
Last Post
by inanazsocial
Today, 01:15 AM
|
||
Started by trilliantrader, 04-18-2024, 08:16 AM
|
5 responses
22 views
0 likes
|
Last Post Today, 12:32 AM | ||
Started by Davidtowleii, Today, 12:15 AM
|
0 responses
3 views
0 likes
|
Last Post
by Davidtowleii
Today, 12:15 AM
|
||
Started by guillembm, Yesterday, 11:25 AM
|
2 responses
9 views
0 likes
|
Last Post
by guillembm
Yesterday, 11:58 PM
|
||
Started by junkone, 04-21-2024, 07:17 AM
|
9 responses
71 views
0 likes
|
Last Post
by jeronymite
Yesterday, 11:51 PM
|
Comment