Announcement

Collapse
No announcement yet.

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 op1031, Today, 01:52 AM
      0 responses
      1 view
      0 likes
      Last Post op1031
      by op1031
       
      Started by Aramunno, Yesterday, 10:11 PM
      2 responses
      16 views
      0 likes
      Last Post Aramunno  
      Started by sdauteuil, Yesterday, 09:38 PM
      0 responses
      5 views
      0 likes
      Last Post sdauteuil  
      Started by fscabrera03, Yesterday, 09:23 PM
      0 responses
      10 views
      0 likes
      Last Post fscabrera03  
      Started by WeyldFalcon, Yesterday, 07:03 PM
      0 responses
      7 views
      0 likes
      Last Post WeyldFalcon  
      Working...
      X