Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Building a Strategy with nBarsDown

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

    Building a Strategy with nBarsDown

    Hello,

    I am having some trouble building a strategy with nBarsDown. I tried using a user input of value = 1 for true (when I tried to use a bool with this indicator it said Type of left expression and right expression do not match).

    Essentially, I am trying to get the strategy to enter a long trade when there are 4 consecutive bars down.

    I have attached a pic of the strategy builder and some of the code it generated.

    Thanks!
    Lois

    Click image for larger version

Name:	Capture.PNG
Views:	114
Size:	10.6 KB
ID:	1200754

    Value = 1;
    }
    else if (State == State.Configure)
    {
    }
    else if (State == State.DataLoaded)
    {
    NBarsDown1 = NBarsDown(Close, 4, true, true, true);
    }
    }

    protected override void OnBarUpdate()
    {
    if (BarsInProgress != 0)
    return;

    if (CurrentBars[0] < 1)
    return;

    // Set 1
    if (NBarsDown1[0] == Value)
    {
    EnterLong(Convert.ToInt32(DefaultQuantity), "");

    #2
    Hi, thanks for posting. Use the Misc>Numeric value instead on the right side of the condition builder.

    Kind regards,
    -ChrisL

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    97 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    141 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    125 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    76 views
    0 likes
    Last Post PaulMohn  
    Working...
    X