Announcement

Collapse
No announcement yet.

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.

    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?

        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.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            574 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            333 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            101 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            553 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            551 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X