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 burtoninlondon, Today, 12:38 AM
    0 responses
    10 views
    0 likes
    Last Post burtoninlondon  
    Started by AaronKoRn, Yesterday, 09:49 PM
    0 responses
    14 views
    0 likes
    Last Post AaronKoRn  
    Started by carnitron, Yesterday, 08:42 PM
    0 responses
    11 views
    0 likes
    Last Post carnitron  
    Started by strategist007, Yesterday, 07:51 PM
    0 responses
    14 views
    0 likes
    Last Post strategist007  
    Started by StockTrader88, 03-06-2021, 08:58 AM
    44 responses
    3,983 views
    3 likes
    Last Post jhudas88  
    Working...
    X