• 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

Is correct to use this indicator in this way?

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

    Is correct to use this indicator in this way?

    hi...look my code .

    my indicator :

    Code:
    namespace NinjaTrader.NinjaScript.Indicators
    { 
    public class Xx
    { 
    private bool signal= (espression);
    }
    
    public class Class2 : Indicator
    {
    public List<Xx> MT;
    private Xx useClass; 
    }
    protected override void OnBarUpdate()
    {
    
    Xx tmp1 = new Xx();
    MT.Add(tmp1); 
    MT[MT.count-1].signal= //Logic espression 
    
    }
    In my indicator i build a logic to using a list of class

    In my strategy is correct to do this : (i want to enter signal by my Class2 Indicator)



    Code:
      
     public class  StStrategy: Strategy
     {
     .....
     protected override void OnStateChange()
     if (State == State.SetDefaults)
     {
             .............
     {
      else if (State == State.Configure)
     {
                    mt = Class2();
            }
     
    protected override void OnBarUpdate()
     {
         if (mt.MT[mt.MT.Count-1].Xx)
                    EnterLong();
                    ....
                    ....
            
      
      }
    The question is: is good to use

    Code:
      
     if (mt.MT[mt.MT.Count-1].Xx)
    to recall indicator or is better use DataSeries in indicator (in dataseries i copy the value of list in this )...e use Dataseries in strategy...

    i don't know if it's the same or not..help me..

    thank
    Last edited by esignal; 03-07-2016, 05:18 PM.

    #2
    Hello,

    I'm not entirely clear on your final question, but your code should work as expected if you set it up the way you have laid out. Keep in mind that Class2 would be using the same data series as the strategy in this case, if that makes any difference (I'm not sure how DataSeries comes into play in your question).
    Dave I.NinjaTrader Product Management

    Comment


      #3
      ok...but see that example :

      i apply indicator and strategy to chart

      in My indicator i write (in OnBarUpdate) :
      protected override void OnBarUpdate()
      {
      Print(MT.Count);
      }
      and i see :

      https://gyazo.com/222582c4fe38ab5a2b9a5ece0bc231b4

      Is correct !!

      but if i write in my esignal

      protected override void OnBarUpdate()
      {
      Print(mt.MT.Count);
      i see :

      https://gyazo.com/a17e66fd6f63997b53641240e269fce1

      it's not corret.

      it seems that does not make the update of indicator

      Comment


        #4
        Hello esignal,

        Thank you for your response.

        So you have scripts we could test this in?
        Patrick H.NinjaTrader Customer Service

        Comment


          #5
          okk..
          Now attached an example..
          The problem is the same..
          Attached Files

          Comment


            #6
            hi, are you understand this problem? or not?

            Comment


              #7
              esignal,

              Thank you for your patience.

              In your strategy you would change the following...
              Code:
              			else if (State == State.Configure)
              			{
                              gt = new forumIndicator();
              			}
              to...
              Code:
              			else if (State == State.Configure)
              			{
                              gt = forumIndicator();
              			}
              'new' instantiates the indicator without any loaded bars.
              Patrick H.NinjaTrader Customer Service

              Comment


                #8
                hi, i try it :

                https://gyazo.com/bc6aa67ebaa2db93c985a121e9ecb945

                but the result is the same

                https://gyazo.com/e3981b96fefb32cf621416da2ac60a33

                Comment


                  #9
                  Hello eSignal,

                  I did forget to mention the use of Update():
                  Code:
                  			gt.Update();
                              Print(gt.MT.Count);
                  Patrick H.NinjaTrader Customer Service

                  Comment


                    #10
                    Excuse me

                    http://ninjatrader.com/support/forum...ead.php?t=4991

                    Update() is a command of nt7?

                    Comment


                      #11
                      Thank you, but this is also available in NT 8: http://ninjatrader.com/support/helpG...-us/update.htm

                      Check out the ZigZag indicator in NinjaTrader 8 for example.
                      Patrick H.NinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by patpat, Today, 11:02 AM
                      0 responses
                      0 views
                      0 likes
                      Last Post patpat
                      by patpat
                       
                      Started by MrSomebody, Yesterday, 10:34 PM
                      1 response
                      13 views
                      0 likes
                      Last Post NinjaTrader_ShawnB  
                      Started by third monkey, Today, 06:33 AM
                      1 response
                      2 views
                      0 likes
                      Last Post NinjaTrader_ShawnB  
                      Started by mquinteroj, Yesterday, 07:21 PM
                      1 response
                      9 views
                      0 likes
                      Last Post bltdavid  
                      Started by catinabag, Today, 09:09 AM
                      1 response
                      5 views
                      0 likes
                      Last Post catinabag  
                      Working...
                      X