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
Getting Current Ask in an Addon
Collapse
X
-
Hello omololu thanks for your reply.
Unfortunately, I am not able to make any further changes to the already existing examples we have. The addon framework example demonstrates many things that can be done with an addon and will be the best resource to study. For more practice working with Bars Requests and getting an OnMarketData stream from an instrument, consider making a new addon that only implements the "Data Access" section of the addon framework example. Then you could implement order submission behavior based around the working code rather than fitting the addon examples code around an order submission button.
Kind regards,
-ChrisL
-
Originally posted by NinjaTrader_ChrisL View PostHello omololu, thanks for your reply.
I am having trouble locating the example SubmitOrderWithAtmAddonNoTabs that I sent you. It's possible another team member directed you to this example. Could you link me to where this was previously discussed?
It is here. As you will note, this example only shows Buy Market order as follows and in lines 117 & 118;
Order buyMar****rder = accountSelector.SelectedAccount.CreateOrder(atmStr ategySelector.Instrument, OrderAction.Buy, OrderType.Market, TimeInForce.Day, 1, 0, 0, string.Empty, "Entry", null);
NinjaTrader.NinjaScript.AtmStrategy.StartAtmStrate gy(atmStrategySelector.SelectedAtmStrategy, buyMar****rder);
I want to tweak it to allow me to implement Buy Limit, Sell Limit, and even StopLimit (Buy and Sell) orders
Please, have a look at my earlier request on this ad-don here.
OmololuLast edited by omololu; 11-23-2020, 05:35 PM.
Leave a comment:
-
Hello omololu, thanks for your reply.
I am having trouble locating the example SubmitOrderWithAtmAddonNoTabs that I sent you. It's possible another team member directed you to this example. Could you link me to where this was previously discussed?
Leave a comment:
-
Originally posted by NinjaTrader_ChrisL View PostHello omololu, thanks for your reply.
In the addon example, there are many different ways of receiving data. The "SnapShot" button (marketDataSnapshotButton) is likely the one you would want to emulate. The data from here is set in the OnMarketData method of the Instrument. See line 2039 for the start of the Instrument definition, this is where market data is subscribed to the instrument.
Please let me know if I can assist any further.
Yes, your tips and guide have been very useful. However, my attempt to copy and paste those relevant portions of the marketDataSnapshotButton and Instrument definition, threw up some compilation errors. The Add-on that I'm tweaking is the SubmitOrderWithAtmAddonNoTabs that you directed me to a few weeks ago. The SubmitOrderWithAtmAddonNoTabs has provision for Buy Market ONLY. I just want to tweak it to allow me to implement Buy Limit, Sell Limit, and even StopLimit (Buy and Sell). Could you please avail me with the example of how to use the relevant portions of the marketDataSnapshotButton and Instrument definition referred to above, to implement, at least, Buy Limit in the SubmitOrderWithAtmAddonNoTabs Add-on ?
Best Regards.
Omololu
Leave a comment:
-
Hello omololu, thanks for your reply.
In the addon example, there are many different ways of receiving data. The "SnapShot" button (marketDataSnapshotButton) is likely the one you would want to emulate. The data from here is set in the OnMarketData method of the Instrument. See line 2039 for the start of the Instrument definition, this is where market data is subscribed to the instrument.
Please let me know if I can assist any further.
Leave a comment:
-
Hi Chris,
I'm unable to pick any code/script from line 773 of the AddOn Framework NinjaScript Basic add-on that shows an example of my issue. I further studied the bottom of this link here and it seems I can only have e.BarsSeries.GetOpen(i), e.BarsSeries.GetHigh(i), e.BarsSeries.GetLow(i), e.BarsSeries.GetClose(i) and NOTHING on e.BarsSeries.GetAsk(i) or e.BarsSeries.GetBid(i). Please, remember that what I want is to do "Order buyLimitOrder = accountSelector.SelectedAccount.CreateOrder(atmStr ategySelector.Instrument, OrderAction.Buy, OrderType.Limit, TimeInForce.Gtc, 3, <GetCurrentAsk>, 0, string.Empty, "Entry", null)". Line 929 shows how to code Buy Market order; I want to do Buy Limit order. Is there no example code/script that shows exactly this ?
Regards.
Omololu
Leave a comment:
-
Originally posted by NinjaTrader_ChrisL View PostHello Omololu, thanks for your reply.
GetCurrentAsk/Bid is part of the NinjaScriptBase class, and strategies inherit from
Strategy :StrategyRenderBase : StrategyBase : NinjaScriptBase
So your indicator would need a strategies StrategyBase object to call it's GetCurrentAsk/Bid method. You can do this by implementing a method in the Addon that takes a StrategyBase object, and have the strategy call this method, passing in it's StrategyBase object.
For a stand-alone, addon-only approach to this, your addon would need to perform a Bars Request and subscribe to market data update events. There is an exact example of doing this on line 773 of the addon example provided in my last reply. Search the string:
Code:// When user presses the Realtime Data button if (button != null && ReferenceEquals(button, realtimeDataButton))
I cannot seem to see any "addon example provided ...". Please, direct me to the Addon again.
Regards.
Omololu
NB: Sorry Chris ... Is it the AddOn Framework NinjaScript Basic zip file ? If Yes, then I already have it on my PC. I've seen the line 773. I'm studying it. Thanks.Last edited by omololu; 11-19-2020, 05:02 PM.
- Likes 1
Leave a comment:
-
Hello Omololu, thanks for your reply.
GetCurrentAsk/Bid is part of the NinjaScriptBase class, and strategies inherit from
Strategy :StrategyRenderBase : StrategyBase : NinjaScriptBase
So your indicator would need a strategies StrategyBase object to call it's GetCurrentAsk/Bid method. You can do this by implementing a method in the Addon that takes a StrategyBase object, and have the strategy call this method, passing in it's StrategyBase object.
For a stand-alone, addon-only approach to this, your addon would need to perform a Bars Request and subscribe to market data update events. There is an exact example of doing this on line 773 of the addon example provided in my last reply. Search the string:
Code:// When user presses the Realtime Data button if (button != null && ReferenceEquals(button, realtimeDataButton))
Leave a comment:
-
Originally posted by NinjaTrader_ChrisL View PostHello omololu, thanks for your post. It looks like this was already asked this on a separate thread from earlier:
https://ninjatrader.com/support/foru...e2#post1128290
Our colleague Chelsea will follow up on that thread.
In an addon, it is necessary to subscribe to the market data that is needed. The addon example that we have has an example of doing this:
https://ninjatrader.com/support/help...t_overview.htm
Best regards,
-ChrisL
Please, disregard my post in the other earlier thread considering that the issue in the thread is about GetCurrentAsk()/GetCurrentBid().
I seem to be comfortable with GetCurrentAsk()/GetCurrentBid() and as used in the SampleWPFModifications Indicator example. Also, and as stated in my post #1 above, I have successfully used GetCurrentAsk() in the SampleWPFModifications Indicator example.
I'm having issue with the code for getting current Ask/Bid price in the SubmitOrderWithAtmAddonNoTabsExample Addon, and similar to GetCurrentAsk()/GetCurrentBid(). You will please note that the SubmitOrderWithAtmAddonNoTabsExample Addon showed only example of Market Buy/Sell Order entry (i. e. Order buyOrder = accountSelector.SelectedAccount.CreateOrder(atmStr ategySelector.Instrument, OrderAction.Buy, OrderType.Market, TimeInForce.Gtc, 3, 0, 0, string.Empty, "Entry", null); I want the code for a Limit Buy/Sell (and even StopLimit) Order entry.
Regards.
OmololuLast edited by omololu; 11-19-2020, 02:37 PM.
Leave a comment:
-
Hello omololu, thanks for your post. It looks like this was already asked this on a separate thread from earlier:
https://ninjatrader.com/support/foru...e2#post1128290
Our colleague Chelsea will follow up on that thread.
In an addon, it is necessary to subscribe to the market data that is needed. The addon example that we have has an example of doing this:
https://ninjatrader.com/support/help...t_overview.htm
Best regards,
-ChrisL
Leave a comment:
-
Getting Current Ask in an Addon
I'm unable to resolve a compilation error on the SubmitBuyLimitOrderWithAtmAddonNoTabsExample Addon and as follows;
Order buyLimitOrder = accountSelector.SelectedAccount.CreateOrder(atmStr ategySelector.Instrument, OrderAction.Buy, OrderType.Limit, TimeInForce.Gtc, 3, <GetCurrentAsk>, 0, string.Empty, "Entry", null);
What should <GetCurrentAsk> be ?
I successfully used GetCurrentAsk() in the SampleWPFModifications Indicator example and as follows;
entryOrder = myAccount.CreateOrder(myInstrument, OrderAction.Sell, OrderType.Limit, OrderEntry.Manual, TimeInForce.Gtc, 3, GetCurrentAsk() + 15 * TickSize, 0, "", "Entry", Core.Globals.MaxDate, null);
However, the GetCurrentAsk() does not work on the SubmitBuyLimitOrderWithAtmAddonNoTabsExample Addon ... the error messages are; "The name 'GetCurrentAsk' does not exist in the current context' and "The name 'TickSize' does not exist in the current context".
Please, I shall appreciate any tips and guides.
OmololuTags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Tim-c, Today, 03:54 AM
|
0 responses
1 view
0 likes
|
Last Post
by Tim-c
Today, 03:54 AM
|
||
Started by FrancisMorro, Today, 03:24 AM
|
0 responses
2 views
0 likes
|
Last Post
by FrancisMorro
Today, 03:24 AM
|
||
Net Change
by Segwin
Started by Segwin, 05-07-2018, 02:15 PM
|
10 responses
1,770 views
0 likes
|
Last Post
by Leafcutter
Today, 03:01 AM
|
||
Change colour of Stop market and limit orders to red and green via indicator script
by Rapine Heihei
Started by Rapine Heihei, 04-23-2024, 07:51 PM
|
2 responses
31 views
0 likes
|
Last Post
by Max238
Today, 02:25 AM
|
||
Started by Shansen, 08-30-2019, 10:18 PM
|
24 responses
945 views
0 likes
|
Last Post
by spwizard
Today, 01:29 AM
|
Leave a comment: