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 sjsj2732, Yesterday, 04:31 AM
      0 responses
      27 views
      0 likes
      Last Post sjsj2732  
      Started by NullPointStrategies, 03-13-2026, 05:17 AM
      0 responses
      283 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      280 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      131 views
      1 like
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      90 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Working...
      X