Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

For loop not working

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

  • leduc
    replied
    Hi mrlogic,
    With that code it works now yes

    Thanks for the help,
    leduc

    Leave a comment:


  • mrlogik
    replied
    leduc,

    you're probably having an issue because you're passing the amount of data loaded on the chart. Check the LOG tab; I bet you'll see an error.

    you want to do something like this

    Code:
    if(CurrentBar < 100)
        return;
    
    for(int i = 0 ; i < 100 ; i++)
        Print(Close[i].ToString());
    Also don't forget, this will give you 100 prints every bar, after the first 100 bars that is.

    Leave a comment:


  • leduc
    replied
    That was not it unfortunately.

    If I do that, I only get the closing price of the first bar. If I change the 100 into 1, I get all the closes for all the bars loaded...

    Any deas anyone?
    leduc

    Leave a comment:


  • Tarkus11
    replied
    I think your (x >100) should be (x < 100)

    Leave a comment:


  • leduc
    started a topic For loop not working

    For loop not working

    Dear All,

    Why is this loop not printing the last 100 closes ?

    regards,
    leduc

    protectedoverridevoid OnBarUpdate()
    {

    // double dblIndicatorSig = AtrCross(20)[0];
    for (int x = 0; x>100; x++)
    {
    Print (Close[x]);

    }
    }

Latest Posts

Collapse

Topics Statistics Last Post
Started by Atlant, Yesterday, 10:13 PM
1 response
4 views
0 likes
Last Post NinjaTrader_Jason  
Started by trader3000a, Yesterday, 03:59 PM
1 response
4 views
0 likes
Last Post NinjaTrader_Jason  
Started by fredNT13, Yesterday, 06:40 PM
1 response
12 views
0 likes
Last Post NinjaTrader_ChrisSch  
Started by sidlercom80, Today, 12:57 AM
0 responses
3 views
0 likes
Last Post sidlercom80  
Started by gbajaj, Yesterday, 11:16 PM
0 responses
1 view
0 likes
Last Post gbajaj
by gbajaj
 
Working...
X