Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to write a time period in wizard?

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

    #16
    There are several coding errors I see at first glance. You will always see error messages at the bottom of the NinjaScript Editor that you can double click on that will take you to the location of the error. Sometimes these error message are cryptic....I do understand this.

    Its good to see you are making a good effort to learn this stuff. I would take a look on the internet for some begginer C# tutorials or even a book. Some of the errors you made are programming syntax errors. Unfortunately we can not provide this level of support. I can provide a correction on part of your code below.

    if (Position.MarketPosition != MarketPosition.Flat && Position.GetProfitLoss(Close[0], PerformanceUnit.Points) >= 4)
    {
    // Do something here
    }
    RayNinjaTrader Customer Service

    Comment


      #17
      Only the Trigger1 works

      Dear Ray,
      I couldn't make this work, Only the Trigger1 works, the Trigger never has any action, could you please have a look,

      // Condition set 3 B1

      if (((Position.GetProfitLoss(Close[0], PerformanceUnit.Points)) >= Triger1)
      &&((Position.GetProfitLoss(Close[0], PerformanceUnit.Points)) < Triger2))

      {

      Print(("Stop is ").ToString());
      SetTrailStop("",CalculationMode.Ticks, B1, false);
      }
      // Condition set 4 B2

      Print(("STOP IS" ).ToString());

      if ((Position.GetProfitLoss(Close[0], PerformanceUnit.Points)) > Triger2)
      {

      Print(("Stop is " ).ToString());

      SetTrailStop("",CalculationMode.Ticks, B2, false);

      }
      Last edited by Jenny; 06-15-2007, 08:17 PM.

      Comment


        #18
        Hi Jenny,

        Welcome to the wonderful world of debugging. I would add Print() statements tracing out information at each level. Then from this information you can get an idea what is wrong with your logic.
        RayNinjaTrader Customer Service

        Comment


          #19
          Hi,Ray,

          I did add this statment, but nothing has been printed out,

          Print(Position.GetProfitLoss(Close[0], PerformanceUnit.Points).ToString())

          I don't know why, can you tell?

          Thanks
          Last edited by Jenny; 06-17-2007, 07:56 PM.

          Comment


            #20
            If nothing is printed out then likely this code is not called. Syntax looks fine.
            RayNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            571 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            330 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            101 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            549 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            549 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X