Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Where to place debugging stop orders code?

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

    Where to place debugging stop orders code?

    Here's one for Bertrand or Josh,

    Under Tips http://www.ninjatrader-support2.com/...ead.php?t=3418there is a post by Josh on debugging that reads:

    "When debugging stop or limit orders it can also be extremely useful to draw dots along your chart of the actual stop/limit prices. This way you can visually see where your orders are at and if they should have been filled or not."

    Code:
    Code:     DrawDot("Stop" + CurrentBar, 0, stopPrice, Color.Orange);
    Where should this be inserted, in Initialize () or OnBarUpdate()?

    Best, Tooearly

    #2
    Hi tooearly,

    In OnBarUpdate().
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Doesn't Compile

      When I insert DrawDot (Stop .... in OnBarUpdate () and compile I get an error message saying "The name Stop does not exist in the current context."

      When I change Stop to StopLoss or StopPrice to stopPrice, etc. no juice.

      I suppose I have to define Stop somewhere.

      Please look at the attachment showing the strategy sheet.

      Thanks, TE
      Attached Files
      Last edited by tooearly; 06-30-2009, 07:35 PM. Reason: add a line

      Comment


        #4
        TE, you would need to define the variable Stop first and then fill this with the value of your stoploss - for example in your case the Position.AvgPrice + / - the 0.1 percent stop you defined.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          StopLoss does not work

          This seem closely enough related to the DrawDot StopLoss issue that it may justify being posted here as a reply.

          The wizard in editor seems to introduce only one line when setting a stoploss,
          viz,

          SetStopLoss("", CalculationMode.Percent, 0.065, false);
          with nothing declared in Variables nor defined in Properties.

          But when I run backtests using the strategy with this code the losses exceed 6.5% (in this example) and no stop loss order is either placed or canceled. So it seems not to work, even though in the past I have gotten wizard-generated Stoploss to work. So I'm baffled.

          Is this related to the instruction from Bernard requiring that one define the variable Stop?

          Shouldn't one first declare a Private Double (StopLoss = 0.065) and then give it a Description in Properties? The Wizard does not seem to do this.

          Any light shed on this problem would be most appreciated.
          Last edited by tooearly; 07-05-2009, 10:23 PM. Reason: clarify question

          Comment


            #6
            tooearly, I suggest you activate TraceOrders to check 'under the hood' for the order generation. Also, the way your call is setup the 6.5 percent is hard coded in and does not represent a user definable input value. For this you're correct it would need to input name in the variables section and then a parameter description under properties.

            I'll also check into the code you send via email in a few mins.
            BertrandNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Currandeny, Today, 05:32 AM
            0 responses
            1 view
            0 likes
            Last Post Currandeny  
            Started by pjsmith, Today, 01:00 AM
            1 response
            8 views
            0 likes
            Last Post NT-Roland  
            Started by alejandro888, Yesterday, 08:41 PM
            0 responses
            9 views
            0 likes
            Last Post alejandro888  
            Started by UltraNIX, Today, 02:14 AM
            0 responses
            5 views
            0 likes
            Last Post UltraNIX  
            Started by augustfay, Yesterday, 12:06 PM
            1 response
            12 views
            0 likes
            Last Post NinjaTrader_Jason  
            Working...
            X