Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

GetCurrentBid(); not working?

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

  • NinjaTrader_RyanM1
    replied
    Thanks for the script. This is the issue:

    dCurrentPrice = GetCurrentBid();
    dPrevPrice = GetCurrentBid();

    if( dCurrentPrice == dPrevPrice )
    return;


    You're setting two variables equal to the same value, and stopping code processing with return;

    Leave a comment:


  • TiggerTrader
    replied
    OK, here it is. The idea is to show where a sopt might be on the upside and downside as you watch the movement.
    Attached Files

    Leave a comment:


  • NinjaTrader_RyanM1
    replied
    I'm not sure why it's not working for you. There's nothing additional to set. Make sure you've compiled all code changes by Right Clicking in editor > Compile. Make sure your script is running the latest version of these code changes by Right Clicking on Chart > Reload NinjaScript.

    If it's still not working the way you expect, can you post the complete script here and will take a look?

    Leave a comment:


  • TiggerTrader
    replied
    PFGBest. And the chart is an 89 tick YM 09-11 which is fluidly showing the price movement.

    Leave a comment:


  • NinjaTrader_RyanM1
    replied
    What connection are you using for real time data? What is the instrument and interval you're viewing? Is there movement on the chart?

    Most June futures contracts recently stopped trading, so make sure you're not using those. If you want to verify real time functionality with your script, you can always use the simulated data feed.

    Leave a comment:


  • TiggerTrader
    replied
    Interesting... this is now NOT printing my price at all. So why is this live indicator in a live chart show only Historical data?

    Why is the code NOT real time? Is there some global value I need to set to tell it to show real time?

    Leave a comment:


  • NinjaTrader_RyanM1
    replied
    Hi TiggerTrader,

    Yes, if accessed in real time with CalculateOnBarClose = false then you'll receive updates with every incoming tick of data. These values are only designed to be used in real time, so when accessed historically it will use Close price instead.

    If you want, you can add a filter that only prints these values in real time. It may make the output window easier to follow.

    if (!Historical)
    {
    Print( dCurrentPrice );
    Print( GetCurrentAsk() );
    }

    Leave a comment:


  • TiggerTrader
    started a topic GetCurrentBid(); not working?

    GetCurrentBid(); not working?

    I've written an indicator to draw some lines based on the current price and I must be missing something obvious. Here's a code snippet:

    dCurrentPrice = GetCurrentBid();

    Print( dCurrentPrice );
    Print( GetCurrentAsk() );

    The output window shows :
    11826
    11826


    Every single time regardless of the price on my chart. For example, as I wruite the price is 12106 on YM. Also, only prints those two lines even tho I have CalcOnBarClose=false so it should be looping the pice as it changes, right? Any ideas?

Latest Posts

Collapse

Topics Statistics Last Post
Started by SalmaTrader, 07-07-2026, 10:26 PM
0 responses
35 views
0 likes
Last Post SalmaTrader  
Started by CarlTrading, 07-05-2026, 01:16 PM
0 responses
20 views
0 likes
Last Post CarlTrading  
Started by CaptainJack, 06-17-2026, 10:32 AM
0 responses
12 views
0 likes
Last Post CaptainJack  
Started by kinfxhk, 06-17-2026, 04:15 AM
0 responses
18 views
0 likes
Last Post kinfxhk
by kinfxhk
 
Started by kinfxhk, 06-17-2026, 04:06 AM
0 responses
20 views
0 likes
Last Post kinfxhk
by kinfxhk
 
Working...
X