Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Feature Request: Spot Price

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

    Feature Request: Spot Price

    As a currency trader, I calculate position sizes and stop losses for many currency pairs that require the price of a USD pair to calculate the correct rates. For example, to calculate for AUDNZD, one needs the current NZDUSD ask and/or bid price.

    Currently, it appears the only supported way to obtain the rates for all USD pairs that might be required is to Add DataSeries for those pairs. This could be a significant overhead. Ideally, what one would like is something like CurrentAsk or CurrentBid that works on any currency pair available from the connection. For example, CurrentAsk("$NZDUSD").

    The data are available on a spot price basis, since this is what OnExecutionUpdate provides through the Rate it returns in the event arguments (ExecutionUpdateEventArgs).

    Can these data be made generally available for any instrument as a parameter to CurrentAsk or CurrentBid, please? Thanks!
    Multi-Dimensional Managed Trading
    jeronymite
    NinjaTrader Ecosystem Vendor - Mizpah Software

    #2
    The problem is you need to be able to subscribe to that instrument at some point. AddDataSeries() does this for you in the Instruments array. If we provided a GetCurrentBid(instrumentName), there would be a ton of overhead in subscribing to this instrument depending on how frequently you attempted get that value. You could - of course - just subscribe once when the indicator is configured, but then you're doing just as much, if not more work as AddDataSeries().

    Currently, you could use Instrument.GetInstrument("NZDUSD ").MarketData.Bid.Price, but again - it needs to be subscribed somehow. Opening a market analyzer, time and sales, or another chart, etc would handle that for you, but there is no way to programmatically subscribe to that instrument, without using AddDataSeries()

    GetCurrentBid(int barsSeriesIndex) is the safest and best way to achieve this. I don't foresee this changing.

    If the overhead you're concerned with is memory, are you aware there is a barsToLoad overload to reduce the number of bars requested?


    Code:
    protected override void OnStateChange()
    {
    	if (State == State.Configure)
    	{
                    // request NZDUSD only 1 bar back
    		AddDataSeries("NZDUSD", new BarsPeriod(), 1, "Forex", false);
    	}
    }
    
    
    protected override void OnBarUpdate()
    {
    	Print(BarsArray[1].Count); // only 1 bar requested
    	Print(GetCurrentBid(1)); // gets NZDUSD's bid
    }
    Last edited by NinjaTrader_Matthew; 07-14-2015, 03:29 PM.
    MatthewNinjaTrader Product Management

    Comment


      #3
      Feature Request: Spot Price

      Thanks, Matthew.

      In NT7, one can Add only a few DataSeries, none of which is a USD currency pair, and when one trades on any of them, the OnExecutionUpdate method finds the needed USD Rate. I simply want to make that capability callable, since it appears the ability to get spot rates is already built-in.

      Thanks.
      Multi-Dimensional Managed Trading
      jeronymite
      NinjaTrader Ecosystem Vendor - Mizpah Software

      Comment


        #4
        Thanks for the clarification. I've added your suggestion and feedback to SFT-512
        MatthewNinjaTrader Product Management

        Comment


          #5
          Feature Request: Spot Price

          Just seeking an update on this. Thanks.
          Multi-Dimensional Managed Trading
          jeronymite
          NinjaTrader Ecosystem Vendor - Mizpah Software

          Comment


            #6
            We have plans to document more core methods which this method would fall under, but I cannot say when that might be as our primary goal is fixing bugs to get a stable production release sooner than later.
            MatthewNinjaTrader Product Management

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Brevo, Today, 01:45 AM
            0 responses
            2 views
            0 likes
            Last Post Brevo
            by Brevo
             
            Started by aussugardefender, Today, 01:07 AM
            0 responses
            3 views
            0 likes
            Last Post aussugardefender  
            Started by pvincent, 06-23-2022, 12:53 PM
            14 responses
            238 views
            0 likes
            Last Post Nyman
            by Nyman
             
            Started by TraderG23, 12-08-2023, 07:56 AM
            9 responses
            384 views
            1 like
            Last Post Gavini
            by Gavini
             
            Started by oviejo, Today, 12:28 AM
            0 responses
            5 views
            0 likes
            Last Post oviejo
            by oviejo
             
            Working...
            X