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

Only one enter long order is triggered when all conditions are met

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

  • Gav_G
    replied
    I will test his & let you know if I see any different behaviour

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello Gav_G,

    I would expect defaults to take effect immediately in the Strategy Analyzer without having to close it.

    I've tested on my end to confirm. Are you able to reproduce this behavior with the Strategy Analyzer?

    Leave a comment:


  • Gav_G
    replied
    Hi Chelsea

    Thanks for this, I now have this working, I think it was due to me needing to re add it to the chart.

    I was using the strategy analyser which I had open, I was compiling in the strategy builder & then hitting run. Am I right in saying that for default settings to take effect, I would need to close & reopen the strategy analyser?

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello Gav_G,

    Unique entries would allow for both entries when each entry has a unique signal name.

    Have these default settings been changed and the script compiled since the script was added to a chart? (If so, remove and re-add the instance from the chart to reload the defaults)

    If that does not correct the behavior, may I test the script on my end?

    To export a NinjaTrader 8 NinjaScript so this can be shared and imported by the recipient do the following:
    1. Click Tools -> Export -> NinjaScript...
    2. Click the 'add' link -> check the box(es) for the script(s) and reference(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.
    http://ninjatrader.com/support/helpG...-us/export.htm

    Once exported, please attach the file as an attachment to your reply.

    Leave a comment:


  • Gav_G
    replied
    Hi Emma, thanks for the response, I've tried this but it's not working

    If I'm using multiple entries I'm assuming I should use unique entries though?

    Leave a comment:


  • Emma1
    replied
    EnteriesPerDirection = 2

    Leave a comment:


  • Only one enter long order is triggered when all conditions are met

    Hi

    I have created a strategy to test using the strategy builder wizard. I've used the wizard to get the framework of the system sorted, & am expecting to update the code for some of the more details conditions.

    When my conditions are met I want to create 2 buy market orders. I've created them both in the wizard but only one is being triggered, the first one in the list.

    I've tried to set the unique entries or all entries, I've also changed from number of entries per direction to 2. Something isn't working correctly here but I'm not sure why.

    The reason I want to use 2 orders is so that I can have one set to a fixed profit target & one will use a trailing stop that I'm going to have to code myself I think.

    Any help would be appreciated, please see the code below

    Code:
    EntriesPerDirection                        = 1;
    EntryHandling                                = EntryHandling.UniqueEntries;

    Code:
    protected override void OnBarUpdate()
            {
                if (BarsInProgress != 0) 
                    return;
    
                if (CurrentBars[0] < 1)
                    return;
    
                 // Set 1
                if ((RSI1.Avg[0] > RSI_long))
                {
                    EnterLong(Convert.ToInt32(DefaultQuantity), @"Buy_2");
                    EnterLong(Convert.ToInt32(DefaultQuantity), @"Buy_1");
                }
    
                 // Set 2
                if (Close[0] < HMA1[0])
                {
                    ExitLong(Convert.ToInt32(DefaultQuantity), @"Exit_Long_1", @"Buy_1");
                    ExitLong(Convert.ToInt32(DefaultQuantity), @"Exit_Long_2", @"Buy_2");
                }
    
            }
    In the above example only Buy_2 is being created

Latest Posts

Collapse

Topics Statistics Last Post
Started by AaronKoRn, Yesterday, 09:49 PM
0 responses
11 views
0 likes
Last Post AaronKoRn  
Started by carnitron, Yesterday, 08:42 PM
0 responses
10 views
0 likes
Last Post carnitron  
Started by strategist007, Yesterday, 07:51 PM
0 responses
11 views
0 likes
Last Post strategist007  
Started by StockTrader88, 03-06-2021, 08:58 AM
44 responses
3,981 views
3 likes
Last Post jhudas88  
Started by rbeckmann05, Yesterday, 06:48 PM
0 responses
9 views
0 likes
Last Post rbeckmann05  
Working...
X