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

strategy is giving false signals

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

    strategy is giving false signals

    hi
    just trying to make a strategy that can draw a dot when the current bars range is less then previous bars range, here is the code that i made

    double todaysRange = High[0] - Low[0];
    double yesterdaysRange = High[1] - Low[1];
    if (todaysRange <= yesterdaysRange)
    {
    DrawDot("My dot" + CurrentBar, false, 0, Low[0] + -5 * TickSize,Color.Blue);
    }

    the dots are showing up on the charts but some are incorrect and many candlesticks that qualify to have a dot don't have one.

    how do i fix this ? and please explain what i did wrong as im still new to C# and eager to learn

    thank you in advance

    #2
    Hello maaz1598,

    Thanks for your post.

    Can you provide further information to help understand. What instrument are you using this on? What bar type (Daily, minute, tick, volume, other)? Can you post a chart showing the issue?
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      What youre doin is messuring the lengh of the current candle vs the candle b4 that. if the current one is smaller (from high to low) than the previous then youd get a dot.
      your code should work fine if thats what ur tryin to do.

      however. are you sure that this is what u want to do? are you sure that u dont want an "insidebar" meaning that the range of the currentbar should be within the range of the last bar. if thats what u want to do then your code is wrong ofc.

      that would require something like
      if (High[0] < High[1] && Low[0] > Low[1]){


      incase that doesnt solve the problem, i included an indicator that does both things. just set the bool to yes or no (inside the indicatorsettings) to switch between the 2 types of candles.
      one of the things you want should be included in this, if not then ur discription of want u wanna do is wrong and u need to clarify this.
      Attached Files
      Last edited by BigRo; 11-30-2015, 04:21 PM.

      Comment


        #4
        Originally posted by BigRo View Post
        What youre doin is messuring the lengh of the current candle vs the candle b4 that. if the current one is smaller (from high to low) than the previous then youd get a dot.
        your code should work fine if thats what ur tryin to do.

        however. are you sure that this is what u want to do? are you sure that u dont want an "insidebar" meaning that the range of the currentbar should be within the range of the last bar. if thats what u want to do then your code is wrong ofc.

        that would require something like
        if (High[0] < High[1] && Low[0] > Low[1]){


        incase that doesnt solve the problem, i included an indicator that does both things. just set the bool to yes or no (inside the indicatorsettings) to switch between the 2 types of candles.
        one of the things you want should be included in this, if not then ur discription of want u wanna do is wrong and u need to clarify this.
        thanks, you where correct i was trying to identify insidebars. I had a look at my code and found the fault in my logic
        once again thanks

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Rapine Heihei, 04-23-2024, 07:51 PM
        2 responses
        30 views
        0 likes
        Last Post Max238
        by Max238
         
        Started by Shansen, 08-30-2019, 10:18 PM
        24 responses
        943 views
        0 likes
        Last Post spwizard  
        Started by Max238, Today, 01:28 AM
        0 responses
        9 views
        0 likes
        Last Post Max238
        by Max238
         
        Started by rocketman7, Today, 01:00 AM
        0 responses
        5 views
        0 likes
        Last Post rocketman7  
        Started by wzgy0920, 04-20-2024, 06:09 PM
        2 responses
        28 views
        0 likes
        Last Post wzgy0920  
        Working...
        X