Announcement

Collapse
No announcement yet.

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 WHICKED, Today, 09:05 PM
        0 responses
        9 views
        0 likes
        Last Post WHICKED
        by WHICKED
         
        Started by luislag14, Today, 06:29 PM
        0 responses
        8 views
        0 likes
        Last Post luislag14  
        Started by Protech, Today, 11:08 AM
        1 response
        23 views
        0 likes
        Last Post NinjaTrader_ChrisL  
        Started by guilhem, Today, 02:09 PM
        1 response
        24 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by Hyper, Today, 12:20 PM
        1 response
        23 views
        0 likes
        Last Post NinjaTrader_Jim  
        Working...
        X