Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

condition builder help

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

    condition builder help

    I'm very new, very green. Need help with the following:
    Is it possible to do the following through strategy wizard without coding?

    I want to lock in the value of the current donchian channel price level at the point of sma crossovers (whatever crossover, this doesn't really matter). And then wait for bid to cross above that "locked in" donchian channel price level before going long.
    In set 1, i've set the conditons for the crossover, set "then do" to variable 0=1. In set 2, i've set the conditons variable 0=1 AND donchian channel upper 20 = dataseries...set "then do" as variable 1=1. I'm not sure what I'm doing wrong, but past threads aren't helping to figure how to lock in upper and/or lower donchian channel values AT THE POINT of moving avg crossover. I'm hoping to do this without coding...but. Any help would be greatly appreciated!

    #2
    Hi jtrotter33,

    Thanks for the post and welcome to the NinjaTrader forums. Yes, it's possible to both store values and setup sequences using user variables in the condition builder. Under the conditions section define your crossover, and in the actions section set the user defined variable as desired. As we discussed via email on this item, please share a screenshot of one part at a time that you're having difficulty with and we can comment more.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Ok, thanks Ryan, I'll start from the beginning.
      ...note, I'm not able to save a screenshot of my "conditions and actions" page on wizard, but this is what I have for each of the "sets":
      Set 1:
      When the following conditions are true:
      > CrossAbove(STARCbands(20),Lower, SMA(50), 1)
      Do the following:
      > DrawDot("My dot" + CurrentBar, false, 0, DonchianChannel(20).Upper[0], Color.Lime)
      > Variable0 = DonchianChannel(20).Upper[0]

      Set 2:
      When the following conditions are true:
      > GetCurrentBid() > Variable0
      Do the following:
      > EnterLong(DefaultQuanity, "")
      > Variable0 = 0

      Set 3:
      When the following conditions are true:
      > CrossBelow(STARCbands(20),Upper, SMA(50), 1)
      Do the following:
      > DrawDot("My dot" + CurrentBar, false, 0, DonchianChannel(20).Lower[0], Color.OrangeRed)
      > Variable1 = DonchianChannel(20).Lower[0]

      Set 4:
      When the following conditions are true:
      > GetCurrentAsk() < Variable1
      Do the following:
      > EnterShort(DefaultQuanity, "")
      > Variable1 = 0

      Once I run a new strategy analyzer backtest, I've entered the following criteria:
      ...note, zs 11-11, based on hourly bars (60 min)

      Data Series
      Price based on: last
      Type: minute
      Value: 60

      My first attachment is a screenshot for zs11-11 from 6/1/11 - 6/8/11.
      >It shows a buy at 1376.25 (question #1...i'm unsure why this occured)
      >You'll notice "mydot" lime on 6/2/11 on upper donchian channel, approx. 1397. Once the bid price crossed above that value is where I would like a buy to occur.

      My second attachment is a screenshot from 6/8/11 - 6/15/11.
      >On 6/12 you'll see the upper starc cross below sma(50) and the lower donchian channel is marked with red dot. This is the next price I want to close out previous buy and then go short once ask price crosses below that donch channel level approx 1370.
      >Unfortunately a sell order does not take place until 6/14, much later than my hopeful short entry at 1370.

      I apologize for not being able to enter my screenshots other than as attachments. Again, I'm not expecting you to enter this code for me, I just want to be able to learn and utilize the strategy wizard condition builder without coding. Thanks again for your help

      Attached Files

      Comment


        #4
        It looks like you have a handle on user variables to store your indicator values. From your first description it looks like you also want to use them to setup sequences. This sample is great for sequences with user variables.


        I would first get a handle on what exactly the sample is doing with user variables in order to setup the sequences. Once you understand how it works then you can integrate it into your own strategy. You won't be able to simply copy-paste the sample because you're already using user variables to store values.

        Values like GetCurrentBid and GetCurrentAsk are real time only, so when you access in a backtest it substitutes close price instead.
        Last edited by NinjaTrader_RyanM1; 12-05-2011, 12:38 PM.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Not being able to generate precise currentbid or currentask for backtesting may have been my problem, since this can't be completed until bar closes. But of course, I need to backtest to see my strategy results.
          Could i somehow get around this problem by increasing my parameters to get more precise entry/exit points?
          For example, if i'm wanting to trade 60 minute bars, does this = 3600 second bars??

          if so, is my math correct in that I would also increase my indicator parameters by a factor of 60 to:

          50sma = 3000sma
          20 starcbands = 1200 starcbands
          20 donchian channel = 1200 donchian channel

          Comment


            #6
            jtrotter,

            Here is a reference sample on increasing intra-bar granularity in your strategies during backtesting.

            You can submit orders to different Bars objects. This allows you the flexibility of submitting orders to different timeframes. Like in live trading, taking entry conditions from a 5min chart means executing your order as soon as possible instead of waiting until the next 5min bar starts building. You can achieve this by


            Please let me know if I may assist further.
            Adam P.NinjaTrader Customer Service

            Comment


              #7
              Thanks again Ryan. Is it possible to save and reference this sample in condition builder? When I download only the coded version appears, can't open in wizard condition builder. I may have done something wrong when downloading and importing ninjascript.

              Comment


                #8
                This is a strategy wizard sample. If yours is only showing the code, I would import it again using File > Utilities > Import NinjaScript. Answer yes to any overwrite prompts that come up.
                Then edit by clicking Tools > Edit NinjaScript > Strategy > SampleUserVariable. It should show the condition builder once you click next a few times.
                Ryan M.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                648 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                369 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                108 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                572 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                573 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X