• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Weird orders I didn't place.

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

    Weird orders I didn't place.

    I wrote a simple strategy with StopLoss and ProfitTarget. But when I run it in the chart, I found out it sometimes close my position prematurely with a Close position which I absolutely didn't put in my code!!!

    Could somebody PLEASE tell me what's going on and how to fix it please!? Thank you very VERY much! God bless you!!!

    #2
    Hello YoutingChu,

    Thanks for your post.

    Please review your close position exit times, do these occur at the close of the session?

    If not, please post a screenshot that shows the exits on the chart along with a screenshot of your entry coding.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Dear Paul,

      Thank you very very much for you help!
      Below is the screen shot of the order and my source code.
      The strategy is the basic Forex strategy, where you place an OCO order at the opening of the market and set ProfitTarget and StopLoss accordingly. But it close my order prematurely with a Close position which I had circled.
      Please tell me why did that happen and how do I fix it. Thank you very VERY much! God bless you!!!

      Snap Shot
      Source Code
      Last edited by YoutingChu; 07-30-2018, 05:56 AM.

      Comment


        #4
        Hello YoutingChu,

        Thanks for your reply.

        It looks like you are using EnterLong or EnterShort to place orders. These order methods will detect any open positions and will issue closing orders. For example, if the strategy was long one contract and the strategy issues one short order, EnterShort() would issue one sell to "close position" then enter a second sell to leave your strategy in the desired direction (in this case short 1).

        If you do not want this to happen then in your order entry block you may want to test to see if you are not flat, for example:

        if (Position.MarketPosition != MarketPosition.Flat)

        {
        // if not flat do something here
        }
        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by PeterGolz, 01-17-2020, 10:42 AM
        11 responses
        71 views
        0 likes
        Last Post reubenlasky  
        Started by utilizator, Today, 11:36 AM
        0 responses
        4 views
        0 likes
        Last Post utilizator  
        Started by EnveousColnago, Today, 07:24 AM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_ShawnB  
        Started by tornadoatc, Today, 10:31 AM
        0 responses
        3 views
        0 likes
        Last Post tornadoatc  
        Started by EnveousColnago, Yesterday, 05:43 PM
        5 responses
        30 views
        0 likes
        Last Post EnveousColnago  
        Working...
        X