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

Mutiple entries not working in strategy develpment

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

  • im197
    replied
    Hello Chelsea,

    Find below the strategy code as an attachment.

    The idea behind having two entries is to have a profit target for one and let the other run - hence the ATRTarget1 variable..

    Of course I have not been able to implement the idea as only one entry was executed.

    Rgrds

    Ioannis

    Attached Files

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello Ioannis,

    With UniqueEntries I would expect both orders (also this only prevents a new order after the position is taken).

    May I test the script?

    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.


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

    Leave a comment:


  • im197
    started a topic Mutiple entries not working in strategy develpment

    Mutiple entries not working in strategy develpment

    Hi all,

    I am trying to create a strategy using the ATR Trailing indicator found here https://ninjatraderecosystem.com/use...d/atrtrailing/

    my code is as follows

    ---------------------

    protected override void OnBarUpdate()
    {


    if (CurrentBar < ATRPeriod) return;

    if (( IsFlat || IsLong ) && ( Low[0] > _atrTrail.Lower[0] ) && _atrTrail.Upper[0] != 0)
    {
    this.EnterShortStopMarket(lots, _atrTrail.Upper[0], "Short 1");
    this.EnterShortStopMarket(lots, _atrTrail.Upper[0], "Short 2");
    }

    if ( (IsFlat || IsShort) && (High[0] < _atrTrail.Lower[0] ) && _atrTrail.Lower[0] != 0 )
    {

    EnterLongStopMarket(lots, _atrTrail.Lower[0], "Long 1");
    EnterLongStopMarket(lots, _atrTrail.Lower[0], "Long 2");
    }
    }

    ------------------------

    For some reason the 2nd order is only submitted in short direction and only once
    All orders thereafter are only Long 1 and Short 1

    I have
    EntriesPerDirection = 1;
    EntryHandling = EntryHandling.UniqueEntries;

    The idea is to use some form of profit target for one order and use a protective trailing stop for the 2nd one

    Any help is greatly appreciated.


    Ioannis

Latest Posts

Collapse

Topics Statistics Last Post
Started by MGHORBEL, Today, 02:28 AM
0 responses
1 view
0 likes
Last Post MGHORBEL  
Started by dcriador, Today, 01:43 AM
1 response
5 views
0 likes
Last Post dcriador  
Started by louiseruch, Today, 01:11 AM
0 responses
1 view
0 likes
Last Post louiseruch  
Started by kujista, Today, 12:39 AM
0 responses
6 views
0 likes
Last Post kujista
by kujista
 
Started by tonynt, 05-21-2019, 06:27 AM
11 responses
536 views
1 like
Last Post NinjaTrader_Jason  
Working...
X