Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

unexpected/unwanted trades + Set methods

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

    unexpected/unwanted trades + Set methods


    Hi everyone,

    I have an issue with a strategy :

    at some point, from time to time, when running real time, the strategy starts to take unexpected trades as the short in the attached picture.
    there is no short in this piece of script, yet at the end of the long, it enters for a short.

    this is using the SetStopLoss(); and SetProfitTarget(); methods.

    Has anyone a clue as why this is doing this ? or what to look for in order to know the why and correct it ?
    Attached Files

    #2
    Hello Amedeus, thanks for writing in.

    It looks like a signal "Profit Target" is creating the short position. I can not tell what is causing this from the screen shot. Can you provide some details about the strategy?

    Best regards,
    -ChrisL
    Chris L.NinjaTrader Customer Service

    Comment


      #3

      hey Chris, thank you,

      I can provide some of it.
      The methods are called like this :


      Code:
      protected override void OnStateChange()
      {
      ...
      else if (State == State.DataLoaded)
      {
      someComboz_SetStopTarget();
      }
      }
      
      private void someComboz_SetStopTarget()
      {
      SetStopLoss("someComboa", CalculationMode.Ticks, someInta, false);
      SetStopLoss("someCombob", CalculationMode.Ticks, someInta, false);
      SetStopLoss("someComboc", CalculationMode.Ticks, someInta, false);
      
      SetProfitTarget("someComboa", CalculationMode.Ticks, someIntb);
      SetProfitTarget("someCombob", CalculationMode.Ticks, someIntb);
      SetProfitTarget("someComboc", CalculationMode.Ticks, someIntb);
      }
      None of the FromEntrySignal is called "Profit Target"...
      and the finder cannot find : "Profit Target"

      What better detail could I provide ?
      Last edited by Amedeus; 10-27-2021, 09:15 AM.

      Comment


        #4
        Hi Amedeus, thanks for posting this.

        The obvious problem from the screen shot is there are only two entries yet it looks like there are profit targets set, so there is something wrong with the entry quantities or order handling in the strategy. What data feed are you using to run the strategy? Can you send me a reduced example to scriptingsupport at ninjatrader.com, referencing "Attn ChrisL 3327115" in the body of the email?

        Best regards,
        -ChrisL
        Chris L.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by sidlercom80, Today, 11:26 AM
        0 responses
        1 view
        0 likes
        Last Post sidlercom80  
        Started by connorgrant5, Today, 10:29 AM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by frslvr, Today, 09:38 AM
        2 responses
        10 views
        0 likes
        Last Post frslvr
        by frslvr
         
        Started by guitarcombs, Today, 09:21 AM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_PatrickG  
        Started by Kawasaki, 03-18-2021, 08:48 PM
        6 responses
        2,209 views
        0 likes
        Last Post aytacasan  
        Working...
        X