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!
See more
See less

Partner 728x90

Collapse

Bid Ask and Last prices

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

    Bid Ask and Last prices

    I am trying to code a strategy that goes long or short at the open of a bar depending on whether the open price of the bar is above or below an SMA line.

    The problem I have is when the SMA line is close to the open price of the bar.

    In one example the Bid price was 1259.4, the Ask price was 1259.7, the Last Price was 1259.7 and the SMA line at the open was at 1259.5.

    When looking a at the bar chart, the bar open was at 1259.7. Does the bar Open price refer to the Last Price or the Ask price?

    Also, my code looks at the open price and compares it the SMA line. It seems like the open price is referring to the Bid price because the strategy as I have it now went short at the open of the bar at the 1259.4 price.

    It is confusing since the bar open is printed above the SMA line at 1259.7 yet the strategy went short as if the bar opened below the SMA line.

    How can I code it so that the strategy refers to the correct open price of the bar as it is printed on the screen when deciding to go long or short? Should I be comparing the Last price at the open instead of the Bid price?

    #2
    Hello,

    Looking at the last price may do the trick here. I recommend testing that to see if the fills are more accurate. Also, if you reference Close[0] on the current bar, that will refer to the last price. The candles should be painting based on the Bid price, unless you have something different set in the Data Series window.

    Please let me know if I can assist further.
    Dave I.NinjaTrader Product Management

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by rhyminkevin, Today, 04:58 PM
    4 responses
    52 views
    0 likes
    Last Post dp8282
    by dp8282
     
    Started by iceman2018, Today, 05:07 PM
    0 responses
    5 views
    0 likes
    Last Post iceman2018  
    Started by lightsun47, Today, 03:51 PM
    0 responses
    7 views
    0 likes
    Last Post lightsun47  
    Started by 00nevest, Today, 02:27 PM
    1 response
    14 views
    0 likes
    Last Post 00nevest  
    Started by futtrader, 04-21-2024, 01:50 AM
    4 responses
    50 views
    0 likes
    Last Post futtrader  
    Working...
    X