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

Custom Order Fills

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

    Custom Order Fills

    Having read and implemented http://ninjatrader.com/support/helpG...fill_types.htm I'm wondering why my code alteration is not having the desired results. I simply switched the relational operators in @LiberalFillType to:
    if ((order.OrderAction == Cbi.OrderAction.Buy && order.LimitPrice > nextLow - epsilon)
    || (order.OrderAction == Cbi.OrderAction.BuyToCover && order.LimitPrice > nextLow - epsilon)
    || (order.OrderAction == Cbi.OrderAction.Sell && order.LimitPrice < nextHigh + epsilon)
    || (order.OrderAction == Cbi.OrderAction.SellShort && order.LimitPrice < nextHigh + epsilon))
    FillPrice = (order.OrderAction == Cbi.OrderAction.Buy || order.OrderAction == Cbi.OrderAction.BuyToCover) ? Math.Min(order.LimitPrice, nextHigh) : Math.Max(order.LimitPrice, nextLow); // set fill price
    }
    Why are my limits still being filled on touch? PS I don't use Default to accomplish this, its because the execution price is automatically set to the limit price, regardless whether a better price was available.

    #2
    Hello nrgtrader,

    As a heads up, fill types and bar types are not officially supported by NinjaTrader Support for NinjaTrader 7.

    That said, have you added file writes of the values of each variable used in the conditions (equivalent to prints) to see why the conditions are evaluating as true or false?

    Please include the output with your next post so that we may help analyze the behavior.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi NinjaTrader_ChelseaB -- thanks for taking a look at this. I looked at a few references for C# writing to file for outputting the variable but this is probably beyond my coding capabilities... If you could point me in the right direction it would be much appreciated!

      Comment


        #4
        Hello nrgtrader,

        The reference samples are working example of writing and reading to file.

        Have you tried modifying the working examples to change what is written and read?

        May we have an export of the script where you have attempted this to give you pointers?

        To export a NinjaTrader 8 NinjaScript do the following:
        1. Click Tools -> Export -> NinjaScript...
        2. Click the 'add' link -> check the box(es) for the script(s) you want to include
        3. Click the 'Export' button
        4. Enter a unique name for the file in the value for 'File name:'
        5. Choose a save location -> click Save
        6. Click OK to clear the export location message

        By default your exported file will be in the following location:
        • (My) Documents/NinjaTrader 8/bin/Custom/ExportNinjaScript/<export_file_name.zip>


        Below is a link to the help guide on Exporting NinjaScripts.



        Below are links to the two references samples I am referring to (and what I am assuming you are also referring to)
        StreamWriter - http://www.ninjatrader.com/support/f...ead.php?t=3475
        StreamReader - http://www.ninjatrader.com/support/f...ead.php?t=3476

        As well as a link to all of the reference samples.
        Following are links to all available NinjaScript reference samples within this forum section: Strategy Reference Samples (NinjaTrader 8) - also applicable to NT7 Using a time filter to limit trading hours (http://www.ninjatrader.com/support/forum/showthread.php?t=3226) Using multiple entry/exit signals simultaneously
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by ghoul, Today, 06:02 PM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by jeronymite, 04-12-2024, 04:26 PM
        3 responses
        44 views
        0 likes
        Last Post jeronymite  
        Started by Barry Milan, Yesterday, 10:35 PM
        7 responses
        20 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by AttiM, 02-14-2024, 05:20 PM
        10 responses
        179 views
        0 likes
        Last Post jeronymite  
        Started by DanielSanMartin, Yesterday, 02:37 PM
        2 responses
        13 views
        0 likes
        Last Post DanielSanMartin  
        Working...
        X