Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Range Scanning by Stochastic

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

    Range Scanning by Stochastic

    Dear Support:

    I want to scan out all the stocks by using Stochastic in Market Analyzer:
    1) Range below 20;
    2) Range above 80

    Can anyone provide me the code for this setting or teach me how to do it ?
    Thank you for your help.

    #2
    Hello William Lye,

    You can setup filter conditions to filter out rows. Please see the link below for instructions to setup filter conditions.


    Once you added an Indicator column in the Market Analyzer and select the Stochatics, please set Plot to D or K. Subsequently setup two filter conditions for "below 20" and " above 80".
    JasonNinjaTrader Customer Service

    Comment


      #3
      Thank you so much for your prompt reply. I likely get it done.

      Btw, i have other question:

      I would like to set other scanner as below:

      Within 5 days:
      1) Current price > EMA 80
      2) Current price > EMA 200
      3) Current price > EMA 380
      Can i consider current closing price as EMA 1 ?

      Need your guide again to set the above conditions.
      Thank you.

      Comment


        #4
        Unfortunately these conditions cannot be setup using the filter conditions. You would need to create a custom indicator that will compare such prices.

        Creating custom indicators
        JasonNinjaTrader Customer Service

        Comment


          #5
          Dear Jason:

          Thank you for your reply.
          I had tried it out many times but seems cannot be done.

          Is it possible you can help to set it up for me ? I can learn from there...

          Your help is greatly appreciated.

          Comment


            #6
            Dear Support:

            Hope to hear from you soon.

            Regards,
            William

            Comment


              #7
              Hello William Lye,

              Please note that we do not provide programming services.

              However, just to clarify, are you wishing for the indicator to check if the current price of an instrument was greater than the EMA line within the past 5 days?

              What you could do is obtain the DateTime of 5 days ago by utilizing Time[0].AddDays(-5). This returns the time from five days in the past.

              With this information, you will want to get the bar number of this bar. This can be done by utilizing GetBar().

              Now, with this information, you can utilize a for loop to check if any period has been above the EMA line.

              Here's a simple example:
              Code:
              DateTime fiveDaysAgo = Time[0].AddDays(-5); // obtain the DateTime from 5 days ago
              int bar = Bars.GetBar(fiveDaysAgo); // creates and sets the bar variable to the index of the bar from 5 days ago
              
              for (int i = bar; i < CurrentBar; i++)
              {
                   int barsAgo = CurrentBar - i; // creates and sets the barsAgo variable to CurrentBar - i
                   bool flag = false; // keeps track if the condition becomes true
              
                   if (Close[barsAgo] > EMA(80)[barsAgo]) // if Close[barsAgo] > EMA(80)[barsAgo], set flag to true
                        flag = true;
              
                   if (flag) // if the flag is true, this would mean the condition above was true at least once. Set the indicator plot to 1 if true, 0 if not.
                        Value.Set(1);
                   else
                        Value.Set(0);
              }
              To filter out instruments that do not meet this criteria, you'll want to set a filter condition for "below 1" in your Market Analyzer.

              Please, let us know if we may be of further assistance.
              Zachary G.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by algospoke, 04-17-2024, 06:40 PM
              6 responses
              49 views
              0 likes
              Last Post algospoke  
              Started by arvidvanstaey, Today, 02:19 PM
              4 responses
              11 views
              0 likes
              Last Post arvidvanstaey  
              Started by samish18, 04-17-2024, 08:57 AM
              16 responses
              61 views
              0 likes
              Last Post samish18  
              Started by jordanq2, Today, 03:10 PM
              2 responses
              9 views
              0 likes
              Last Post jordanq2  
              Started by traderqz, Today, 12:06 AM
              10 responses
              21 views
              0 likes
              Last Post traderqz  
              Working...
              X