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 CarlTrading, 03-31-2026, 09:41 PM
            1 response
            67 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            36 views
            0 likes
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            60 views
            1 like
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            62 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            53 views
            0 likes
            Last Post CarlTrading  
            Working...
            X