Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Quantity of the stop loss doubled compared to the entry signal

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

    Quantity of the stop loss doubled compared to the entry signal

    Hi everybody,
    Each trade has two legs. The quantity of my stop loss of the second leg (which move to breakeven once the first leg is closed) is doubled. I still absolutely don't know why, it seems crazy because the secondv stop is programmed exactly as the first one. If you have any idea, feel free to send me an email.

    Thanks a lot !

    PS ; everything works fine on sim
    Last edited by After; 01-13-2015, 11:34 AM.

    #2
    Hi After,

    What code are you using to generate the orders?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Code:
      EnterLong( 6, "Achat");
      	   EnterLong( 6, "Achat2");
      	   SetStopLoss( "Achat", CalculationMode.Ticks,8, false);
      	   SetProfitTarget("Achat", CalculationMode.Ticks,8);
                 SetStopLoss( "Achat2", CalculationMode.Ticks,8, false);
      	 SetProfitTarget("Achat2", CalculationMode.Ticks,23);
      Second leg is "achat2", and I got quantity of 12. I tried with 5 contracts and the stop of my second leg got a quantity of 10

      Code:
      SetStopLoss(CalculationMode.Ticks,8);
      	EnterLong( 6, "Achat");
      	EnterLong( 6, "Achat2");
      	SetProfitTarget("Achat", CalculationMode.Ticks,8);
      	SetProfitTarget("Achat2", CalculationMode.Ticks,23);
      This one is better ? I tried a lot of things
      Last edited by After; 01-13-2015, 11:56 AM.

      Comment


        #4
        Hi After,

        From what I see in the code, the stop loss should not have double the quantity of the entry.

        May I have an export of this script to test?

        To export your script do the following:
        1. Click File -> Utilities -> Export NinjaScript
        2. Enter a unique name for the file in the value for 'File name:'
        3. Select the strategy from the objects list on the left -> click the right facing arrow ">" to add the strategy to the export
        4. Click the 'Export' button -> click 'yes' to add any referenced indicators to the export -> click OK to clear the export location message


        By default your exported file will be in the following location:
        • (My) Documents/NinjaTrader 7/bin/Custom/ExportNinjaScript/<export_file_name.zip>


        Below is a link to the help guide on Exporting NinjaScripts.
        http://www.ninjatrader.com/support/h...nt7/export.htm
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Code:
          if (Position.MarketPosition == MarketPosition.Long)
          			{
          				// Once the price is greater than entry price+50 ticks, set stop loss to breakeven
          				if (Close[0] > Position.AvgPrice + 6 * TickSize)
          				{
          					SetStopLoss(CalculationMode.Price, Position.AvgPrice);
          				}
          			}
          			
          			if (Position.MarketPosition == MarketPosition.Short)
          			{
          				// Once the price is greater than entry price+50 ticks, set stop loss to breakeven
          				if (Close[0] < Position.AvgPrice - 6 * TickSize)
          				{
          					SetStopLoss(CalculationMode.Price, Position.AvgPrice);
          				}
          			}
          Does this code could be guilt ?

          Comment


            #6
            Hello,

            This code by itself does not appear that it would cause double the entry quantity.

            Do you have an exportable sample I can test? (I will likely be able to find the issue quickly by adding prints and trace orders so that I can see the flow of the strategy and when exit becomes doubled)
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by llanqui, Today, 03:53 AM
            0 responses
            6 views
            0 likes
            Last Post llanqui
            by llanqui
             
            Started by burtoninlondon, Today, 12:38 AM
            0 responses
            10 views
            0 likes
            Last Post burtoninlondon  
            Started by AaronKoRn, Yesterday, 09:49 PM
            0 responses
            15 views
            0 likes
            Last Post AaronKoRn  
            Started by carnitron, Yesterday, 08:42 PM
            0 responses
            11 views
            0 likes
            Last Post carnitron  
            Started by strategist007, Yesterday, 07:51 PM
            0 responses
            14 views
            0 likes
            Last Post strategist007  
            Working...
            X