• 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

stop and loss without an order

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

    stop and loss without an order

    Dear all,

    First post so please be gentle with me!

    I have created a simple strategy (chopped-down snippet attached) which goes long when one MA crosses above another MA, and goes short when a third MA crosses below a fourth MA. I understand there is no need to cancel any previous short or long position as the EnterLong or EnterShort will do this automatically.

    I am plotting all the MAs and setting CalculateOnBarClose to true in the Initialize method.

    I was setting stop and limit in the initialize method as per the example, but this always resulted in a stop and limit being set before the actual trade was made.

    Immediately upon starting the strategy, it assumes it has a position, and sets stop and limit orders, but does not make the actual trade. The average price for the position is the price when the strategy is started. This was the same effect I got when setting stop and limit in the Initialize method.

    If I manually cancel the stop and limit orders from the chart trader, the strategy seems to be running ok.
    Attached Files

    #2
    Originally posted by ninjohn View Post
    ... Immediately upon starting the strategy, it assumes it has a position, and sets stop and limit orders, but does not make the actual trade. The average price for the position is the price when the strategy is started. This was the same effect I got when setting stop and limit in the Initialize method.

    If I manually cancel the stop and limit orders from the chart trader, the strategy seems to be running ok. ...
    Hopefully you'll also get some more authoritative responses than just mine, but I think you can get some insight into what's happeneing here ...

    http://www.ninjatrader-support.com/H...helpguide.html

    Search for the page on "Strategy Position Vs Account Position", and then note section where it says:

    An extremely common scenario…


    An extremely common scenario is starting a NinjaScript strategy in the middle of a trading session, such as one hour after the session has begun.. The NinjaScript strategy is run on each historical bar for the 1st hour of the session (it will actually run on all historical data loaded in a chart) to determine the current position state it would be in if it had been running live since the start of the session. This position state then becomes the Strategy Position for your strategy. Let us assume that during the historical hour your strategy would have entered a LONG 1 position and the position is still open. This would mean the Strategy Position is LONG 1 and since this trade was not actually executed on an account your Account Position is FLAT.


    What can you do in this case?


    If you want your Account Position to match your Strategy Position, you will need to place a manual order into the account the strategy is running on. Continuing from the above example, you would need to place a 1-lot market order for the market being traded into the account the strategy is running on.

    I am guessing that you are running in your SIM account, and starting up midway during the trading session ... ?
    Last edited by AnotherTrader; 03-12-2010, 03:29 AM.

    Comment


      #3
      AnotherTrader, thanks stepping in to help here - this is precisely the issue, when running the strategies in 'immediately submit' mode it will submit the historically working orders as soon as you start the strategy up (since there's a position carrying over from historical data). Thus the manual sync is required so the following executions align in your associated account as well -

      http://www.ninjatrader-support.com/H...tPosition.html

      NinjaTrader 7 will provide an auto Sync option to handle this 'under the hood' for you -

      http://www.ninjatrader.com/webnew/NT7/NinjaTrader7.html

      As an alternative you could start the strategy in 'Wait Until Flat' mode essentially taking the first live generated entry signal then and ignoring the historically carried over one...

      http://www.ninjatrader-support.com/H...tegiesTab.html
      BertrandNinjaTrader Customer Service

      Comment


        #4
        Thanks for the prompt response guys, I will make the necessary changes!

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by jleira, Today, 10:26 PM
        0 responses
        4 views
        0 likes
        Last Post jleira
        by jleira
         
        Started by wuileng, Today, 10:14 PM
        0 responses
        6 views
        0 likes
        Last Post wuileng
        by wuileng
         
        Started by mntemel, Today, 09:07 PM
        1 response
        10 views
        0 likes
        Last Post MojoJojo  
        Started by martyn73, Today, 08:22 PM
        0 responses
        10 views
        0 likes
        Last Post martyn73  
        Started by RobertoPaez, Today, 08:13 PM
        0 responses
        5 views
        0 likes
        Last Post RobertoPaez  
        Working...
        X