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

Newbie Question Do I close a position before trying to place a new order?

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

    Newbie Question Do I close a position before trying to place a new order?

    I'm creating my first Strategy code via the wizard and I know that I don't know what I'm doing yet.
    I want to go long when certain conditions are met and short when other conditions are met. The conditions are a crossover of the EMA indicator line.
    Basically this is a signal to signal strategy. Go long until you close and go short until you close and go long again.

    Question: Do I "Exit" the short before taking the 1st long and vice versa do I "exit" the long before taking the 1st short?

    I've got more questions but that is one to get things going on this topic, remember I'm a newbie so please, be gentle!
    Ronnie

    #2
    Hello RonnieB,

    Thanks for your post.

    With reference to "Do I close a position before trying to place a new order?". If you are in a position already (for example Long) and your strategy says to go short, entering a short order will automatically create two short orders, the first is used to close the existing long position and it will show on the chart named as "Close position" and the 2nd short order will leave you in a short position. If you are in a flat position then a short order will only place the 1 order to leave you in the short position. In summary, all entry orders will automatically close an existing position in the opposite direction.

    You can exit a position before going in the opposite direction if you wish. For example you want to enter long on a crossover and decide to set a specific profit target and stop loss. In this case you go long on the crossover and if the profit target or stop are hit then you would be in a flat position Both the Profit target and stop are exit orders.

    I suggest reading the help guides section on the "managed approach" which will govern most strategies and puts some limitations in place to reduce unwanted positions: https://ninjatrader.com/support/help...d_approach.htm
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thanks PaulH, I have removed the 'close order' code and will just let the system do its own cancellation of an existing order and place the new one via the "Managed Approach" - thanks as well for the link, that helps. I've compiled the script and have it working in SIM to see how it performs. Much appreciated!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by GussJ, 03-04-2020, 03:11 PM
      14 responses
      3,244 views
      0 likes
      Last Post GussJ
      by GussJ
       
      Started by ArkansasClint, Today, 09:28 AM
      0 responses
      0 views
      0 likes
      Last Post ArkansasClint  
      Started by lorem, Today, 09:18 AM
      0 responses
      3 views
      0 likes
      Last Post lorem
      by lorem
       
      Started by hazylizard, Today, 08:38 AM
      4 responses
      11 views
      0 likes
      Last Post hazylizard  
      Started by geddyisodin, Today, 05:20 AM
      2 responses
      20 views
      0 likes
      Last Post geddyisodin  
      Working...
      X