Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Automated strategy

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

    Automated strategy

    Hi all,
    My automated strategy works well, but keeps opening positions immediately after closing the previous one, since conditions steel met. Is it possible to make it disabled right after only one position was opened and closed, so I will enable it later manually?
    Thank you.

    #2
    Hello 2014Michael,

    Thanks for your post.

    One method you could use, in your entry conditions, would be to check the number of bars since exit using the method BarsSinceExit(): http://ninjatrader.com/support/helpG...ssinceexit.htm

    Another way is to use a bool variable as part of your entry conditions and after entry you set to false. You would then need to determine when to reset that back to true. For example if your entry conditions are based on a moving average crossover, you could reset the bool to true when you enter in the opposite direction

    if (your conditions to go long && goLong == true)
    {
    EnterLong();
    goLong = false; // prevent re-entry.
    goShort = true; // allow short to occur
    }
    .
    ,
    if (your conditions to go short && goShort == true)
    {
    EnterShort();
    goShort= false; // prevent short re-entry
    goLong = true; // allow long to occur
    }
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Hello Paul,
      Thanks for your reply.
      Since we don’t know what price of the instrument is going to do: change the direction and go back, or just stay where it is for indefinite time, I obviously should choose the BarsSinceExit() method; so it will give me time to evaluate situation before I’ll enable the strategy back.
      Appreciate your help
      Michael

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by RookieTrader, Today, 09:37 AM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by alifarahani, Today, 09:40 AM
      0 responses
      2 views
      0 likes
      Last Post alifarahani  
      Started by Gerik, Today, 09:40 AM
      0 responses
      1 view
      0 likes
      Last Post Gerik
      by Gerik
       
      Started by KennyK, 05-29-2017, 02:02 AM
      3 responses
      1,282 views
      0 likes
      Last Post NinjaTrader_Clayton  
      Started by AttiM, 02-14-2024, 05:20 PM
      11 responses
      184 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X