Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Continued problems with setting trailing stop

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

    Continued problems with setting trailing stop


    Hi there, this is a continuation of issue SetTrailStop vs. SetStopLoss? - NinjaTrader Support Forum

    As you can see, I'm getting the error where both the upper and lower stop limits can not be set, indicating the market moved too far in-between the execution of both statements. However, I'm using a 100 tick profit/stop loss. Of course, I'm skeptical the market moved a hundred points in-between the microseconds the profit and stop loss targets were set. I'm using the sample SMA strategy.

    Your thoughts? Thanks,


    SetProfitTarget("MyLongTrade", CalculationMode.Ticks, 100, false);
    SetTrailStop("MyLongTrade", CalculationMode.Ticks, 100, false);
    SetProfitTarget("MyShortTrade", CalculationMode.Ticks, 100, false);
    SetTrailStop("MyShortTrade", CalculationMode.Ticks, 100, false);
    ​.....

    if (CrossAbove(smaFast, smaSlow, 1))
    EnterLong("MyLongTrade");
    else if (CrossBelow(smaFast, smaSlow, 1))
    EnterShort("MyShortTrade");​
    Attached Files
    Last edited by timmbbo; 08-04-2023, 10:21 PM.

    #2
    Hello timmbbo,

    May I confirm you are able to reproduce using the latest release of NinjaTrader 8.1.1.7?


    I've downloaded your .cs file and manually placed this in the Strategies folder and tested on the YM 09-23 5000 Volume bars in Playback with Market Replay data, but I was not able to reproduce the error testing on data from last friday.

    Below is a link to a video of the test.


    As a tip, to export a NinjaTrader 8 NinjaScript so this can be shared and imported by the recipient do the following:
    1. Click Tools -> Export -> NinjaScript Add-on...
    2. Click the 'add' link -> check the box(es) for the script(s) and reference(s) you want to include
    3. Click the 'Export' button
    4. Enter a unique name for the file in the value for 'File name:'
    5. Choose a save location -> click Save
    6. Click OK to clear the export location message
    By default your exported file will be in the following location:
    • (My) Documents/NinjaTrader 8/bin/Custom/ExportNinjaScript/<export_file_name.zip>
    Below is a link to the help guide on Exporting NinjaScripts.
    http://ninjatrader.com/support/helpG...-us/export.htm


    Is the specific date ​the only place you are able to reproduce the error, or can you reproduce with data from last friday / last week?

    Are there gaps in your market replay or historical data?
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    64 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    139 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    75 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    45 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    50 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X