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 CaptainJack, 05-29-2026, 05:09 AM
    0 responses
    161 views
    0 likes
    Last Post CaptainJack  
    Started by CaptainJack, 05-29-2026, 12:02 AM
    0 responses
    81 views
    0 likes
    Last Post CaptainJack  
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    125 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    206 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    184 views
    0 likes
    Last Post CarlTrading  
    Working...
    X