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

Indicator draw on price panel

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

    Indicator draw on price panel

    Hello,

    from the stream reader sample I have made me an indicator that reads from a txt file and plots horizontal lines in NT8.

    When adding the indicator there is always in the parameters "new panel". But I have in setdefaults
    DrawOnPricePanel = true;
    IsOverlay = true;
    IsSuspendedWhileInactive = true;

    So why doesnt it show per default "same as input series".

    If there comes up now the question why this is a problem as I have to do this only once I have to add the information that I need to remove that indicator because the txt file is written from NT7 and I could do reading from the txt file in NT8. But it seems the writing to the txt file does not work when the indicator is attached in a chart in NT8 (even when not connected with NT8 because that time I´m connected for few minutes with NT7 to calculate the doubles). And because I can not transcribe the indicator from NT7 to NT8 I had to make this workaround.

    So what do I have to modify please so that in NT8 its plotting by default in price panel?

    Thank you!
    Tony

    #2
    Hello Tony,

    Thank you for your reply.

    IsOverlay = true should cause the indicator to plot in the price panel:



    Have you removed and readded the indicator to the chart since setting IsOverlay to true? It would need to be removed and readded if this was changed before it would show properly.

    Is there a particular reason you're not just converting the NinjaTrader 7 indicator to NinjaTrader 8? Does it draw the lines in NinjaTrader 7?

    Thanks in advance; I look forward to assisting you further.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Hello,

      I have in setdefaults as I posted above. I dont know why it doesnt show by default "same as imput series".

      Yes, of course I do remove the indicator and add it again. I described that I have to do this in any case because it would not write in NT7 when this inidicator is attached in NT8 (I have not closed NT8 when connecting with NT7 for few minutes, just disconnect NT8, connect NT7 to write the doubles to txt file, then disconnect in NT7 and connect in NT8 again).

      Yes, there is a particular reason, I wrote that I can not transcribe the indicator from NT7 to NT8.

      Is there a possibility to write in NT7 while NT8 is disconnected? Then I would not need to remove and add the indicator.

      I attach this small code because its bothering that its not plotting on price panel when all is in statedefaults.

      Thank you!
      Tony
      Attached Files
      Last edited by tonynt; 04-09-2020, 09:45 AM. Reason: add question

      Comment


        #4
        Hello TonyNT,

        Thank you for your reply.

        No, you can't read and write from the same file simultaneously - you wouldn't be able to run both indicators at the same time if they'd constantly both be trying to read or write to the same file.

        Additionally, the indicator you provided does default to Same as input series in my testing:

        Click image for larger version

Name:	2020-04-09_1312.png
Views:	828
Size:	100.7 KB
ID:	1093822

        When you say you "can not transcribe the indicator from NT7 to NT8", do you mean you don't know how to do so? I would be happy to provide you with some guidance on how to convert indicators to NT8. Or is it a third party indicator and you cannot access the code?

        Thanks in advance; I look forward to assisting you further.
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Hello Kate,

          thank you for your reply.

          a.) concerning read and write to same file simultaneously is interesting that it doesnt work in this case because I am not connected same time to datafeed with NT7 and NT8. I can only connect one time. So it shouldnt be reading in NT8 where I am disconnected during NT7 is writing(?)

          b.) thank you for your offer helping with converting. I have the source code of that indicator in NT7, the programmer who has done it has passed away last year. Even when I have access to the code I do not know how to modify it for NT8, I get messages when compiling I do not understand. Therefore I thought to do the workaround with let run the indicator in NT7 for 2 minutes to calculate the values and write it to a file. Then I re-connect with NT8 and read from the file which I could do from the sample stream-reader.

          I´d like to post the error-messages when compiling if you allow me to do so. (you know in my experience in 10 years in the forum it occurred then suddenly comes in between a collegue and replies me that you do not provide coding services - which I understand and I do not want to make a code from beginning to the end for me, its about the error-messages from transcribing. Can I post the error-messages and will you come back to this thread even when someone else will advice me in between about no-coding-services?)

          Thank you!
          Tony
          Last edited by tonynt; 04-12-2020, 09:04 AM. Reason: translation error

          Comment


            #6
            Hello TonyNT,

            Thank you for your reply.

            If the indicator is still applied to the chart in one, it's likely it still is accessing the file from before you disconnected if you're unable to get it to write in one and read in the other without removing the indicator. It's not necessarily just the data coming in that affects whether NT is accessing the file.

            Yes, while I wouldn't be able to do the entire conversion for you as you know, if you'd like I can certainly assist with specific compile errors you run into when trying to convert the NT7 indicator to NT8. Here's also a link to our Code Breaking Changes section of our help guide that may be of use when trying to convert - you can look up the item that is erroring for you in there and it will tell you if that's something that's changed and if so, what it's changed to:



            Thanks in advance; I look forward to assisting you further.
            Kate W.NinjaTrader Customer Service

            Comment


              #7
              Hello Kate,

              thank you for your reply. I have errors when compiling the NT7 indicator in NT8 that I could resolve from your link here and in another thread. But I also have messages I do not understand (I translate to english as it shows in German here):
              * type or namespacename Drawing2D is not included in namespace system.drawing
              * type or namespacename indicatorbase could not be found (missing a using directive or assembly...)
              * type or namespacename columnbase
              * type or namespacename strategybase
              * NinjaTrader.Indicator is a namespace, but used as a type
              * type or namespacename IDataSeries is not included in namspace NinjaTrader.Data

              Other messages referring the code and colors and properties I could resolve.

              Thank you!
              Tony

              Comment


                #8
                Hello tonynt,

                Thank you for your reply.

                The errors you've listed there mostly suggest you may have just copied the entire indicator into a blank template complete with the #region NinjaScript generated code usually found at the bottom. Here's what I would advise:

                Start with a new indicator in NinjaTrader 8 by going to the indicators folder in the NinjaScript Explorer pane within the NinjaScript Editor window. Right click on it and select "New Indicator", then click Next to start the process. On the following page, give it a name and continue to the next page. Expand the More Properties section and check or uncheck any boxes to correspond to the settings in the NT7 script that would be located in Initialize() .

                Go on to the next page. If the original indicator added any additional series, set that up on this page. If not, click next again. On the following page, if the original indicator used OnConnectionStatus(), OnFundamentalData, OnMarketData, or OnMarketDepth, check the appropriate box. Click Next.

                On the Input Parameters screen, set up any user inputs the original strategy had, then click Next. On the Plots and Lines page, if the strategy used Add(new Plot....) , you'll want to set those up on this page, then click Next. Click Generate on this page to see a basic outline for your indicator.

                What I'd then suggest is copying pieces of the original indicator into the appropriate sections of our new skeleton of an indicator. Anything that was in OnBarUpdate in the original, put in the same spot in the new one. Items that were in Initialize() will generally need to go in one of the sections of OnStateChange. I'd refer to the Code Breaking Changes section of the help guide that I linked in my previous reply

                Drawing2D isn't used in NinjaTrader 8 - rendering in NT8 has changed considerably from NinjaTrader 7. Depending on the complexity, it may be possible to do the actual drawing within OnBarUpdate using Drawing Tools, but generally rendering of items that are not plots or drawing tools would be done using SharpDX in OnRender(). Here's a link to our help guide that goes over using SharpDX to render objects to the chart:



                ​​​​​​​Please let us know if we may be of further assistance to you.



                Kate W.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by kevinenergy, 02-17-2023, 12:42 PM
                118 responses
                2,778 views
                1 like
                Last Post kevinenergy  
                Started by briansaul, Today, 05:31 AM
                0 responses
                9 views
                0 likes
                Last Post briansaul  
                Started by traderqz, Yesterday, 12:06 AM
                11 responses
                28 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Started by PaulMohn, Today, 03:49 AM
                0 responses
                9 views
                0 likes
                Last Post PaulMohn  
                Started by inanazsocial, Today, 01:15 AM
                1 response
                12 views
                0 likes
                Last Post NinjaTrader_Jason  
                Working...
                X