Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Simple Strategy

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

    Simple Strategy

    I put together a simple strategy to test some thoughts on order handling. To keep things very basic, I' kust using a SMA. When it is going up, I add a long at each bar close. When it turns down, I exit all positions and start adding shorts on each down bar. The problem is occuring on the changes from up to down, or visa versa. The strategy does a sell or "buy to cover", and also does a close position. What happens is I end up with same amount of contracts, heading in the opposite direction, instead of starting at 1 again. Am I missing something here? Thx.

    I have attached a pic of the code and also the orders tab...
    Attached Files

    #2
    Originally posted by BradB View Post
    I put together a simple strategy to test some thoughts on order handling. To keep things very basic, I' kust using a SMA. When it is going up, I add a long at each bar close. When it turns down, I exit all positions and start adding shorts on each down bar. The problem is occuring on the changes from up to down, or visa versa. The strategy does a sell or "buy to cover", and also does a close position. What happens is I end up with same amount of contracts, heading in the opposite direction, instead of starting at 1 again. Am I missing something here? Thx.

    I have attached a pic of the code and also the orders tab...
    Try simply eliminate ExitLong and ExitShort

    When you EnterLong,it will automatically close your short positions and viceversa.

    See how it goes.

    Comment


      #3
      Thanks, that works fine, but what I don't understand is... If the position was closed with the ExitLong or ExitShort, there should be no orders left when the next EnterLong or EnterShort fires.

      Comment


        #4
        Originally posted by BradB View Post
        Thanks, that works fine, but what I don't understand is... If the position was closed with the ExitLong or ExitShort, there should be no orders left when the next EnterLong or EnterShort fires.
        I am not sure exactly how NinjaTrader handles things internally, but what I suspect that since you are exiting and entering on the same tick, NT simply does not have enough time to report that position is flat before you EnterLong or EnterShort

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        66 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        149 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        162 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        99 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        286 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X