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

Post position size on charts

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

    Post position size on charts

    Hi

    Before I go delving into the way to do this, I want to know if this is possible. Sometimes on lower time frames it can be quite frantic to calculate the trade position size to adhere to your money management rules. So I want to be able to calculate the pip size of a price bar, and from that, along with the current exchange rates, calculate my position size. Then print the figure out on the chart whenever the strategy throws up its signal?

    #2
    Yes you can do that. To print values onto the chart you could use DrawText() or DrawTextFixed().
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Josh View Post
      Yes you can do that. To print values onto the chart you could use DrawText() or DrawTextFixed().
      Thanks Josh

      So now I need to make a calculation based on the high, low and close value of the last bar, and then pass the result into the Drawtext function. How would I go about this?

      Comment


        #4
        For example this snippet draws the High / Low range of the last completed bar in the upper right corner of the chart -

        Code:
         
        protected override void OnBarUpdate()
        {
        double myRange = High[0] - Low[0];
         
        DrawTextFixed("myRangeText", myRange.ToString(), TextPosition.TopRight);
        }
        For our indicator coding tutorials to get you started, please check this link - http://www.ninjatrader-support.com/H...verview18.html
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Thanks Bertrand

          I've now set my three variables (myEntry, myStop, myPos). Is it possible to include all three of these in the string with a carriage break between them, so I have a list consisting of entry price, stop loss, position size printed on the chart?

          Comment


            #6
            pmn100,

            You will have to search google for the carriage return character for C# strings. I believe it may be \r but am not certain.

            So you would just do something like myRange.ToString() + "\r" + myStop... etc
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Thanks Josh. \n is working.

              All working now.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by thumper57, Yesterday, 04:30 PM
              2 responses
              10 views
              0 likes
              Last Post thumper57  
              Started by rayyyu12, Yesterday, 05:38 PM
              1 response
              17 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Started by dcriador, Yesterday, 12:06 PM
              1 response
              17 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Started by dcriador, Yesterday, 12:04 PM
              1 response
              18 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Started by cutzpr, Yesterday, 08:54 AM
              1 response
              16 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Working...
              X