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

help

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

    help

    i did a strategy with the atm but for some type of reason this will but when is not suppose to

    this is the condition to buy
    // Set 1
    if ((Stochastics1.K[0] < 20)
    && (TSSuperTrend1.UpTrend[0] > 0)
    && (Stochastics1.K[0] > Stochastics1.K[1]))
    {
    CandleOutlineBrush = Brushes.DarkGreen;
    BarBrush = Brushes.DarkGreen;

    like you can see in the screenshot this buy when is not under 20

    #2
    Hello jhontorres,

    Thanks for your post.

    An action will be taken if the logic allows that action to be reached.

    If your strategy has taken an unexpected action or has not taken an expected action, debugging steps should be taken to reproduce the issue and analyze the strategy logic. You will want to use debugging prints in the strategy to see the values it is evaluating in its conditions instead of what is seen on the chart, because you will want to see why the strategy has taken the actions it has.

    You can use the Playback Connection to reproduce cases that happen with realtime data. I have also provided a video showing how debugging prints can be used in the Strategy Builder.

    Debugging Tips - https://ninjatrader.com/support/help...script_cod.htm

    TraceOrders - https://ninjatrader.com/support/help...aceorders2.htm

    Debugging in the Strategy Builder - https://drive.google.com/file/d/1mTq...w?usp=drivesdk

    Playback Connection - https://ninjatrader.com/support/help...connection.htm

    Debugging Demo - https://drive.google.com/file/d/1rOz...w?usp=drivesdk

    We look forward to assisting.
    JimNinjaTrader Customer Service

    Comment


      #3
      hello
      could anybody tell me what im doing wrong
      my code is not working how is suppose to








      //set 1
      if (CrossAbove(Close, ABCF123EMA1, 1))
      {
      atmStrategyIdl = GetAtmStrategyUniqueId();
      atmStrategyOrderIdl = GetAtmStrategyUniqueId();

      AtmStrategyCreate(OrderAction.Buy, OrderType.Market, 0, 0, TimeInForce.Day,
      atmStrategyOrderIdl, "es-long", atmStrategyIdl, (atmCallbackErrorCode, atmCallbackId) => {
      ///////////////////////////////////////////////////////////////////////////////////////////////////////////

      // checks that the call back is returned for the current atmStrategyId stored
      if (atmCallbackId == atmStrategyIdl)
      {
      // check the atm call back for any error codes
      if (atmCallbackErrorCode == Cbi.ErrorCode.NoError)
      {
      // if no error, set private bool to true to indicate the atm strategy is created
      isAtmStrategyCreatedl = true;
      }
      }
      });
      }

      if(isAtmStrategyCreatedl)
      {
      // atm logic
      }

      else if(!isAtmStrategyCreatedl)
      {
      // custom handling for a failed atm Strategy
      }


      ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


      //set 2
      if (CrossAbove(Close, ABCF123EMA1, 1))
      {
      atmStrategyIds = GetAtmStrategyUniqueId();
      atmStrategyOrderIds = GetAtmStrategyUniqueId();

      AtmStrategyCreate(OrderAction.Sell, OrderType.Market, 0, 0, TimeInForce.Day,
      atmStrategyOrderIds, "es-short", atmStrategyIds, (atmCallbackErrorCode, atmCallbackId) => {

      //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

      // checks that the call back is returned for the current atmStrategyId stored
      if (atmCallbackId == atmStrategyIds)
      {
      // check the atm call back for any error codes
      if (atmCallbackErrorCode == Cbi.ErrorCode.NoError)
      {
      // if no error, set private bool to true to indicate the atm strategy is created
      isAtmStrategyCreateds = true;
      }
      }
      });
      }

      if(isAtmStrategyCreateds)
      {
      // atm logic
      }

      else if(!isAtmStrategyCreateds)
      {
      // custom handling for a failed atm Strategy
      }
      }
      }
      }

      Comment


        #4
        Hello jhontorres,

        You will need to take debugging steps to understand why your strategy is not behaving as you expect.

        It will be very difficult for another person to give insight on what you have provided when the exact problems you are having are not detailed.

        I suggest first having a complete understanding of how the existing code example works before making modifications. From there, you will be able to break down your strategy to see what specific parts are working, and what other parts need to be checked.

        If you do not have a strong enough understanding of the code before making modifications, you may want to consider enlisting the services of a NinjaScript consultant from our EcoSystem to make your requested modifications for you.

        We look forward to assisting.
        JimNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by bortz, 11-06-2023, 08:04 AM
        47 responses
        1,602 views
        0 likes
        Last Post aligator  
        Started by jaybedreamin, Today, 05:56 PM
        0 responses
        8 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
        4 views
        0 likes
        Last Post Jon17
        by Jon17
         
        Started by Javierw.ok, Today, 04:12 PM
        0 responses
        12 views
        0 likes
        Last Post Javierw.ok  
        Working...
        X