• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

barsInProgress bug or confusion

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

  • NinjaTrader_JoshP
    replied
    No, a bool is either true or false. You type "true" or "false".

    Leave a comment:


  • woodside
    replied
    Thanks for you help but still not working. Using this:

    EnterShortStopLimit(0,1,1,Low[Bars.LowestBar(entryBars)],Low[Bars.LowestBar(entryBars)],"ShortLimit");
    The best overloaded method match for 'NinjaTrader.Strategy.StrategyBase.EnterShortStopL imit(int, bool, int, double, double, string)' has some invalid arguments

    Argument '2': cannot convert from 'int' to 'bool'
    A bool is either a 1 or a 0, with no quotes required?

    I'm sure it's simple error but I just can't see it. Any idea when there will be docs on all the new 6.5 functions?

    Leave a comment:


  • NinjaTrader_JoshP
    replied
    No they don't, but your syntax should have 6 arguments.

    EnterShortStopLimit(int barsInProgressIndex, bool liveUntilCancelled, int quantity, double limitPrice, double stopPrice, string signalName)

    Leave a comment:


  • woodside
    replied
    tried the following for a barsinprogress = 0 and an order for 1 contract:



    EnterShortStopLimit(0,1,Low[Bars.LowestBar(entryBars)],Low[Bars.LowestBar(entryBars)],"ShortLimit");
    and
    I get the following error:

    No overload for method 'EnterShortStopLimit' takes '5' arguments

    do the "low" functions need to be sent a barsinprogress also?

    Leave a comment:


  • NinjaTrader_JoshP
    replied
    Hi woodside,

    Have you checked out the new syntax available in NT6.5?
    EnterLong(int barsInProgressIndex, int quantity, string signalName)

    You can specify which barsInProgress you want the order to execute on. I believe this way you might not need to do the whole BarsInProgress == 0 || ==1 etc. stuff.

    Leave a comment:


  • NinjaTrader_Dierk
    replied
    We'll look into and will come back to you later.

    Leave a comment:


  • woodside
    started a topic barsInProgress bug or confusion

    barsInProgress bug or confusion

    I'm having an issue with a multi timeframe strategy.

    In realtime trading I need to use this:
    Code:
    if (BarsInProgress==0 || BarsInProgress==1 || BarsInProgress ==2 || BarsInProgress == 3)
    
    && (BarsSinceExit(0,"LongLimit", 0) >= 15)  || BarsSinceExit(0,"LongLimit", 0) == -1 )
    If I don't include all 4 bars in progress, and order will get set when in barsinprogress 0, then immediately canceled when it hits bars in progress = 1, etc. I assume it loops through the barsinprogress array , so if I have 1,3,15, etc. bars, when it hits a 15 minute bar it'll loop through all 3.

    but in backtesting, the basinprogress doesn't seem to work right, as it seems to take orders in the other timeframes. It should wait 15 minutes after exiting but might hit barsinprogress 2, which is a 3 minute timeframe so I get orders on that timeframe as well, only in backtesting.

    Not sure I'm explaining this correctly, but this is the solution I've come up with to get proper backtesting results, as well has having the strategy run properly in realtime:

    Code:
    ((Historical &&    BarsInProgress==0) || (!Historical && (BarsInProgress==0 || BarsInProgress==1 || BarsInProgress ==2 || BarsInProgress == 3)) 
    
    && (BarsSinceExit(0,"LongLimit", 0) >= 15)  || BarsSinceExit(0,"LongLimit", 0) == -1 )
    Perhaps I'm confused a little on how to code a multi timeframe strategy, but what I want is to use a 1 minute chart to take all the orders and then use the other timeframes for decisions. It's working now but I'm not sure my way is the proper way.

    Please respond if this doesn't make sense.

Latest Posts

Collapse

Topics Statistics Last Post
Started by canuck, Today, 07:52 PM
0 responses
2 views
0 likes
Last Post canuck
by canuck
 
Started by itrader46, Yesterday, 11:12 PM
2 responses
17 views
0 likes
Last Post koganam
by koganam
 
Started by walter739, Today, 06:04 PM
0 responses
3 views
0 likes
Last Post walter739  
Started by MarkWise, Today, 03:04 PM
2 responses
8 views
0 likes
Last Post MarkWise  
Started by maltese, Today, 02:38 PM
2 responses
11 views
0 likes
Last Post maltese
by maltese
 
Working...
X