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, 10: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 Stanfillirenfro, Today, 07:23 AM
        9 responses
        23 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by George21, Today, 10:07 AM
        0 responses
        6 views
        0 likes
        Last Post George21  
        Started by DayTradingDEMON, Today, 09:28 AM
        2 responses
        16 views
        0 likes
        Last Post DayTradingDEMON  
        Started by navyguy06, Today, 09:28 AM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by cmtjoancolmenero, Yesterday, 03:58 PM
        8 responses
        32 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X