Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Daily and Weekly stop loss function

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

  • NinjaTrader_PatrickH
    replied
    Hello CelticTiger,

    Thank you for your response.

    We appreciate your additional comments on this item. At this time we would not have a beta version for testing.

    Leave a comment:


  • CelticTiger
    replied
    Hello Patrick, Thank you for taking this back and putting it into development, that is great news! I think this feature can attract more people to trade via Ninja Trader, for the time being, I am subscribing to Sierra Charts to get this 1st line of defense established protecting my capital and have my Ninja Charts just running for viewing charts. I am volunteering to be a beta tester for this feature if possible?

    It would be awesome to have this function be a once set you can not change it for that day function, for example, you set it to 500 USD Daily loss limit then you apply it and until the session is over you can not change the limit anymore and only continue trading SIM or you can choose to leave it as maintainable- same with the weekly jut there from weekend to weekend. That way folks can decide how much control they need to protect them from emotional days.

    Regards,
    Peter
    Last edited by CelticTiger; 10-19-2018, 10:56 AM.

    Leave a comment:


  • NinjaTrader_PatrickH
    replied
    Hello CelticTiger,

    Thank you for your patience.

    The internal tracking id for your request has been assigned the id SFT-2936.

    When a feature request is implemented, you'll find it in the release notes: http://ninjatrader.com/support/helpG...ease_notes.htm

    Please let me know if you have any questions.

    Leave a comment:


  • NinjaTrader_ChristopherS
    replied

    Hello CelticTiger ,

    You can search our extensive library of NinjaScript consultants through the link below. Simply enter a consultant name or search by using our filter categories. Once you have identified your consultants of choice, please visit each consultant's site for more information or contact them directly to learn more:
    You can locate the contact information for the consultants on their direct websites for any additional questions you may have. Since these consultants are third-party services for NinjaTrader, all pricing and support information will need to be obtained through the consultant.

    This NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The companies and services listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem, LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.

    Leave a comment:


  • CelticTiger
    replied
    Thank you, I hope I can get this implemented in the DNA of NT8 so that it works well. There will be more and more experienced traders asking for this, especially if they look at their Daily P&L curve and find out that they would already be profitable if only the few disaster Days are kept under control...

    Leave a comment:


  • NinjaTrader_PatrickH
    replied
    Hello CelticTiger,

    Thank you for your response.

    I will have our affiliate NinjaTrader Ecosystem follow up with the list of NinjaScript Consultants.

    If you do have an add on built for NinjaTrader 8 it should function in NinjaTrader 8 through iterations. There are only code breaking changes between major changes of the platform such as from NinjaTrader 6.5 to NinjaTrader 7 and NinjaTrader 7 to NinjaTrader 8.

    I can forward your request to our development team for potential implementation in a future release of NinjaTrader.

    Leave a comment:


  • CelticTiger
    replied
    Hi Patrick, Thank you for your answer. Yes please send me a list with consultants. Now if I get this programme and integrated so that the account is prevented from initiating new trades, what happens when you release the next update, will the code need to be updated?

    Are there no plans to release a function like this with Ninjatrader 8? Dependant on the costs I might have no other choice other than going with Sierra, very disappointing if that is the case, I am not sure why this is not an out of the box feature? Regards, Peter

    Leave a comment:


  • NinjaTrader_PatrickH
    replied
    Hello CelticTiger,

    Thank you for your post.

    Such a project would likely be best made as an Add On so that not only would it not disable like a strategy but also that it could watch all account position, execution, and order events as needed.

    We don't provide programming services but I can help you get started on this project.

    Please refer to the following links for details on the items you will need to begin this project:
    If you would like to seek a third party to develop such an item for you I can have our affiliate NinjaTrader Ecosystem follow up with a list of NinjaScript Consultants.

    Please let me know if you have any questions.

    Leave a comment:


  • CelticTiger
    started a topic Daily and Weekly stop loss function

    Daily and Weekly stop loss function

    I urgently need a built-in Daily loss limit function, Sierra Chart has this but I want to stay with Ninja Trader!
    I am searching for instructions on how I could best tweak the sample P&L script below to do the following. Once applied to any chart it should:

    1. Close all positions immediately and prevent any new positions to be opened for that particular day if x USD loss limit is reached
    2. Trailing loss limit, If in profit the same loss distance should follow for example if I set the Daily loss limit to -500 USD and I am 1000ahead and give back 500 USD it should close all positions immediately and prevent any new positions to be opened for that particular day
    3. A weekly trailing loss limit same as 1 and 2 but will prevent any new trades for that particular week
    4. Once the strategy is set it should always work and cannot be disabled until it is a weekend

    Please share what I need to add or change to the script below to reach this specification:

    //
    // Copyright (C) 2015, NinjaTrader LLC <www.ninjatrader.com>.
    // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
    //
    #region Using declarations
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Xml.Serialization;
    using NinjaTrader.Cbi;
    using NinjaTrader.Gui;
    using NinjaTrader.Gui.Chart;
    using NinjaTrader.Gui.SuperDom;
    using NinjaTrader.Data;
    using NinjaTrader.NinjaScript;
    using NinjaTrader.Core.FloatingPoint;
    using NinjaTrader.NinjaScript.Indicators;
    using NinjaTrader.NinjaScript.DrawingTools;
    #endregion

    // This namespace holds all strategies and is required. Do not change it.
    namespace NinjaTrader.NinjaScript.Strategies
    {
    public class SamplePnL : Strategy
    {
    private int priorTradesCount = 0;
    private double priorTradesCumProfit = 0;

    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = @"Using trade performance statistics for money management";
    Name = "Sample PnL";
    Calculate = Calculate.OnBarClose;
    EntriesPerDirection = 2;
    EntryHandling = EntryHandling.AllEntries;
    IsExitOnSessionCloseStrategy = true;
    ExitOnSessionCloseSeconds = 30;
    IsFillLimitOnTouch = false;
    MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
    OrderFillResolution = OrderFillResolution.Standard;
    Slippage = 0;
    StartBehavior = StartBehavior.WaitUntilFlat;
    TimeInForce = TimeInForce.Gtc;
    TraceOrders = false;
    RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
    StopTargetHandling = StopTargetHandling.PerEntryExecution;
    BarsRequiredToTrade = 5;
    }

    }

    protected override void OnBarUpdate()
    {
    if (CurrentBar < BarsRequiredToTrade) return;
    // At the start of a new session
    if (Bars.IsFirstBarOfSession)
    {
    // Store the strategy's prior cumulated realized profit and number of trades
    priorTradesCount = SystemPerformance.AllTrades.Count;
    priorTradesCumProfit = SystemPerformance.AllTrades.TradesPerformance.Curr ency.CumProfit;

    /* NOTE: Using .AllTrades will include both historical virtual trades as well as real-time trades.
    If you want to only count profits from real-time trades please use .RealtimeTrades. */
    }

    /* Prevents further trading if the current session's realized profit exceeds $1000 or if realized losses exceed $400.
    Also prevent trading if 10 trades have already been made in this session. */
    if (SystemPerformance.AllTrades.TradesPerformance.Cur rency.CumProfit - priorTradesCumProfit >= 1000
    || SystemPerformance.AllTrades.TradesPerformance.Curr ency.CumProfit - priorTradesCumProfit <= -450
    || SystemPerformance.AllTrades.Count - priorTradesCount > 15)
    {
    /* TIP FOR EXPERIENCED CODERS: This only prevents trade logic in the context of the OnBarUpdate() method. If you are utilizing
    other methods like OnOrderUpdate() or OnMarketData() you will need to insert this code segment there as well. */

    // Returns out of the OnBarUpdate() method. This prevents any further evaluation of trade logic in the OnBarUpdate() method.
    return;
    }
    }
    }
    }

Latest Posts

Collapse

Topics Statistics Last Post
Started by jaybedreamin, Today, 05:56 PM
0 responses
2 views
0 likes
Last Post jaybedreamin  
Started by DJ888, 04-16-2024, 06:09 PM
6 responses
18 views
0 likes
Last Post DJ888
by DJ888
 
Started by Jon17, Today, 04:33 PM
0 responses
1 view
0 likes
Last Post Jon17
by Jon17
 
Started by Javierw.ok, Today, 04:12 PM
0 responses
6 views
0 likes
Last Post Javierw.ok  
Started by timmbbo, Today, 08:59 AM
2 responses
10 views
0 likes
Last Post bltdavid  
Working...
X