Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trade info on chart not working with US stocks but fine on FOREX

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

    Trade info on chart not working with US stocks but fine on FOREX

    Hello,
    This code below works great on I my chart is referencing Forex data. But as soon as I switch to a stock (UPRO), the output always reads "0". What am I missing? (My brokers/feeds are FOREX.com and Interactive Brokers).

    Draw.TextFixed(this, "Position.GetUnrealizedProfitLoss", "Current Gains_"+ Convert.ToString(Position.GetUnrealizedProfitLoss( PerformanceUnit.Currency)), TextPosition.TopLeft);

    #2
    Ya know, I almost always figure it out AFTER I ask you guys. Ha. This works (change in bold):

    Draw.TextFixed(this, "Position.GetUnrealizedProfitLoss", "Open Profit_"+ Convert.ToString(Position.GetUnrealizedProfitLoss( PerformanceUnit.Currency, Close.GetValueAt(CurrentBar))), TextPosition.TopLeft);

    Comment


      #3
      Hello White Fork,

      I would still expect the last price being substituted to work.

      From the help guide:
      "If no double argument is provided in the call, the current (real-time) Last price will be substituted in."
      https://ninjatrader.com/support/help...profitloss.htm

      To confirm Position.GetUnrealizedProfitLoss( PerformanceUnit.Currency) is always producing a 0, even when there is profit or loss in an open position?
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        "0", that is correct. On all Stocks and some Currencies depending on the decimal place. (Maybe it's an "int" thing?)

        Comment


          #5
          Hello White Fork,

          I am not able to reproduce this behavior.

          If you follow the exact steps shown in the video are you experiencing different behavior?
          https://drive.google.com/file/d/1BmN...w?usp=drivesdk
          Attached Files
          Chelsea B.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Realsmooth3, Yesterday, 09:10 PM
          1 response
          11 views
          0 likes
          Last Post NinjaTrader_Marco  
          Started by wooofad, 06-15-2020, 01:08 PM
          8 responses
          93 views
          0 likes
          Last Post echoxray  
          Started by bubblegum, Today, 12:00 AM
          0 responses
          2 views
          0 likes
          Last Post bubblegum  
          Started by eseorvuda, Yesterday, 10:28 PM
          0 responses
          2 views
          0 likes
          Last Post eseorvuda  
          Started by ctrent, Yesterday, 09:58 PM
          0 responses
          5 views
          0 likes
          Last Post ctrent
          by ctrent
           
          Working...
          X