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:	106
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 NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    62 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    134 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    75 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    45 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    50 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X