Announcement

Collapse
No announcement yet.

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;

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    47 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    23 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    33 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    51 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    42 views
    0 likes
    Last Post CarlTrading  
    Working...
    X