Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NinjaScript & account - beginner

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

    NinjaScript & account - beginner

    Hi everybody,
    i am new in NinjaScript (i am java programmer) and I can not find following information...
    I want to let to decide my strategy about ordering (EnterLong, EnterShort) on the basis of account.. for example: My strategy just bought something and now want to sell..but before it will be sold the strategy check account in the case of sell and if it is not positive it will be not sold...
    I hope you will understand my english

    But I dont know how to get current graph status of my account or something similar
    Thanks very much

    #2
    zooinek,

    What value are you looking for exactly? You cannot access account size.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Any value wich can me tell wheter i will win this specific trade what i want to do right now or i will loose money with this trade, so it is better not to do that..

      I have graph of my account in backtest and the graph is going up and going down,..and I want upgreat my strategy that the strategy is looking on the graph and buying and selling and when the graph is going down, the strategy is buing and selling only on paper but not really. Then when the graph is going up again, the strategy start real buing and selling.

      Comment


        #4
        zooinek,

        Please be more specific as to what kind of value you are looking for. For instance, you can get unrealized PnL of your trade through this: http://www.ninjatrader-support.com/H...rofitLoss.html

        You can get performance results of your completed trades through this: http://www.ninjatrader-support.com/H...anceClass.html
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          so you can get me an example code of this situation:...
          You have status of your account (graph (up and down) how much you are winning and how much you are loosing) and when your stratedy makes trades and your account value is going up over Account.SMA(50)[0] so then your strategy will really buying and selling, but when your strategy is loosing (so your account status is falling down under SMA(50)) then your strategy is trading only "to output" and not real buying and not real selling...
          hope you'll understand what I mean...

          Comment


            #6
            zooinek,

            Sorry I really don't understand what you are trying to do. How can you compare account size to SMA? Your account size would not correlate to the SMA at all.

            For instance, say your account is $25000. The stock you trade is at price $25. Any SMA of the stock will be ~$25. Your account will always be greater than the SMA.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              So your account size is $25000 now... one hour ago it was $23000,... two hour ago it was $20000... so than you can create graph of your account. X-axis is time and Y-axis is money (size of your account at specific time).
              Now you can create line. This line represent EMA of your accout size (I will call that just myEMA).
              Your account graph is falling up and falling down (that depends on wining/loosing trades).
              What I want to do:
              I want to get access to the current account size. Then I can (in OnBarUpdate() method) calculate current value of myEMA.
              And if is my current accout size over this current myEMA value I will just go on with strategy logic and real buying and selling (Depending on how my strategy logic tells). BUT! if is my current account size UNDER this current myEMA value I will not real buying and selling. I will just simulate that.I will calculate and record what would my account size looks like if I was normally buying and selling. And then, when my account size would be over the myEMA again I will just normally start buying and selling like before.

              Comment


                #8
                zooinek,

                Use AccountSize. This is not your actual brokerage account since you do not have access to that information though. This is your virtual account size as determined when you start out. You can set it to a certain value and it will go up and down as you trade. http://www.ninjatrader-support.com/H...countSize.html
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Hi,
                  I forgot to write.. it works and it makes what i was looking for so thank you very much..
                  if you would to help me again i have another problem.. heres the link..

                  thanx

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by wzgy0920, 04-20-2024, 06:09 PM
                  2 responses
                  27 views
                  0 likes
                  Last Post wzgy0920  
                  Started by wzgy0920, 02-22-2024, 01:11 AM
                  5 responses
                  32 views
                  0 likes
                  Last Post wzgy0920  
                  Started by wzgy0920, 04-23-2024, 09:53 PM
                  2 responses
                  49 views
                  0 likes
                  Last Post wzgy0920  
                  Started by Kensonprib, 04-28-2021, 10:11 AM
                  5 responses
                  193 views
                  0 likes
                  Last Post Hasadafa  
                  Started by GussJ, 03-04-2020, 03:11 PM
                  11 responses
                  3,235 views
                  0 likes
                  Last Post xiinteractive  
                  Working...
                  X