Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

backtesting with stopp loss change

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

    backtesting with stopp loss change

    Hi,

    I want to know if it's possible to backtest/optimize a strategy with adjusting the stop loss when entry and adjustment trigger are in the same candle.
    I'm using 240min candles and I want to backtest a strategy that moves the stop to breakeven after some ticks in the direction of the trade.
    So if I call and my stop is 20 ticks below the entry price, it will put the stop to the entry price after the stock gained for example 50 ticks trying afterwards to hit the target of 100 ticks.
    So if I'm backtesting this strategy I don't think it moves the stop after gaining 50 ticks within the same 240min candle where it entered the call. afterwards, at the next candles the backtest shows adjustment i think. The problem shows up only in the same candle as the entry.
    My code is pretty similar to the code published once as an example for modifying the price of stop loss and profit target orders here in the forum by the Ninjatrader Customer Service.

    What do I have to change to get the stop moving during backtest within the same candle as the entry?

    Find the sample code published at the Forum attached


    Thanks in advance!
    Last edited by Hanko; 11-27-2019, 08:51 AM. Reason: Please move my question to the Ninjatrader 7 strategy development group

    #2
    SamplePriceModification.cs

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by puapwr, Today, 06:09 PM
    0 responses
    4 views
    0 likes
    Last Post puapwr
    by puapwr
     
    Started by franciscog21, Today, 05:27 PM
    0 responses
    8 views
    0 likes
    Last Post franciscog21  
    Started by hdge4u, 04-29-2024, 12:23 PM
    5 responses
    28 views
    0 likes
    Last Post MisterTee  
    Started by llanqui, 01-25-2024, 06:15 PM
    9 responses
    65 views
    0 likes
    Last Post MisterTee  
    Started by tradingnasdaqprueba, 05-07-2024, 03:42 AM
    16 responses
    67 views
    0 likes
    Last Post tradingnasdaqprueba  
    Working...
    X