Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Will this work?

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

  • cassb
    replied
    Originally posted by NinjaTrader_Paul View Post
    Hello Bryan,

    Thanks for your reply.

    Here is a video of what you asked for: http://screencast.com/t/FjgYxqqC

    OK, so it works for you. I am baffled then about why 18 is some magic number that the SetProfitTarget code decides to use. I will look at my trace and log files and see if I can find something there.

    Bryan

    Leave a comment:


  • NinjaTrader_PaulH
    replied
    Hello Bryan,

    Thanks for your reply.

    Here is a video of what you asked for: http://screencast.com/t/FjgYxqqC

    Leave a comment:


  • cassb
    replied
    Paul, I am still at a loss as to why the magic number 18 is happening. No matter how many profit targets I set, if there are more than 18 contracts per entry, then the profit target limit orders will always create one order for 18 contracts, and another order 1 tick less for the rest of the contracts.

    SetProfitTarget("Entry 1",CalculationMode.Ticks, 20)
    EnterLongStop(0, true, 19, 100.05, "Entry 1");

    This is creating 18 contracts at 100.25 and 1 contract at 100.24. This appears to be code that's running internally in NT, so I'm not sure why it's happening. Can you try an order with your strategy for more than 18 contracts per position and see if it does the same thing? I am using the latest copy of NT v7.

    Thanks!
    Bryan

    Leave a comment:


  • cassb
    replied
    I am not allowed to share the source code. But if you were able to test in your strategy and it works OK with 100 contracts, then I will assume it's a bug in my code and see if I can figure it out.

    Thanks!
    Bryan

    Leave a comment:


  • NinjaTrader_PaulH
    replied
    Hi Bryan,

    For me to assist further I will need more detail. Please post the strategy you are using and advise what instrument and time frame you are testing your strategy on.

    Alternatively, please feel free to send in the strategy to PlatformSupport[at]NinjaTrader[dot]com in the subject line put Atten: Paul and a link to this thread.

    Leave a comment:


  • cassb
    replied
    I don't think it's that setting, because it's not filling anything -- it's just placing BuyToCoverLMT orders. But I did check that box and tried again -- it still is placing 6 limit orders for the profit targets and not 3 like I expect.

    Bryan
    Attached Files

    Leave a comment:


  • NinjaTrader_PaulH
    replied
    Hi Bryan,

    Thanks for your reply.

    I can see I misread your post. I didn't see that you were getting partial fills and thought you were only getting 18 contracts filled. The partial fills would be because of the simulation engine trying to simulate a live environment where that many contracts might not get filled at once. You can change the behavior in Tools>Options> and in the simulator tab select "Enforce immediate fills".

    Leave a comment:


  • cassb
    replied
    Yes, it's set to by strategy. I attached a screen shot of the settings.

    Thanks!
    Bryan
    Attached Files

    Leave a comment:


  • NinjaTrader_PaulH
    replied
    Hi Bryan,

    Thanks for your reply.

    Yes, entries per direction would need to be 4.

    Is "set order Quantity" set to "by strategy"?

    Do you see any error messages in the "log" tab of the control center that relate to the strategy?

    Leave a comment:


  • cassb
    replied
    Originally posted by NinjaTrader_Paul View Post
    Hi Bryan,

    Thanks for your post.

    Do you have the entries per direction set to allow for that many contracts?
    Entries Per Direction is set to 4, because I want to allow a total of 4 profit targets.

    Bryan

    Leave a comment:


  • NinjaTrader_PaulH
    replied
    Hi Bryan,

    Thanks for your post.

    Do you have the entries per direction set to allow for that many contracts?

    Leave a comment:


  • cassb
    replied
    Originally posted by NinjaTrader_Paul View Post
    Hello cassb,

    Thanks for your post.

    Yes, it will work. I've created a short video on how you can test this for yourself: http://screencast.com/t/BPIBBRLLPiF
    Paul, do you still have your strategy set up? If so, can you enter these orders and test it?

    EnterLongStop(0, true, 34, 100.05, "Entry 1");
    EnterLongStop(0, true, 33, 100.05, "Entry 2");
    EnterLongStop(0, true, 33, 100.05, "Entry 3");

    When I do this in my strategy with the above targets set, I get

    18 contracts at 100.10, 16 at 100.09
    18 at 100.15, 15 at 100.14
    18 at 100.20, 15 at 100.19.

    I would expect 34, 33 and 33 at each target. Is there some reason internally to NT that it won't put more than 18 contracts at one price?

    Thanks!
    Bryan

    Leave a comment:


  • cassb
    replied
    That's awesome, thank you Paul! It seemed so simple but I have run into problems with multiple stops/targets before, so I just wanted to ask first this time.

    Take care,
    Bryan

    Leave a comment:


  • NinjaTrader_PaulH
    replied
    Hello cassb,

    Thanks for your post.

    Yes, it will work. I've created a short video on how you can test this for yourself: http://screencast.com/t/BPIBBRLLPiF

    Leave a comment:


  • cassb
    started a topic Will this work?

    Will this work?

    I want to have one stoploss and multiple targets when I place an order. So will this logic work and manage the stop and targets for me (with OCO):

    SetStopLoss(CalculationMode.Ticks, 10);
    SetProfitTarget("Entry 1",CalculationMode.Ticks, 5)
    SetProfitTarget("Entry 2",CalculationMode.Ticks, 10)
    SetProfitTarget("Entry 3",CalculationMode.Ticks, 15)
    SetProfitTarget("Entry 4",CalculationMode.Ticks, 20)
    EnterLongStop(0, true, 1, 100.05, "Entry 1");
    EnterLongStop(0, true, 1, 100.05, "Entry 2");
    EnterLongStop(0, true, 1, 100.05, "Entry 3");
    EnterLongStop(0, true, 1, 100.05, "Entry 4");

    So when this long order triggers at 100.05, I expect there to be one stoploss for 4 contracts at 99.95, and 4 targets at 100.10 for 1, 100.15 for 1, 100.20 for 1 and 100.25 for 1. As each target is hit, I expect the number of stoploss contracts to decrease for each target hit. If all targets are hit, the stoploss order is cancelled. If the stoploss is hit, all remaining target orders are cancelled.

    Thanks!
    Bryan

Latest Posts

Collapse

Topics Statistics Last Post
Started by Jimmyk, 01-26-2018, 05:19 AM
6 responses
835 views
0 likes
Last Post emuns
by emuns
 
Started by jxs_xrj, 01-12-2020, 09:49 AM
6 responses
3,291 views
1 like
Last Post jgualdronc  
Started by Touch-Ups, Today, 10:36 AM
0 responses
11 views
0 likes
Last Post Touch-Ups  
Started by geddyisodin, 04-25-2024, 05:20 AM
11 responses
62 views
0 likes
Last Post halgo_boulder  
Started by Option Whisperer, Today, 09:55 AM
0 responses
9 views
0 likes
Last Post Option Whisperer  
Working...
X