Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 Mizzouman1, Today, 07:35 AM
      4 responses
      18 views
      0 likes
      Last Post Mizzouman1  
      Started by philmg, Today, 01:17 PM
      1 response
      4 views
      0 likes
      Last Post NinjaTrader_ChristopherJ  
      Started by cre8able, Today, 01:01 PM
      1 response
      6 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by manitshah915, Today, 12:59 PM
      1 response
      3 views
      0 likes
      Last Post NinjaTrader_Erick  
      Started by ursavent, Today, 12:54 PM
      1 response
      4 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Working...
      X