Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator conversion from pinescript to ninjascript.

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

    Indicator conversion from pinescript to ninjascript.

    Hi ninjascript experts, I need help converting this script I wrote in pinescript to ninjascript.

    PHP Code:
    nonLagEMA(src, length) =>
        alpha = 2 / (length + 1)
        nonLag = 0.0
        nonLag := alpha * src + (1 - alpha) * nz(nonLag[1])
        nonLag
    
    nonLagOscillator = 100 * (close - nonLagEMA(close, fastPeriod)) / nonLagEMA(close, fastPeriod)​ 
    
    so far I tried this:

    PHP Code:
    protected double NonLagEMA(Series<double> src, int length) {
        double alpha = 2.0 / (length + 1);
        double nonLag = 0.0;
        nonLag = alpha * src[0] + (1 - alpha) * nonLag);
        return nonLag;
    } 
    
    OnBarUpdate I have this:

    PHP Code:
    currentClose[0] = Close[0];
    
    nonLagOscillator[0] = 100 * (Close[0] - NonLagEMA(currentClose, fast_period)) / NonLagEMA(currentClose, fast_period); 
    

    #2
    Hello seddka,

    Thank you for your post.

    Unfortunately, in the support department at NinjaTrader it is against our policy to create, debug, or modify, code or logic for our clients. Further, we do not provide C# programming education services or one on one educational support in our NinjaScript Support department. This is so that we can maintain a high level of service for all of our clients as well as our associates.

    That said, through email or on the forum we are happy to answer any questions you may have about NinjaScript if you decide to convert this yourself. We are also happy to assist with finding resources in our help guide as well as simple examples, and we are happy to assist with guiding you through the debugging process to assist you with understanding unexpected behavior. If you have any questions about what you have so far and how it is behaving or how you might achieve something via NinjaScript, please provide a description of your inquiry so we may better assist you.

    You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like our NinjaTrader Ecosystem team to follow up with you with a list of affiliate consultants who would be happy to create this script or any others at your request or provide one on one educational services.

    Otherwise, this thread will remain open for members of the forum community to chime in if they would like to help out as well.

    Please let us know if we may be of further assistance.​

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    571 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    331 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    549 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    549 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X