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

Draw Montly MA Value On 5 Minute Chart

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

    Draw Montly MA Value On 5 Minute Chart

    Hi,

    Want to draw a line on 5 Minute chart which is 200 period monthly SMA current value. For do that calculation we can not add secondary data series via Add(PeriodType.Month, 1). Because period is too high and no broker supports this much historical data. So if there is a global variable support on ninjatrader. I can open monthly chart for 200 bars, add my custom indicator on it which is calculating current SMA(200) value and store to global variable. Then open another chart which is 5 Minute period and add my other custom indicator on it which is reading global variable and draw a line on a chart.

    Shortly is there a support for gloval variables in NinjaTrader? Or are you have any suggestion that solve my problem.

    Thanks,
    Aytac

    #2
    Hello aytacasan,

    Thanks for your post.

    In NinjaTrader 8 you could make static variables in an AddOn to create global variables. For your case with NinjaTrader 7, you could consider using a StreamWriter to write a value to file, and then you can have your scripts read this file with a StreamReader to get the value and draw it with Draw.HorizontalLine or a similar draw method.

    SampleStreamReader - https://ninjatrader.com/support/help...o_read_fro.htm

    SampleStreamWriter - https://ninjatrader.com/support/help...o_write_to.htm

    Drawing - https://ninjatrader.com/support/help...t7/drawing.htm

    We look forward to assisting.
    JimNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Jim View Post
      Hello aytacasan,

      Thanks for your post.

      In NinjaTrader 8 you could make static variables in an AddOn to create global variables. For your case with NinjaTrader 7, you could consider using a StreamWriter to write a value to file, and then you can have your scripts read this file with a StreamReader to get the value and draw it with Draw.HorizontalLine or a similar draw method.

      SampleStreamReader - https://ninjatrader.com/support/help...o_read_fro.htm

      SampleStreamWriter - https://ninjatrader.com/support/help...o_write_to.htm

      Drawing - https://ninjatrader.com/support/help...t7/drawing.htm

      We look forward to assisting.

      Hello NinjaTrader_Jim

      What I will write is totally off-topic and sorry to write here but I couldn't find a direct way to send you a message or even to comment about the next 2 posts, and simply I went to the last post you wrote.

      Ok, I see you posted the next 2 indicators:

      This one called "Position Display Indicator"
      This indicator provides a customizable text box which displays a position’s UnRealized PnL, Realized PnL of a selected account, and the overall cash value of the account.


      and this other called "Spread"
      Plots the Spread of two instruments The first instrument is the primary chart data series. The secondary instrument is specified by the parameter "Symbol2". The Parameters "Qty1" and "Qty2" are multipliers which are applied to each instrument's price before adding the two; default values are "Qty1=1" and "Qty2=‐1" which will simply plot the difference between […]



      About the "Position Display Indicator" I’m needing something very similar but with some modifications. I will leave the link about a post I created today about the modifications I need:
      Hello I would like to know if is there a quick way to see the Maximum Unrealized Account Balance and also the Minimum Unrealized Account Balance during a multiple-positions trade. I mean a trade with multiple long and short positions all them as a whole, as 1 single trade, so it can be considered as a portfolio trade. I don't


      And I also created this other post that is more complete about what I exactly need:
      I've been thinking about an indicator or dashboard window for NinjaTrader 8 to simulate the basic environment of a Trader Funding Evaluation. First, specifying the Account Initial Buying Power (BP). Let's take as example an Initial BP = $30,000 to do some illustrative calculations below, and from here, then the indicator will


      Could you please give them a check to see if you could help me with that.

      Finally, about the indicator called "Spread", what I need is basically the base of that indicator but with some additions to specify some extra parameters into a Spread of 2 instruments. If you have the way to maybe send me an email or any more direct communication way, please let me know to see if could help me starting from the base is already created.

      Thank you very much, and again sorry for write this off-topic message here. Once you could contact me, please delete this message.

      Comment


        #4
        Hello futurenow,

        I'm flattered by the personal request for assistance, but please continue working with my colleagues in the threads you have opened. They can share their insight on what would need to be considered to add functionality to an existing script or to create a new script.

        Also to note, if a task is too difficult, you can always consider enlisting the services of a NinjaScript Consultant to have something written for you.

        We look forward to assisting.
        JimNinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Jim View Post
          Hello futurenow,

          I'm flattered by the personal request for assistance, but please continue working with my colleagues in the threads you have opened. They can share their insight on what would need to be considered to add functionality to an existing script or to create a new script.

          Also to note, if a task is too difficult, you can always consider enlisting the services of a NinjaScript Consultant to have something written for you.

          We look forward to assisting.

          Thank you

          Couldn't be possible you respond in those threads with your ideas based in the indicator "Position Display Indicator" (https://ninjatraderecosystem.com/use...y-indicator/)? For example giving a guide about what calculations I need to do into the example indicator your colleagues posted, to obtain the values I need:

          - the Account Maximum Unrealized Balance
          - the Account Minimum Unrealized Balance
          - the Account Balance when a trade is closed

          To be able to show those values in text box just like the "Position Display Indicator" indicator. only remember what I need is not based in 1 single symbol trades, it is based in Account Balance, i.e. in mutiple symbols trade (longs and shorts at the same time).

          You could help giving a guide, with samples of code examples etc. because maybe what could take for you 5-10 minutes to do a simple indicator like this, could also be difficult for someone new building an indicator.

          I will thank you a lot

          Comment


            #6
            Hello futurenow,

            The support experience would be the same working with any Scripting Support technician. Please continue correspondence in your open threads if you have further questions on those topics.

            If you have questions pertaining to an already built script that is relevant to the active thread, please feel free to ask there and the Scripting Support technician will be able to help. We also communicate with eachother on tickets so our knowledge would be pooled collectively, and it would not be necessary to ask the same questions in separate posts/threads.

            Chris has replied in your other thread with further details on how to subscribe to account level Execution events and how to pull AccountItems of the account so you can track account Cash Value, UnrealizedProfitLoss and other items as you see executions made.

            The Position Display Indicator does not do anything special to calculate a new value. It simply gets the account CashValue and RealizedProfitLoss account items, and also checks the Unrealized PnL of the Instrument's position to display on the chart.

            We look forward to assisting.
            JimNinjaTrader Customer Service

            Comment


              #7
              Hello Jim,

              Thanks for your support.

              Regards,
              Aytac

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by mjairg, 07-20-2023, 11:57 PM
              3 responses
              213 views
              1 like
              Last Post PaulMohn  
              Started by TheWhiteDragon, 01-21-2019, 12:44 PM
              4 responses
              544 views
              0 likes
              Last Post PaulMohn  
              Started by GLFX005, Today, 03:23 AM
              0 responses
              3 views
              0 likes
              Last Post GLFX005
              by GLFX005
               
              Started by XXtrader, Yesterday, 11:30 PM
              2 responses
              12 views
              0 likes
              Last Post XXtrader  
              Started by Waxavi, Today, 02:10 AM
              0 responses
              7 views
              0 likes
              Last Post Waxavi
              by Waxavi
               
              Working...
              X