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

multiple entries using current bar data

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

    multiple entries using current bar data

    I just started to learn Ninja using simulated data feed. I wrote some ATI strategies using point and click Strategy Wizard with Condition Builder. All of them operate fine until:

    Example: strategy condition is to buy when, lets say, "ask is below lower Bollinger Band by 2 ticks" and keep adding to the position every time if/when the condition is met in the future preferably at lower price than the last buy. Never mind the exit part, I got that figured out and it works fine.

    I changed 1 to 10 in "order handling" "entries per direction" expecting the strategy will do up to 10 buys. It works fine when I have "calculate on bar close" checked in the Strategy Wizard. But since the fill occurs on the next bar it may be at much higher price, of course, than "below lower BBand".

    So, to improve fill price, I click "calculate on bar close" OFF, and use "current bar data". Now the fills are "below lower BBand", BUT since "current bar data" uses every incoming tick within the bar, when strategy conditions are met for the 1st time, it does "10 buys" all at the same time and at the same price and within the same bar, and that`s that. That`s not what I had in mind.
    I can`t figure out how to tell the strategy to do just "1 buy at a time", saving the other 9 (or whatever number consequently may be left in the future ) for later. I tried everything I can think of, no luck.
    I read the help, didn`t find anything on "multiple entries using current bar data".
    I don`t know anything about code or script or programming. Do I have to?

    thank you

    #2
    lesbud, there is probably some way to "fool" the strategy wizard into doing this, but that could be just as difficult as writing the code for it.

    Basically, you'll need some sort of counter that counts the number of bars that go by and makes sure you only enter once per bar. Adding in the CalculateOnBarClose = false will still require that some calculations are only done once per bar. To get an overview of how do run certain calculations only once per bar, this reference sample can help get you started.
    AustinNinjaTrader Customer Service

    Comment


      #3
      Thank you,

      I thought that may be the case and read "bars objects, bars array" before posting my question. I have no idea how to implement/write it into my strategy. I hardly understand what it said. I have a lot to learn. Or find a way around it.
      Such as, use "calculate on bar close" instead. Change ask to close in the conditions, and then in the actions enter a buy with a limit order 2 ticks below last bar close (or the other way for shorts). That way I`d be filled lower than I originally had in mind (and ONE time per bar). That`s providing the market will fall additional 2 ticks. If not, I`d miss the entry/trade all together. I`ll experiment, see what I can come up with.

      Thank you for your help.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by doihaveto13, Today, 12:46 PM
      2 responses
      4 views
      0 likes
      Last Post doihaveto13  
      Started by Vitamite, Today, 12:48 PM
      1 response
      7 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by lorem, 04-25-2024, 09:18 AM
      15 responses
      64 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by owen5819, 05-11-2024, 02:24 PM
      3 responses
      21 views
      0 likes
      Last Post owen5819  
      Started by MrAdamSK, 04-02-2024, 11:25 PM
      3 responses
      41 views
      0 likes
      Last Post NinjaTrader_Zachary  
      Working...
      X