• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Cell conditions - value

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

    Cell conditions - value

    Hello,

    the market-Analyzer works in cell-conditions with fixed numbers very well.

    I would like to visual a cellcondition (backcolor) if the Stochastic
    D-line and K-line are crossing. But the value as a Indicator in cellcondition
    is not supported.

    I know that works as Strategie-Alert, but I would like to work with cell-colors
    in Market-Analyzer, so I have to read less alerts and the colors show me the news.

    How can I do it?





    for reply many thanks...

    #2
    Hi chartvisor,

    The a cross of two indicators or dataseries cannot be detected with the Market Analyzer cell conditions directly. Instead you can create a simple custom coded indicator that detects the cross and plots a value that you can use for your cell conditions.

    If series1 is crossing above series2 plot 1. If series1 is crossing below series2 plot -1. If there is no cross happening plot 0.

    Attached is a sample.
    Attached Files
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello, Chelsea B.

      thank you for your reply and the zip-file,
      If I try to import the zip-file, I have a errormessage with following informations

      Import failed C: User admin Documets NinjaTrader bin Custom CrossDetectionForMarketAnalyzerExampel.zip is likely corrupt an cant be imported

      I suspect differences to automatically import path
      Can you tell me in which directories the files
      to be inserted, then I can do that manually.

      that would be great

      thank you :-)

      Comment


        #4
        Hi chartvisor,

        You are correct. That was my mistake (I put a space in the path of the template I included).

        Attached is the corrected file.

        The paths to import manually are:

        (My) Documents\NinjaTrader 7\bin\Custom\Indicator
        (My) Documents\NinjaTrader 7\templates\MarketAnalyzer
        Attached Files
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi Chelsea,

          thank you very much for the new zip-file.
          I imported this file succesfull. Now in the Market Analyzer column is value 0,0000.
          How can I visual the the crossing with D-line and K-line in the stochastic.

          I suspect the Stochastic is the first Indicator how must select and CrossDetection Indicator is
          Input series. Hm. I don´t know.

          Is there somewhere a small description of the parameters.
          I can read. It would be very helpfull. Sorry, in the first time it is a little bit difficult for me.
          But I am an optimist.

          Thank you for your help,

          Comment


            #6
            Hi chartvisor,

            The sample that I have provided does not use the Stochastics. The sample uses the SMA. When the SMA(7) crosses above the SMA(15) the indicator will plot 1. When the SMA(7) crosses below the SMA(15) the indicator plots -1. When there is no cross it plots 0.

            This is meant to be an example for you to create your own indicator with your logic.

            To visualize this on a chart, add the SMA with a period of 7 and an SMA with a period of 15. Anytime there is a cross on the chart the Market Analyzer column will show 1.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hi Chelsea,

              Yes, now I understand. Thank you, I will try it tomorrow.

              Bye :-)

              Comment


                #8
                Hi Chelsea,

                I have edit your Script. I hope it runs correctly. The historical data chart draw it correct, but on the weekend, we have no data :-)

                When programming C #, I noticed that operators <=, >=, == are not allowed.
                And && and || makes problems too, if I want to compare indicators.

                Microsoft library - it must work. Is that a different to compare indicators? Hm what can I do?

                I add the source code here.
                -----------------------------------------------------------------------------------------------------

                protected override void OnBarUpdate()

                {

                // if ((Stochastics(6,22,6).K >= 70) || (Stochastics(6,22,6).K <= 30)); // >>>>>>>>>> Operator not allowed ?
                // {
                //if (CrossAbove(SMA(7), SMA(15), 1))
                //else if (CrossBelow(SMA(7), SMA(15), 1))


                if (CrossAbove(Stochastics(6,22,6).K, Stochastics(6,22,6).D, 1))
                Value.Set(1);

                else if (CrossBelow(Stochastics(6,22,6).K, Stochastics(6,22,6).D, 1))
                Value.Set(-1);

                else
                Value.Set(0);
                // }
                }
                ---------------------------------------------------------------------------------

                How can I use the operators ==, <=, >=, &&, || ?

                for reply many thanks...

                nice weekend :-)

                Comment


                  #9
                  Originally posted by chartvisor View Post
                  Hi Chelsea,

                  I have edit your Script. I hope it runs correctly. The historical data chart draw it correct, but on the weekend, we have no data :-)

                  When programming C #, I noticed that operators <=, >=, == are not allowed.
                  And && and || makes problems too, if I want to compare indicators.

                  Microsoft library - it must work. Is that a different to compare indicators? Hm what can I do?

                  I add the source code here.
                  -----------------------------------------------------------------------------------------------------

                  protected override void OnBarUpdate()

                  {

                  // if ((Stochastics(6,22,6).K >= 70) || (Stochastics(6,22,6).K <= 30)); // >>>>>>>>>> Operator not allowed ?
                  // {
                  //if (CrossAbove(SMA(7), SMA(15), 1))
                  //else if (CrossBelow(SMA(7), SMA(15), 1))


                  if (CrossAbove(Stochastics(6,22,6).K, Stochastics(6,22,6).D, 1))
                  Value.Set(1);

                  else if (CrossBelow(Stochastics(6,22,6).K, Stochastics(6,22,6).D, 1))
                  Value.Set(-1);

                  else
                  Value.Set(0);
                  // }
                  }
                  ---------------------------------------------------------------------------------

                  How can I use the operators ==, <=, >=, &&, || ?

                  for reply many thanks...

                  nice weekend :-)
                  Hello ChartVisor,

                  The logical operators are certainly allowed however in your code as written Ninja thinks you are trying to do a logical operation on entire data set and that is not permitted. For your logical operation to work you need to supply specific data points. Here is what it would look like if you were wanting to evaluate the current bar

                  if ((Stochastics(6,22,6).K[0] >= 70) || (Stochastics(6,22,6).K[0] <= 30));

                  Hope this helps, have a great weekend!

                  Comment


                    #10
                    Hello Tasker-182,

                    thank you for your reply,

                    I've tested your change [0] - The compiler has fully compiled no error message. :-)




                    But the first if statement does not work - It is ignored.

                    So I declared var as double Kmax 70 and Kmin 30 I hope thats a Problem with Int and double
                    It is ignored too.

                    Next; I set (Value.Set(2)
                    Now the Columns in Market Analyser - value 2 in all Rows.



                    The Quellcode:

                    protected override void OnBarUpdate()

                    {
                    double Kmax = 70;
                    double Kmin = 30;

                    if ((Stochastics(6,22,6).K[0] >= Kmax) || (Stochastics(6,22,6).K[0] <= Kmin));


                    {

                    if (CrossAbove(Stochastics(6,22,6).K, Stochastics(6,22,6).D, 1))
                    Value.Set(1);

                    else if (CrossBelow(Stochastics(6,22,6).K, Stochastics(6,22,6).D, 1))
                    Value.Set(-1);

                    else
                    Value.Set(0);
                    }
                    Value.Set(2);
                    }


                    I don´t know?

                    for reply many thanks.

                    Comment


                      #11
                      I could help you better if you could upload your indicator.

                      Comment


                        #12
                        How can I do it here? I am new in NinjaTrader Forum - Sorry

                        Comment


                          #13
                          Originally posted by chartvisor View Post
                          How can I do it here? I am new in NinjaTrader Forum - Sorry
                          First, in Ninja, compile your indicator, then in Ninja, use File>Utilities>Export NinjaScript to automatically create a zipped file. The exported zipped file will by default be found in:MyDocuments>Ninja7>BIN>Custom>ExportNinjaScript .

                          Next reply to this thread as you have in the past except this time scroll down in the reply window until you see "manage Attachments". From there you choose file and importantly after you have chosen the file you must press upload.

                          Comment


                            #14
                            Example

                            Thank you very much - here it is

                            I have uploaded the file - CrossDetectionExample.zip
                            Attached Files

                            Comment


                              #15
                              Originally posted by chartvisor View Post
                              Thank you very much - here it is

                              I have uploaded the file - CrossDetectionExample.zip
                              Well done, I'll look at it now.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by williamzz, Today, 09:50 PM
                              0 responses
                              1 view
                              0 likes
                              Last Post williamzz  
                              Started by Steve L, Today, 05:01 PM
                              0 responses
                              6 views
                              0 likes
                              Last Post Steve L
                              by Steve L
                               
                              Started by Trader-Joe, Today, 04:06 PM
                              1 response
                              14 views
                              0 likes
                              Last Post NinjaTrader_ShawnB  
                              Started by vantojo, Today, 04:06 PM
                              0 responses
                              5 views
                              0 likes
                              Last Post vantojo
                              by vantojo
                               
                              Started by tonynt, Today, 02:39 PM
                              2 responses
                              13 views
                              0 likes
                              Last Post tonynt
                              by tonynt
                               
                              Working...
                              X