Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Modifying stop-loss order to breakeven

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

    Modifying stop-loss order to breakeven

    Hello,
    Please, help me.
    I downloaded SampleOnOrderUpdate for change the stop loss order for breakeven and made a long strategy and a short strategy separate (both work well), then I tried to combine them into one strategy (I made several options), but only Long strategy is working correct now and I don't I can understand what I did wrong.

    http://ninjatrader.com/support/forum...ight=breakeven

    Regards,

    Yury
    Attached Files

    #2
    Hello YuryBr,

    Thank you for your note.

    I'm unable to look at the strategy due to it being exported as a compiled assembly. Would you please export the strategy again without having the Export as compiled assembly checked? (see attachment)

    I look forward to your reply.
    Attached Files
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Hello Alan,
      Thank you for fast reply.
      I send you code of stategy (txt and cs)

      regards,

      Yury
      Attached Files

      Comment


        #4
        Hello YuryBr,

        It looks as though the bracket you have under,
        Code:
        	if (Position.MarketPosition == MarketPosition.Long && Close[0] >= Position.AveragePrice + (39 * (TickSize / 2)))
        Encapsulates the rest of the code within OnBarUpdate which includes your if statement related to EnterShort, which is opposite to your EnterLong condition (highlighted in blue). See screen shot I've attached.

        I would suggest making changes to the placement of closing brackets and adding print statements to check whether your conditions are becoming true. I’ve provided a link to a youtube video which covers an example of using prints to understand behavior:
        https://www.youtube.com/watch?v=K8v_...tu.be&t=48m45s

        I’ve provided a link covering debugging which you may find helpful.
        Debugging: http://ninjatrader.com/support/forum...ead.php?t=3418

        Please let us know if you need further assistance.
        Last edited by NinjaTrader_AlanP; 03-15-2017, 01:16 PM.
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          Allan,
          All good, thank you for help.
          Could you help me else? I need to do a stop order move and at various intervals, for example, every 10 minutes to check: if the price has not grown for 10 minutes, then stop move up on 2 ticks.

          Regards,

          Yury

          Comment


            #6
            Hello Yury,

            I do not have any samples of this and building indicators/Strategies is out of the scope of our support.

            I attached a sample strategy which will modify a limit entry order if it’s not filled in 60 seconds. To accomplish this I save the current time to a DateTime variable at the time the order is submitted, I then add 60 second to that variable and compare the current time to that time varible, if its greater, than the entry limit order is modified.

            You could apply this logic to accomplish what you’re looking to do.

            If you would like someone from business development to reach out with a list of third party developers that would be interested in building your strategy, please let us know.
            Attached Files
            Alan P.NinjaTrader Customer Service

            Comment


              #7
              Hello Alan,
              Thank you very much.

              Regards,

              Yur

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by bowling, Today, 06:16 AM
              1 response
              10 views
              0 likes
              Last Post NinjaTrader_ShawnB  
              Started by systemtrader4, Today, 01:54 AM
              1 response
              16 views
              0 likes
              Last Post NinjaTrader_ShawnB  
              Started by Futurestrader00, Today, 01:54 AM
              1 response
              25 views
              0 likes
              Last Post NinjaTrader_ShawnB  
              Started by timmbbo, Today, 01:40 AM
              2 responses
              10 views
              0 likes
              Last Post NT-Roland  
              Started by BGWTEX, Yesterday, 07:20 PM
              0 responses
              7 views
              0 likes
              Last Post BGWTEX
              by BGWTEX
               
              Working...
              X