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

Custome Support/Resistance LINE Problem

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

    Custome Support/Resistance LINE Problem

    Hey guys, I'm trying to create a Simple S&R Indicator. And Drawing the Lines is okay. The problem is that I have some conditions that when they are met I want the indicator to Plot some stuff on the screen.

    But sometimes it plots it, and sometimes it doesnt' even when condition is met. This is my first attempt at DrawLine, so I'm not too sure if I'm doing something wrong with the Occurrence part of the Code, or something else.

    The Strength I chose on the Pic is 3. So I know that the Line begins Plotting before Price Breaks Below, I just Don't know what's Going ON.

    I've attached the Indicator and Here's a Pic of the Problem:


    Please let me know what I'm doing wrong and if it can be fixed. PLEASE HELP. THANK YOU
    Attached Files

    #2
    Hello ginx10k,

    Thank you for your post.

    I will test the indicator on my end and follow up with you as soon as possible.

    Comment


      #3
      Thanks Patrick. I'll await for your input. Much Appreciated!

      Comment


        #4
        Hello ginx10k,

        Thank you for your patience.

        Using the following code I am able to see that when successive lines are drawn before the low crosses below one of them that the startY is referenced as the line preceding the most recent. This causes the exact same item on my charts as well.

        The lines of code I added to see this in the Output window (Tools --> Output) are the following:
        Code:
        			//STEP 2. SET Support Line Values
        			startY = Low[supportStartBarsAgo];	//The beginning of Support Line on the Y-axis
        			endY = startY;	
        			
        			[B]Print("Time: " + Time[0]);
        			Print("Start Y: " + startY);[/B]
        Does this issue only occur on the historical portion of the chart or in real-time as well?

        Comment


          #5
          I tried it on Market replay for Today on USD/JPY. you're right it mostly doesn't work on Historical. But I've noticed that sometimes it doesn't Even Draw the sLine, it skips it even when I have a New Swing Low. and it'll go straight to the Historical line.

          I just found something. the Line 64 where I have the (supportOccurence + 1), I think that meant that the swing low starts counting one more bar after current bar. I'm not sure, I'm still learning what this means.

          Can you help fix this code please.

          I seriously don't know what to do anymore. Thank you.


          I really would like to LOOK back to see historical Signals after breakout, but also want it to calculate properly in Real time.
          Last edited by ginx10k; 06-10-2014, 02:24 PM.

          Comment


            #6
            Hello ginx10k,

            Thank you for your response.

            Try commenting out the historical line and then test again.

            Comment


              #7
              I just did it. and I get the "A" when price breaks Below the Line, but if a New line starts forming and price Breaks back UP towards the OLD One, It's NOT giving me a "B"




              Is there a Way to fix this? I thought that's what the Historical Line was supposed to do.

              Can someone on your team please help. Thanks Bud!!

              Comment


                #8
                Hello ginx10k,

                Thank you for your response.

                This is likely due to the condition as it checks against the startY of sLine or hsLine. So we never see a cross on the hsLine as it is never set due to commenting it out. You will need to continue to test for these types of scenarios and find solutions around these items.

                For this particular item we can either un-comment hsLine and figure another way to get around the A not always drawing. Or you could use assign a double as the previous Swing Low used prior to the current DrawLine, similar to how you drew the hsLine in the first place but just reference this in the necessary conditions, such as when we draw B.

                Comment


                  #9
                  I appreciate your response. Do you think it's possible to give me a Sample of the Code of what you mean. I'm still learning all this. so I can't always translate words directly into Code.

                  Please I would like help in accomplishing what you just mentioned. Thank you kindly!!

                  Comment


                    #10
                    Hello ginx10k,

                    Thank you for your response.

                    The following uses a new double added to store the previous startY value (much as you did with the hsLine):
                    Code:
                    private double prevLine = 0; // place this in the variables section
                    ...
                    if(ShowHistory) {prevLine = startY;} // place this where the hsLine is drawn in the code
                    ...
                    if(sellA && CrossAbove(High, sLine.StartY, 1) || (sellA && CrossAbove(High, prevLine, 1))) // you can see the change to the condition here that you will need to do for the conditions

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by pkefal, 04-11-2024, 07:39 AM
                    11 responses
                    36 views
                    0 likes
                    Last Post jeronymite  
                    Started by bill2023, Yesterday, 08:51 AM
                    8 responses
                    43 views
                    0 likes
                    Last Post bill2023  
                    Started by yertle, Today, 08:38 AM
                    6 responses
                    25 views
                    0 likes
                    Last Post ryjoga
                    by ryjoga
                     
                    Started by algospoke, Yesterday, 06:40 PM
                    2 responses
                    24 views
                    0 likes
                    Last Post algospoke  
                    Started by ghoul, Today, 06:02 PM
                    3 responses
                    16 views
                    0 likes
                    Last Post NinjaTrader_Manfred  
                    Working...
                    X