Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

need help assigning values to my conditions. THX

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

    need help assigning values to my conditions. THX

    Basically, I want to assign to a value of 1 if XYZ are met, otherwise, value is 0. THis is to be used in Market Analyzer. I'm getting error messages.

    Here is my code:

    Code:
     protected override void OnBarUpdate()
            {
                if (CurrentBar<3)
                    return;
                
                if (((Close[1] < Close[2] && Open[1] <= Open [2] && High[0] > High[1]) || (Close[1] > Close[2] && Open[1] >= Open[2] && Low[0] < Low[1])) && Volume[0] > Volume[1]*.90)
    
                {
                    Plot0.Set[1];
                    Values[0].Set(Volume[0]);
                    Values[1].Reset();
                    {PlaySound(soundFile);}
                }
                else
                {
                    Plot0.Set[0];
                    Values[1].Set(Volume[0]);
                    Values[0].Reset();
                }
            }

    #2
    Hi Wxtrox7,

    What are the error messages that you are receiving?

    Take a look in the Log Tab in the Control Center, do you see errors?

    Are they popping up when you try to run it in the market analyzer or when compiling in the Script Editor?

    I look forward to your response.
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by wxtrox7 View Post
      Basically, I want to assign to a value of 1 if XYZ are met, otherwise, value is 0. THis is to be used in Market Analyzer. I'm getting error messages.

      Here is my code:

      Code:
       
       protected override void OnBarUpdate()
              {
                  if (CurrentBar<3)
                      return;
       
                  if (((Close[1] < Close[2] && Open[1] <= Open [2] && High[0] > High[1]) || (Close[1] > Close[2] && Open[1] >= Open[2] && Low[0] < Low[1])) && Volume[0] > Volume[1]*.90)
       
                  {
                      Plot0.Set[1];
                      Values[0].Set(Volume[0]);
                      Values[1].Reset();
                      {PlaySound(soundFile);}
                  }
                  else
                  {
                      Plot0.Set[0];
                      Values[1].Set(Volume[0]);
                      Values[0].Reset();
                  }
              }
      1. Plot0.Set[1] means nothing, because that is not the syntax for the Set() statement.
      2. Have you defined 2 Plots? If not, then what are you trying to achieve by using the Values array?

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      558 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      324 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
      545 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      547 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X