Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Order Error

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

    Strategy Order Error

    Hi there,

    I recently added a piece of code in my strategy, and started getting this error when testing on the demo account.

    Here is code

    Code:
    StopLossTicks						    = 40;
    ProfitTargetTicks					    = 160;
    BreakevenAfterTicks 				    = 50;
    Code:
    // Resets the stop loss to the original value when all positions are closed
    	if (Position.MarketPosition == MarketPosition.Flat)
    	{
    	SetStopLoss(CalculationMode.Ticks, StopLossTicks);
    	}
    			
    // If a long position is open, allow for stop loss modification to breakeven
    	if (Position.MarketPosition == MarketPosition.Long)
    			
    	{			
            // Once the price is greater than entry price+50 ticks, set stop loss to breakeven
    	if (Close[0] > Position.AveragePrice + BreakevenAfterTicks * TickSize)
    	{
    	SetStopLoss(CalculationMode.Price, Position.AveragePrice);
    	}
    	}
    			
    			
    // If a short position is open, allow for stop loss modification to breakeven
    	if (Position.MarketPosition == MarketPosition.Short)
    			
    	{			
    	// Once the price is greater than entry price-50 ticks, set stop loss to breakeven
    	if (Close[0] < Position.AveragePrice - BreakevenAfterTicks * TickSize)
    	{
    		SetStopLoss(CalculationMode.Price, Position.AveragePrice);
    	}
    	}
    I've attached the error messages.

    Could you please let me know where i'm going wrong?

    Thanks
    M
    Attached Files

    #2
    Hello mntemel,

    Thank you for your note.

    Without the full code we're unable to test on our end.

    If you'd like to upload the full code I can take a look and see if anything jumps out. Or if you'd prefer to email a copy, send to platformsupport[at]ninjatrader[dot]com with Attn: Alan P in the Subject line. Also within the email please include a link to this thread, and the files.

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

    Comment


      #3
      Hi Alan, I sent it as an email.

      Thanks
      M

      Comment


        #4
        @NinjaTrader_AlanP

        Have you had any chance to look into it?

        Thanks
        M

        Comment


          #5
          Hello mntemel,

          I was out of the office and see that Jesse sent you an email on 2-12 covering the issue.

          Would you please check your email and reply to that thread, or if you did not receive it please send an email to platformsupport[at]ninjatrader[dot]com with Attn: Alan P in the Subject line. Also within the email please include a link to this thread.

          Thank you.
          Alan P.NinjaTrader Customer Service

          Comment


            #6
            @NinjaTrader_AlanP

            Hi Alan,

            I could't find the email, just sent an email to platformsupport[at]ninjatrader[dot]com again.

            Thanks
            M

            Comment


              #7
              Hello mntemel,

              I have sent you an email in outlook.

              Please let us know if you do not receive it, or if you do, please reply to that email so I know you got it.

              Please let us know if you need further assistance.
              Alan P.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by MatthewLesko, Today, 11:13 PM
              0 responses
              2 views
              0 likes
              Last Post MatthewLesko  
              Started by Lance El Camino, Today, 04:14 PM
              1 response
              13 views
              0 likes
              Last Post s.kinra
              by s.kinra
               
              Started by jtrading82, Today, 04:56 PM
              1 response
              10 views
              0 likes
              Last Post NinjaTrader_ShawnB  
              Started by dmking, Today, 06:00 PM
              1 response
              6 views
              0 likes
              Last Post NinjaTrader_EricB  
              Started by WHICKED, Today, 03:23 PM
              1 response
              15 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Working...
              X