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

trying to check for multiple conditions

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

    trying to check for multiple conditions

    i'm trying to check for a value upVolume or downVolume being greater than an Average as well as the candle color having been changed by a third party locked indicator...

    when the third party indicator gives a signal it changes the candle color to Gold...

    i want to run this:

    if (upVolume[1] !=0 && upVolume[1] >= Average[1] && BarColorSeries[1] = Color.Gold )
    { DrawDot........... }

    but i'm erroring on the && operator comparing bool and System.Drawing.Color
    i guess i need to convert the BarColorSeries check to an integer ????
    what should i do ? (i'm not much of a coder...)

    thanks,
    wes

    #2
    Hello Wes,

    Thank you for your post.

    This portion right here -
    Code:
    BarColorSeries[1] = Color.Gold
    You would need to use == for the equal to check.
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      thanks for getting back Cal,
      that compiled ok but it's still not plotting the Dot
      any suggestions ? there are no other bar color changing indicators running with this other than the locked indicator that changes the bar colors...

      just to make sure...
      in the indicator setup dialog box under the "Display" heading
      are the choices:
      AmColor
      BearishColor
      BullishColor
      ProColor

      only the AmColor and ProColor selections will change the candle color but not its outline
      i've selected Gold for ProColor

      not sure how the ProColor Parameter is treated to make it show in the setup box, i would think they'd have to have made it public right?
      if so, would there be a way to call it directly ?

      thanks,
      w
      Last edited by stafe; 08-06-2014, 11:16 AM.

      Comment


        #4
        Wes,

        I would test with taking out the other condition checks for the Color.Gold and see if it is detecting that change.

        This will let you know if it is the color call or the other conditions not becoming true.
        Cal H.NinjaTrader Customer Service

        Comment


          #5
          thanks Cal, i already have a version of the indicator running that uses the first two condistions and is plotting the signal dot fine - i'm looking for a second signal dot when the BarColorSeries[1] is also Gold



          how can i print the BarSeriesColor of the chart to see what color is in the BarSeriesColor position [1] ?

          thanks,
          w
          Last edited by stafe; 08-07-2014, 10:47 AM.

          Comment


            #6
            Hello Wes,

            Thank you for your response.

            Correct me if I am wrong here, but you are looking for the color change from a protected third party indicator, correct?

            Comment


              #7
              ok, i added some Print commands to try to debug this issue
              and the Output window is showing
              BarColorSeries[1]=Color [Empty]
              for each bar - even though some are colored

              How could the program change the bar color and it come up empty in BarColorSeries ?

              yes, a third party indicator that is in .dll form


              if (FirstTickOfBar)
              {
              // This plots the signal dots just fine //
              if (upVolume[1] != 0 && upVolume[1] >= Average[1])
              {DrawDot ("GTABV"+CurrentBar, false, 1, upVolume[1]/2, Color.LightGreen);}

              if (downVolume[1] != 0 && downVolume[1] >= Average[1])
              {DrawDot ("GTASV"+CurrentBar, false, 1, downVolume[1]/2, Color.FromArgb(255,90,255));}



              // this does not plot signal dots //
              if (upVolume[1] != 0 && upVolume[1] >= Average[1] && (BarColorSeries[1] == Color.Gold))
              {DrawDot ("GTABVpro"+CurrentBar, false, 1, 0, Color.Cyan);}

              if (downVolume[1] != 0 && downVolume[1] >= Average[1] && (BarColorSeries[1] == Color.Gold))
              {DrawDot ("GTASVpro"+CurrentBar, false, 1, 0, Color.Cyan);}



              if (CurrentBar < 5) return;
              {
              Print ("BarColorSeries[1]="+ BarColorSeries[1]);
              Print ("BarColorSeries[1] closed at" + Time[1]);
              Print (" ");
              }
              }
              Last edited by stafe; 08-07-2014, 12:05 PM.

              Comment


                #8
                Hello Wes,

                Thank you for your response.

                Are you setting BarColorSeries in your code? If not, it is going to be blank. You cannot access another indicators BarColorSeries unless it is an exposed series or variable from that indicator. If you want to know when a color change occurs you will need to know what conditions cause the color change and emulate them in your own code.

                Please let me know if I may be of further assistance.

                Comment


                  #9
                  oh, i think i'm beginning to understand - the BarColorSeries is just for that indicator - not for the "bars on the chart" ?

                  is there any way to look at the bar color on the chart and detect it ?

                  Comment


                    #10
                    Hello Wes,

                    Thank you for your response.

                    Unfortuantely, there is no supported method of pulling the color from the chart itself.

                    Comment


                      #11
                      are there any unsupported methods that you or your friends might be aware of ?
                      thanks,
                      w

                      Comment


                        #12
                        Originally posted by stafe View Post
                        ok, i added some Print commands to try to debug this issue
                        and the Output window is showing
                        BarColorSeries[1]=Color [Empty]
                        for each bar - even though some are colored

                        How could the program change the bar color and it come up empty in BarColorSeries ?

                        yes, a third party indicator that is in .dll form


                        if (FirstTickOfBar)
                        {
                        // This plots the signal dots just fine //
                        if (upVolume[1] != 0 && upVolume[1] >= Average[1])
                        {DrawDot ("GTABV"+CurrentBar, false, 1, upVolume[1]/2, Color.LightGreen);}

                        if (downVolume[1] != 0 && downVolume[1] >= Average[1])
                        {DrawDot ("GTASV"+CurrentBar, false, 1, downVolume[1]/2, Color.FromArgb(255,90,255));}



                        // this does not plot signal dots //
                        if (upVolume[1] != 0 && upVolume[1] >= Average[1] && (BarColorSeries[1] == Color.Gold))
                        {DrawDot ("GTABVpro"+CurrentBar, false, 1, 0, Color.Cyan);}

                        if (downVolume[1] != 0 && downVolume[1] >= Average[1] && (BarColorSeries[1] == Color.Gold))
                        {DrawDot ("GTASVpro"+CurrentBar, false, 1, 0, Color.Cyan);}



                        if (CurrentBar < 5) return;
                        {
                        Print ("BarColorSeries[1]="+ BarColorSeries[1]);
                        Print ("BarColorSeries[1] closed at" + Time[1]);
                        Print (" ");
                        }
                        }
                        If you want to access bar properties independent of indicators, you should probably be using the unsupported ChartControl.BarColorSeries.

                        Comment


                          #13
                          thanks for the reply koganam, it took me a while to get back to this project...

                          i inserted the ChartControl. in front of BarColorSeries and i'm still not getting any results
                          i also tried a Print command to print the ChartControl.BarColorSeries[1] to the output window and it still shows [Empty]

                          maybe i'm implementing the command incorrectly - i wouldn't know
                          does it need any kind of initialization or mention in the indicator declarations ?

                          thanks again,
                          you've definitely pulled me out of a spot in the past and i'm very thankful
                          /w

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by Irukandji, Today, 04:58 AM
                          0 responses
                          2 views
                          0 likes
                          Last Post Irukandji  
                          Started by fitspressoburnfat, Today, 04:25 AM
                          0 responses
                          2 views
                          0 likes
                          Last Post fitspressoburnfat  
                          Started by Skifree, Today, 03:41 AM
                          1 response
                          4 views
                          0 likes
                          Last Post Skifree
                          by Skifree
                           
                          Started by usazencort, Today, 01:16 AM
                          0 responses
                          1 view
                          0 likes
                          Last Post usazencort  
                          Started by kaywai, 09-01-2023, 08:44 PM
                          5 responses
                          604 views
                          0 likes
                          Last Post NinjaTrader_Jason  
                          Working...
                          X