This would be because the rollover for these instruments is December 9th.
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
Changing variables within an Indicator from another indicator with Buttons
Collapse
X
-
NinjaTrader_ChelseaB
In post#6 that is another great example. I am trying to convert from EnterLong to SubmitOrderUnmanaged.
I think I had it work this AM and then not since.
It appears that SubmitOrderUnmanaged may not work, I created a toggle to go back and forth between managed and unmanaged.
I prefer to use the unmanaged orders as I have better luck with catching errors especially the new GUID for the OCO.
Code:if (IsUnmanagedINPUT){ Print ("SubmitOrderUnmanaged IsUnmanaged="+IsUnmanaged+" IsUnmanagedINPUT="+IsUnmanagedINPUT); SubmitOrderUnmanaged(1, OrderAction.Buy, OrderType.Market, 1, 0, 0, string.Empty, "Long market"); }else{ Print ("SubmitOrderUnmanaged IsUnmanaged="+IsUnmanaged+" IsUnmanagedINPUT="+IsUnmanagedINPUT); EnterLong("Long market"); }
I have tried to figure it out with Visual Studio debugging
System.IndexOutOfRangeException
HResult=0x80131508
Message=Index was outside the bounds of the array.
Source=NinjaTrader.Core
StackTrace:
at NinjaTrader.NinjaScript.StrategyBase.SubmitOrderUn managed(Int32 selectedBarsInProgress, OrderAction orderAction, OrderType orderType, Int32 quantity, Double limitPrice, Double stopPrice, String oco, String signalName)
at NinjaTrader.NinjaScript.Strategies.ChartOrderButto nsStrategyExampleSubmitOrderUnmanaged.OnButtonClic k(Object sender, RoutedEventArgs rea) in c:\Users\bart\Documents\NinjaTrader 8\bin\Custom\Strategies\BTW\ChartOrderButtonsStrat egyExampleSubmitOrderUnmanaged.cs:line 245
at System.Windows.EventRoute.InvokeHandlersImpl(Objec t source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(Dependency Object sender, RoutedEventArgs args)
at System.Windows.Controls.Primitives.ButtonBase.OnCl ick()
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMo useLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Deleg ate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandle r(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Objec t source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(Dependency Object sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Deleg ate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandle r(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Objec t source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(Dependency Object sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedE ventArgs args)
at System.Windows.Input.InputManager.ProcessStagingAr ea()
at System.Windows.Input.InputManager.ProcessInput(Inp utEventArgs input)
at System.Windows.Input.InputProviderSite.ReportInput (InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.Repo rtInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.Filt erMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessa ge(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation( Object o)
at System.Windows.Threading.ExceptionWrapper.Internal RealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatch When(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
Comment
-
I took post#6 code, I added unmanaged tag
Code:if (State == State.SetDefaults) { isUnmanaged = true; }
Code:if (button == longMarketButton) { //EnterLong("Long market"); //SubmitOrderUnmanaged(int selectedBarsInProgress, OrderAction orderAction, OrderType orderType, int quantity); most simple entry SubmitOrderUnmanaged(1, OrderAction.Buy, OrderType.Market, 1); }
Last edited by BartMan; 05-28-2022, 06:04 PM.
Comment
-
BartMan The error "Index was outside the bounds of the array" means the code is trying to use an object in an array that has an index greater than the number of elements in the array.
Your code shows you are selecting BarsInProgress with an index of 1, i.e. the second data series in your strategy. BarsInProgress starts at zero for the first (possibly only) data series. Perhaps this is what is causing the error?
Thanks.
Comment
-
jeronymite thanks, great Idea but that does not appear to be it I printed out the bars CurrentBars[0]=34743 CurrentBar=34743
here is the full code I disabled the limit and conditional entry just to be sure. ChartOrderButtonsStrategyExampleIndexError.zip
Comment
-
jeronymite I changed the 1 to a 0 and it worked, I had copied that line from working code with with 2 data series, where series 0 is 5 min series 1 is tick data. You were right, THANKS!
fromCode:SubmitOrderUnmanaged([COLOR=#e74c3c]1,[/COLOR] OrderAction.Buy, OrderType.Market, 1);
Code:SubmitOrderUnmanaged([COLOR=#27ae60]0[/COLOR], OrderAction.Buy, OrderType.Market, 1);
Comment
-
Can I get some pointers here w/o detrailing the thread, as the function of buttons on chart .zip already added to the chart is how I have built my script. My idea is set a new value of bars period when a chart button is clicked, fast access to a different bars period on the current BarsPeriodType.
Can I get some help to determine what syntax I can use to point to the default data series' bars period & update Bars Period Value on a click then refresh the entire chart, my example is minute bars type.
Comment
-
I do not have the knowledge to direct answer most of your questions. I did create some buttons to trade ONE symbol from the chart of another which I need much help with.
IF you are trying to change 1 minute data from the main chart to another I am not sure that could ever be done and should not be done with a variable.
IF YOU have a 1 minute chart or a secondary dataseries for 1 minute and are applying an indicator like SMA to an 8 period to a chart and want to click a button and change that to a 20 period I would think you could do that.
Are you trying to plot an indicator OR trying to use and indicator in a strategy and want the button to alter the strategy?
Comment
-
I thought my reply was quite direct. t
My idea is to ustilize buttons on the chart window, in the chart space, to be able to set a list of variables that can be changed on load in, in the property grid. Assume these variables are ins and each set a button to a period of minutes. When loaded the default data series' BarsPeriod value is updated and the entire chart is refreshed.
Comment
-
Originally posted by LoganJKTrader View PostCan I get some pointers here w/o detrailing the thread, as the function of buttons on chart .zip already added to the chart is how I have built my script. My idea is set a new value of bars period when a chart button is clicked, fast access to a different bars period on the current BarsPeriodType.
Can I get some help to determine what syntax I can use to point to the default data series' bars period & update Bars Period Value on a click then refresh the entire chart, my example is minute bars type.
Thank you for your note.
There is no supported or documented method/property to programmatically make changes to the primary series. If you'd like to change the primary series, which would result in the script recalculating, then you could change it via the Data Series window or use the Interval Selector dropdown menu to make the change. You may also use the keyboard to type in the change then press enter to submit the change. For more details on changing a data series:
https://ninjatrader.com/support/help...price_data.htm
(See the sub-section How to change a Data Series)
Thank you for using NinjaTrader.Last edited by NinjaTrader_Emily; 05-31-2023, 08:40 AM.Emily C.NinjaTrader Customer Service
Comment
-
Originally posted by NinjaTrader_Emily View Post
Hello LoganJKTrader,
Thank you for your note.
There is no supported or documented method/property to programmatically make changes to the primary series. If you'd like to change the primary series, which would result in the script recalculating, then you could change it via the Data Series window or use the Interval Selector dropdown menu to make the change. You may also use the keyboard to type in the change then press enter to submit the change. For more details on changing a data series:
Thank you for using NinjaTrader.
I have an example of something, is there a list of values in the drop down that I can target to click or focus click the drop down then select the barsPeriod type and then set the value in that menu programmatically?
Comment
-
Originally posted by LoganJKTrader View Post
The link in your post leads to a broken url
I have an example of something, is there a list of values in the drop down that I can target to click or focus click the drop down then select the barsPeriod type and then set the value in that menu programmatically?
Thank you for your note.
I have edited the link in my previous reply to the following and ask that you review the "How to change a Data Series" sub-section:
I'm not sure I fully understand what you are describing in your question. If possible, please provide an example of what you are looking to achieve/how it would behave so I may better understand and assist you.
I look forward to your reply.Emily C.NinjaTrader Customer Service
Comment
-
Hello,
I'm trying to use the SampleWPFModifications.zip template to enter a stop entry long using Button 1 from the Chart Trader buttons. I thought it would just be adding the EnterLongStopMarket() command at the location where the yellow arrow is pointing below, but I keep getting the error 'The name 'EnterLongStopMarket' does not exist in the current context.' Is it giving me this error because this is an indicator and not a strategy? How would I go about using this button to enter a long stop market order?
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by sdauteuil, 09-23-2021, 10:16 AM
|
4 responses
1,208 views
0 likes
|
Last Post Yesterday, 11:41 PM | ||
Started by agclub, 04-21-2024, 08:57 PM
|
5 responses
34 views
0 likes
|
Last Post
by agclub
Yesterday, 09:47 PM
|
||
Started by ESHunter, Yesterday, 08:06 PM
|
2 responses
18 views
0 likes
|
Last Post
by ESHunter
Yesterday, 09:27 PM
|
||
Started by ETFVoyageur, 05-07-2024, 07:05 PM
|
19 responses
150 views
0 likes
|
Last Post
by ETFVoyageur
Yesterday, 09:14 PM
|
||
Started by ETFVoyageur, 05-11-2024, 10:13 PM
|
3 responses
26 views
0 likes
|
Last Post
by ETFVoyageur
Yesterday, 09:08 PM
|
Comment