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

The Leavitt Convolution

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

    The Leavitt Convolution

    Hello coders,

    Can someone change the EasyLanguage code here to Ninjascript? this is based on the article in S&C Nov '17 issue titled “Trading The Tech Emini With The Leavitt Convolution”.


    inputs:
    Price(numericseries),
    Length(numericsimple) ;
    LeavittProjection = LinearRegValue(Price, Length, -1) ;
    // the -1 asks for the 1 bar projection; price given at time values [0], [1], [2], ...,[Length - 1]
    ================================================== ===========================
    inputs:
    Price(numericseries),
    Length(numericsimple) ;

    vars:
    LenConv(0) ;

    LenConv = IntPortion( SquareRoot(Length)) ; // this is how EasyLanguage extracts the integer portion of a variable

    LeavittConv = LinearRegValue(LeavittProjection(Price, Length), LenConv, -1); //inline function call

    Thanks in advance!

    #2
    Hello ashmanz80,

    Thanks for your inquiry.

    As far as I am aware, the November 2017 S&C magazine entry is available here: http://traders.com/Documentation/FEE...ips.html#item8

    and on our forums here: http://www.ninjatrader.com/support/f...catid=8&id=956

    This indicator you have listed looks different, however. I won't be able to provide the conversion for you, but I have included some information that can be useful in showing you or another member of the forums how to do the conversion.

    Code:
    inputs: 
    Price(numericseries), 
    Length(numericsimple) ;
    We have two input variables. The input series and an an input variable called Length. We can refer to the input series as Input and we will have to create a variable for "Length." An integer should suffice. These inputs are reused so we will only need to add the variable once.

    Code:
    LeavittProjection = LinearRegValue(Price, Length, -1) ;
    We can use a call for the LinReg indicator in place of using this variable. The "-1" argument would be unused. I am not sure on the technicalities behind the EasyLanguage version.

    Code:
    inputs: 
    Price(numericseries), 
    Length(numericsimple) ;
    
    vars: 
    LenConv(0) ;
    These input variables are already created. The variable LenConv can be an integer.

    Code:
    LenConv = IntPortion( SquareRoot(Length)) ; // this is how EasyLanguage extracts the integer portion of a variable
    
    LeavittConv = LinearRegValue(LeavittProjection(Price, Length), LenConv, -1); //inline function call
    The IntPortion() method can be done through a type cast. SquareRoot() can be done with Math.Sqrt. Indicators can be used as input for other indicators.

    The resulting output would then have to be plotted. Please see the AddPlot() documentation for more information.

    I have attached links to publicly available resources that can be used as reference for developing this indicator.

    Valid Input for Indicators - https://ninjatrader.com/support/help..._indicator.htm

    LinReg indicator - https://ninjatrader.com/support/help...regression.htm

    Input (Series) - https://ninjatrader.com/support/help...n-us/input.htm

    Type Casting - https://stackoverflow.com/a/1339499

    Math.Sqrt - https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx

    AddPlot() - https://ninjatrader.com/support/help...us/addplot.htm

    If you have any questions on the material provided, please don't hesitate to ask.
    JimNinjaTrader Customer Service

    Comment


      #3
      Strategy Development

      Thanks a lot Jim for the insight! The ATS is a bit complicated for me to translate to NT8. Hope someone can do this and share with the community. I attached the article for anyone interested in giving this a go.
      Attached Files

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by helpwanted, Today, 03:06 AM
      1 response
      5 views
      0 likes
      Last Post sarafuenonly123  
      Started by Brevo, Today, 01:45 AM
      0 responses
      7 views
      0 likes
      Last Post Brevo
      by Brevo
       
      Started by aussugardefender, Today, 01:07 AM
      0 responses
      5 views
      0 likes
      Last Post aussugardefender  
      Started by pvincent, 06-23-2022, 12:53 PM
      14 responses
      242 views
      0 likes
      Last Post Nyman
      by Nyman
       
      Started by TraderG23, 12-08-2023, 07:56 AM
      9 responses
      384 views
      1 like
      Last Post Gavini
      by Gavini
       
      Working...
      X