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

MQL to NinjaScript translation request: StepMA 7.1

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

    MQL to NinjaScript translation request: StepMA 7.1

    This is a really amazing and unique moving average created by Igorad from the Trend Laboratory and Forex-TSD forums.

    I find it extremely useful because it has very low lag when the market is trending but is 100% flat when the market is ranging. I like it even better than the JurikJMA.

    Here is the code if anyone is able to translate it. I'm sure many people would find it useful...

    Attached Files
    Last edited by Elliott Wave; 08-21-2008, 06:18 PM.

    #2
    ThanX a lot for the converting !
    max-td

    LOL - i was to fast - it isnt converted yet
    its a request for translation ... well - maybe time for a break
    Last edited by max-td; 09-11-2008, 05:02 AM.

    Comment


      #3
      Hey Elliott,

      Can you post a screen shot of it as well please?
      mrlogik
      NinjaTrader Ecosystem Vendor - Purelogik Trading

      Comment


        #4
        The screen shot should be there in the first post. Its the light blue 'stepped' line below the green price line...

        There is a similar indicator created by the same person in the file sharing section called 'Non Lag Moving Average'



        The really unique features are the filter and split tick, which you really need to play around with to see how powerful they are in my opinion.

        Comment


          #5
          Originally posted by Elliott Wave View Post
          The screen shot should be there in the first post. Its the light blue 'stepped' line below the green price line...

          There is a similar indicator created by the same person in the file sharing section called 'Non Lag Moving Average'



          The really unique features are the filter and split tick, which you really need to play around with to see how powerful they are in my opinion.
          Hi Elliott Wave,

          I've played around with the 'Non Lag Moving Average' Indicator too.

          I was investigating its use of math functions in its calculations.

          I love the way it can straight line ranging markets.

          I located a couple of programming guides for mq4 metatrader online.

          Learning this language is on the long "to do list". Ugh!!!

          RJay
          RJay
          NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

          Comment


            #6
            Attached is my first crack at it.

            Take a look and please give me feedback.

            I also posted this code in the File Sharing Section in BETA form.

            thanks.

            Updates 1.
            Changed MA_Mode to only allow SMA or WMA

            Updates 2.
            Allow kV input minimum value to be 0
            Allow Percentage input to be positive or negative
            Attached Files
            Last edited by mrlogik; 09-14-2008, 09:56 PM.
            mrlogik
            NinjaTrader Ecosystem Vendor - Purelogik Trading

            Comment


              #7
              This is looking really good! Thank you so much for your conversion. The logik seems right to me

              When I get home I'll test it more thoroughly and add some additional filter/MA types (T3, Ehler's filter etc). I'm really interested how this will work as the JurikJMA as the MAType rather than SMA...

              Comment


                #8
                Is there some docs somewhere that explains the parameters and how to use them together?

                Thanks

                Comment


                  #9
                  I dont have any documentation for it.

                  Elliott, do you?

                  Also, I don't think the percentage input works correctly. It seems to bias up vs down trends. This is also a problem in the code originally converted from MT to NT. I will post updates as I make corrections.
                  mrlogik
                  NinjaTrader Ecosystem Vendor - Purelogik Trading

                  Comment


                    #10
                    Originally posted by mrlogik View Post
                    I dont have any documentation for it.

                    Elliott, do you?

                    Also, I don't think the percentage input works correctly. It seems to bias up vs down trends. This is also a problem in the code originally converted from MT to NT. I will post updates as I make corrections.
                    I can take a look, but I think the only public info would be on the forex-tsd forum, and perhaps the trend laboratory yahoo group, but that is subscription based. This big thread may be of some help. The poster Igorad was the original creator of this indicator (and countless others).
                    I want to find this charting sofware. Where can i find it ? Anybody know ? Please PM me...


                    From the original code
                    Length: Volty Length
                    Kv: Sensivity Factor
                    StepSize: Constant Step Size (if need)
                    MA_Mode: Volty MA Mode : 0-SMA, 1-LWMA
                    Advance: Offset
                    Percentage: Percentage of Up/Down Moving
                    HighLow: High/Low Mode Switch (more sensitive)
                    ColorMode: Color Mode Switch
                    Also I don't know if the different MA types are functioning correctly at this point. It doesn't seem to make a difference which type I select...
                    Last edited by Elliott Wave; 09-12-2008, 09:22 AM.

                    Comment


                      #11
                      Yes, I don't see a difference either.

                      Do you have MT? Can you try to change them and see how if it works. I'm pretty sure the MA chosen only has a an effect on some alfa variable. The MA itself isn't even used for any calculation...
                      mrlogik
                      NinjaTrader Ecosystem Vendor - Purelogik Trading

                      Comment


                        #12
                        ColorMode parameter.

                        ColorMode = 0 then the line is always printed as yellow.

                        ColorMode = 1 the the line can be printed as either Magenta for down, or Cyan for up. If you look at plot(s) closely it would appear there is a problem.

                        ColorMode = 2 the the line can be printed as either Magenta for down, or Cyan for up. It appears that everything is plotting correctly.

                        Either ColorMode 1 or 2 is suppose to plot the yellow line. Reading some of the documentation for the nonlagging indicator. It would appear that colormode =1 is used to print the yellow line.
                        See: http://www.forex-tsd.com/indicators-...ing-tools.html posts 3 and 4. But taking a quick look at the mq4 code would seem to suggest the colormode = 2 should control the printing of a yellow line. But I could be wrong.
                        Attached Files

                        Comment


                          #13
                          I just checked in MetaTrader and the MA Mode does little to nothing. There is a slight difference between mode 0 and the other modes, but its meaningless.

                          Any idea with the parameter is for? Maybe it effects the other parameters in some way as you suggest.

                          Comment


                            #14
                            Elliott,

                            The SMA, or any Moving Average is not used at all in this code. The relevant part in the code is...

                            Code:
                            if (SMA) 
                                alfa= 1.0; 
                            else
                                alfa = 1.0 * (iLen - i) / iLen;
                            I'm going to change the input MA_MODE input to be something more intuitive like, Simple, or Weighted. Thats actually what it is.

                            As far as the barcolor input, there is no yellow for 1 or 2. The link given was for a NonLagMA; the yellow only shows a change in direction.

                            I believe the only difference between 1 and 2 is that
                            ColorMode = 1 includes a step * percentage to offset the line above / below more. I guess you could use this as a support / resistance line since it pushes the line away from the price.

                            ColorMode = 2 does not do this displacement.

                            For 1 and 2 the colors computed the same way.

                            I dont' believe 1 is an error; I'm not sure you can plot a connecting vertical line in NT like that. We have to check against MTs code.

                            Thoughts.
                            mrlogik
                            NinjaTrader Ecosystem Vendor - Purelogik Trading

                            Comment


                              #15
                              I will have to sit down and spend some time studying the MQ4 code. This is what I am looking at regarding the ColorCode parameter:
                              Code:
                              	  if ( ColorMode == 0) 
                              	     LineBuffer[shift]=StepMA;
                              	  else if ( ColorMode == 1){
                              	     if ( trend[shift]>0 ) {
                              	        UpBuffer[shift]=StepMA-Step*Point;DnBuffer[shift]=EMPTY_VALUE;
                              	        }
                                      else if ( trend[shift]<0 ) {
                                         DnBuffer[shift]=StepMA+Step*Point;UpBuffer[shift]=EMPTY_VALUE;
                                         }
                              	     }
                              	  else if ( ColorMode == 2){
                              	     if (trend[shift]>0){
                              	        UpBuffer[shift]=StepMA;
                              	        if ( trend[shift+1] < 0 ) UpBuffer[shift+1] = DnBuffer[shift+1];
                              	        DnBuffer[shift]=EMPTY_VALUE;
                              	        }
                              	     else if (trend[shift]<0){
                                         DnBuffer[shift]=StepMA;
                              	        if ( trend[shift+1] > 0 ) DnBuffer[shift+1] = UpBuffer[shift+1];
                              	        UpBuffer[shift]=EMPTY_VALUE;
                              	        }
                              	     }
                                   else{	
                              	     UpBuffer[shift]=EMPTY_VALUE; DnBuffer[shift]=EMPTY_VALUE;
                              	     }
                              	  }
                              I see an additional else statement at the end of the the mq4 code that I do not see in the NT code. I could be missing something. I will have to line up all of the {} with the IF statements and see when the
                              Code:
                                   else{	
                              	     UpBuffer[shift]=EMPTY_VALUE; DnBuffer[shift]=EMPTY_VALUE;
                              	     }
                              gets executed.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by adeelshahzad, Today, 03:54 AM
                              5 responses
                              32 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Started by stafe, 04-15-2024, 08:34 PM
                              7 responses
                              31 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by merzo, 06-25-2023, 02:19 AM
                              10 responses
                              823 views
                              1 like
                              Last Post NinjaTrader_ChristopherJ  
                              Started by frankthearm, Today, 09:08 AM
                              5 responses
                              19 views
                              0 likes
                              Last Post NinjaTrader_Clayton  
                              Started by jeronymite, 04-12-2024, 04:26 PM
                              3 responses
                              43 views
                              0 likes
                              Last Post jeronymite  
                              Working...
                              X