Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Getting Current Ask in an Addon

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • NinjaTrader_ChrisL
    replied
    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

    Leave a comment:


  • omololu
    replied
    Originally posted by NinjaTrader_ChrisL View Post
    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?
    Thanks Chris,

    It is here. As you will note, this example only shows Buy Market order as follows and in lines 117 & 118;

    Order buyMarketOrder = 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, buyMarketOrder);

    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.

    Omololu
    Last edited by omololu; 11-23-2020, 04:35 PM.

    Leave a comment:


  • NinjaTrader_ChrisL
    replied
    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:


  • omololu
    replied
    Originally posted by NinjaTrader_ChrisL View Post
    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.
    Thanks Chris,

    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:


  • NinjaTrader_ChrisL
    replied
    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:


  • omololu
    replied
    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:


  • omololu
    replied
    Originally posted by NinjaTrader_ChrisL View Post
    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))
    Please let me know if I can assist any further.
    Thanks Chris for your reply.

    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, 04:02 PM.

    Leave a comment:


  • NinjaTrader_ChrisL
    replied
    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))
    Please let me know if I can assist any further.

    Leave a comment:


  • omololu
    replied
    Originally posted by NinjaTrader_ChrisL View Post
    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
    Hello Chris,

    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.

    Omololu
    Last edited by omololu; 11-19-2020, 01:37 PM.

    Leave a comment:


  • NinjaTrader_ChrisL
    replied
    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:


  • omololu
    started a topic Getting Current Ask in an Addon

    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.


    Omololu

Latest Posts

Collapse

Topics Statistics Last Post
Started by [email protected], Yesterday, 04:49 PM
1 response
14 views
0 likes
Last Post NinjaTrader_ChrisSch  
Started by Oracletrades, Yesterday, 09:10 PM
0 responses
3 views
0 likes
Last Post Oracletrades  
Started by SteveAU, Yesterday, 08:35 PM
0 responses
8 views
0 likes
Last Post SteveAU
by SteveAU
 
Started by Lloyd143, Yesterday, 05:24 PM
1 response
21 views
0 likes
Last Post NinjaTrader_ShawnB  
Started by Hagar, Yesterday, 04:38 PM
1 response
16 views
0 likes
Last Post NinjaTrader_ShawnB  
Working...
X