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

Simple Price Channel Indicator Problem!

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

    Simple Price Channel Indicator Problem!

    Hey guys. I have the simplest and dumbest problem. I don't know why I can't get this to Plot an arrow when the simple condition
    Code:
    if (High[0] == DonchianChannel(period).Upper[2] || (CrossAbove(High, DonchianChannel(period).Upper[2], 0)))
    is Met.

    What I want is that if the Current High[0] touches the UpperBand of 2 Bars Ago.....(do something)..."

    I've attached the code. Please help
    Attached Files

    #2
    Hello ginx10k,

    Thank you for your post.

    I was able to see the arrow by adding the following line to the beginning of the OnBarUpdate() and setting the DrawArrow to AutoScale = true:
    Code:
            protected override void OnBarUpdate()
            {
    			if(CurrentBar <= period)
    				return;
    Code:
    			if (High[0] == DonchianChannel(period).Upper[2] || (CrossAbove(High, DonchianChannel(period).Upper[2], 0)))
    			{	
    				DrawArrowDown("My down arrow" + CurrentBar, [B]true[/B], 0, High[0] + 10 * TickSize, Color.Red);
    			}

    Comment


      #3
      Thanks!

      Okay. so it worked. Thank you very Much.

      Comment


        #4
        Different TIMEFRAME

        Hey. I'm trying to use the DonchianChannel(period).Upper[2] of a 5-min Chart on a 1-min Chart.

        Any Idea How to Do This. I just want to access any Donchian Channel on any timeframe. but using 5-min on a 1-min chart is a little example.

        Thanks in Advance!!

        Comment


          #5
          Hello ginx10k,

          Thank you for your post.

          You would need to add the 5 minute bar series to your script and then call the DonchianChannel with the following syntax: DonchianChannel(BarsArray[1], period).Upper[2]

          Please review the information at the following link for adding additional time frames to your code: http://www.ninjatrader.com/support/h...nstruments.htm

          Comment


            #6
            It Worked Like a Charm. Thanks again Patrick!!

            Comment


              #7
              Problem Found

              Hey. I'm having a small problem. I am able to Plot 5min Price Channel on 1-min Chart. but My indicator is supposed to Calculate expiration and Entry on a 1-min Chart basis. The Code is Attached.

              here's a sample Pic of what I mean: http://screencast.com/t/gGFgTx6g

              Basically I want a 1-min Bar to Hit the Channel and Trigger and Entry. but I want the 2nd 1min Bar After the Entry to Calculate Expiration and a Diamond to be drawn on that 2nd Bar.

              For some reason, it's using the same Bars that it would use on a 5-min Chart. How do I fix this problem
              Attached Files

              Comment


                #8
                Hello ginx10k,

                Thank you for your post.

                There is no BarsInProgress check in your code, so the code is processed on all bar updates; 1 minute and 5 minute. You will need to use BarsInProgress to limit the code to the desired bar objects. Please review the information at the following link for adding additional time frames to your code: http://www.ninjatrader.com/support/h...nstruments.htm

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by samish18, Today, 08:31 AM
                1 response
                1 view
                0 likes
                Last Post NinjaTrader_Clayton  
                Started by Creamers, 09-08-2023, 10:26 AM
                6 responses
                157 views
                0 likes
                Last Post JonyGurt  
                Started by funk10101, Today, 08:14 AM
                1 response
                2 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by trilliantrader, Today, 08:16 AM
                1 response
                6 views
                0 likes
                Last Post NinjaTrader_BrandonH  
                Started by bill2023, Yesterday, 08:51 AM
                3 responses
                22 views
                0 likes
                Last Post bltdavid  
                Working...
                X