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 Hwop38, 05-04-2026, 07:02 PM
      0 responses
      160 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      308 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      245 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      349 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      179 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Working...
      X