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

Enable Checkbox Won't Stay Checked

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

    Enable Checkbox Won't Stay Checked

    Hi. I have a strategy where I reference 5 bars ago, 6, 7, 8 and 9. It works fine here. Once I add the exact same line but instead reference 10 bars ago it then won't allow the enable checkbox to stay checked after I apply it to a chart.

    Here is the code that works as expected.

    Code:
    if (
    
                    (
    
                    (Low[0] == (Low[5] + (EntryOffset_Long * TickSize)))
                    || (Low[0] == (Low[6] + (EntryOffset_Long * TickSize)))
                    || (Low[0] == (Low[7] + (EntryOffset_Long * TickSize)))
                    || (Low[0] == (Low[8] + (EntryOffset_Long * TickSize)))
                    || (Low[0] == (Low[9] + (EntryOffset_Long * TickSize)))
    
                    )
                    && (BarWick == true)
    
                    )
    
    {
                    EnterLong(Convert.ToInt32(DefaultQuantity), "");
                }​
    
    ​
    Once I change it so that it includes the Low[10] like this:

    Code:
    if (
    
                    (
    
                    (Low[0] == (Low[5] + (EntryOffset_Long * TickSize)) )
                    || (Low[0] == (Low[6] + (EntryOffset_Long * TickSize)))
                    || (Low[0] == (Low[7] + (EntryOffset_Long * TickSize)) )
                    || (Low[0] == (Low[8] + (EntryOffset_Long * TickSize)) )
                    || (Low[0] == (Low[9] + (EntryOffset_Long * TickSize)) )
                    || (Low[0] == (Low[10] + (EntryOffset_Long * TickSize)) )
    
                    )
                    && (BarWick == true)
    
                    )
    
    
    
                {
                    EnterLong(Convert.ToInt32(DefaultQuantity), "");
                }​
    it then doesn't let the checkbox stay checked.

    Any help appreciated!

    #2
    Hello yeahdudeman,

    You are likely having an error, please check the control center log tab after trying to enable it.

    If you get an error when changing the BarsAgo you also need to update your CurrentBar check:

    if(CurrentBar < 10) return;
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by halgo_boulder, 04-20-2024, 08:44 AM
    2 responses
    21 views
    0 likes
    Last Post halgo_boulder  
    Started by mishhh, 05-25-2010, 08:54 AM
    19 responses
    6,189 views
    0 likes
    Last Post rene69851  
    Started by gwenael, Today, 09:29 AM
    0 responses
    5 views
    0 likes
    Last Post gwenael
    by gwenael
     
    Started by Karado58, 11-26-2012, 02:57 PM
    8 responses
    14,830 views
    0 likes
    Last Post Option Whisperer  
    Started by Option Whisperer, Today, 09:05 AM
    0 responses
    2 views
    0 likes
    Last Post Option Whisperer  
    Working...
    X