Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Targeted Stop Loss causes OnStateChange error

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

    Targeted Stop Loss causes OnStateChange error

    When using a SL & TP in the 'Stops and Targets' section of the strategy building. I encounter an error which results in my strategy refusing to enable.

    The error occurs when I try to define a specific price in the value. In this case I wanted to put the stop 1 tick below the low of the previous bar (Low[1] + (-1 * TickSize)). When doing so this throws up the following error.

    'Strategy 'BasicTrigger2': Error on calling 'OnStateChange' method: Object reference not set to an instance of an object.'

    After this the strategy will not enable at all and I have to remove the part of the value. If I simply have the SL and TP with an arbitrary single tick value the strategy gives no errors. I don't understand what I'm doing wrong?

    #2
    ok, I found the answer. You can't pass a variable in the strategy builder with SetStopLoss etc

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    45 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    21 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    31 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    50 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    42 views
    0 likes
    Last Post CarlTrading  
    Working...
    X