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

Problem: Stop Loss is set - but not from my script

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

    Problem: Stop Loss is set - but not from my script

    Hi all!

    I have a strategy that does not set any stoploss. But when I start the strategy the lines below appear in the output windows.
    The interesting thing is, that I have no stoploss set in this strategy.
    Additionally the line "Fresh from DB: stoploss_distance_p: 0.005" is a print (debug) command from a completely different strategy of mine.

    How can this happen?
    Is there a solution?

    Best regards,
    Stefan

    Edit: I just noticed the lines below appear already in the output window when I OPEN the strategy dialog box to add a new strategy to a chart. I have no strategy selected by this time.

    8/15/2011 10:35:52 AM Entered internal SetStopTarget() method: Type=Target FromEntrySignal='longposition' Mode=Ticks Value=200 Currency=0 Simulated=False
    8/15/2011 10:35:52 AM Entered internal SetStopTarget() method: Type=Target FromEntrySignal='longposition' Mode=Percent Value=0.005 Currency=0 Simulated=False
    Fresh from DB: stoploss_distance_p: 0.005
    8/15/2011 10:35:52 AM Entered internal SetStopTarget() method: Type=Target FromEntrySignal='longposition' Mode=Percent Value=0.02 Currency=0 Simulated=False
    8/15/2011 10:35:52 AM Entered internal SetStopTarget() method: Type=Target FromEntrySignal='longposition' Mode=Percent Value=0.02 Currency=0 Simulated=False
    Fresh from DB: stoploss_distance_p: 0.005
    8/15/2011 10:35:52 AM Entered internal SetStopTarget() method: Type=Target FromEntrySignal='longposition' Mode=Percent Value=0.02 Currency=0 Simulated=False
    8/15/2011 10:35:52 AM Entered internal SetStopTarget() method: Type=Target FromEntrySignal='shortposition' Mode=Percent Value=0.02 Currency=0 Simulated=False
    **NT** Enabling NinjaScript strategy 'breakingchannel20110813/95f3973948864aa6be66b674acd7a9ba' : On starting a real-time strategy - StrategySync=SubmitImmediately SyncAccountPosition=False EntryHandling=AllEntries EntriesPerDirection=1 StopTargetHandling=PerEntryExecution ErrorHandling=StopStrategyCancelOrdersClosePositio ns ExitOnClose=True/ triggering 30 before close Set order quantity by=Strategy ConnectionLossHandling=KeepRunning DisconnectDelaySeconds=10000 CancelEntryOrdersOnDisable=False CancelExitOrdersOnDisable=False MaxRestarts=50 in 500 minutes
    Last edited by caliph; 08-15-2011, 02:57 AM.

    #2
    caliph, generally the Initialize() method is called across all scripts present - the print debug command from another strategy would mean it's somewhere running as well, could it for example in another workspace that would be currently non visible? You could toggle through open ones via Shift + F3.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Thanks for the fast answer.

      I closed all other workspaces and the situation remains the same.
      Additionally no Initialize method has such a print command in any of my strategies.

      I just noticed the lines above appear already in the output window when I OPEN the strategy dialog box to add a new strategy to a chart. I have no strategy selected or started by this time.

      Comment


        #4
        Correct, at the point where you open the 'strategies select' window to add a script the Initialize() is alreadu called, where normally the Set() commands for the stops are resting.

        If you like to clear the output window up before using the strategy, I would suggest a ClearOutputWindow() call in OnStartUp().

        For the Print command : where would that be called in the strategy code?
        BertrandNinjaTrader Customer Service

        Comment


          #5
          I tried and localized the problem to be functions of the same name with declaration "public void". I renamed them and now the startegy works as intended.

          Regarding the Print commend: I have to take back my earlier statement. It was indeed located in a function that was called in the Initialize method.

          Thanks for the explanations; they helped a lot.

          Comment


            #6
            Thanks for letting me know, happy to hear you could trace it down.
            BertrandNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by itrader46, Today, 09:04 AM
            1 response
            3 views
            0 likes
            Last Post NinjaTrader_Clayton  
            Started by timmbbo, Today, 08:59 AM
            0 responses
            1 view
            0 likes
            Last Post timmbbo
            by timmbbo
             
            Started by bmartz, 03-12-2024, 06:12 AM
            5 responses
            33 views
            0 likes
            Last Post NinjaTrader_Zachary  
            Started by Aviram Y, Today, 05:29 AM
            4 responses
            14 views
            0 likes
            Last Post Aviram Y  
            Started by algospoke, 04-17-2024, 06:40 PM
            3 responses
            28 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Working...
            X