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

Adr+Std

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

  • Javierw.ok
    replied
    Ok I'll look into it, thank you very much

    Leave a comment:


  • NinjaTrader_BrandonH
    replied
    Hello Javierw.ok,

    Thanks for your post.

    You could add Print() statements to the script that print out the values you are calculating to debug the script and see how your custom calculations are evaluating.

    For information about how the StdDev() system indicator functions you could view the code of the indicator by opening a New > NinjaScript Editor window, opening the Indicators folder, and double-clicking on the StdDev file.

    StdDev() Help Guide: https://ninjatrader.com/support/help...ion_stddev.htm

    See this NinjaTrader Support article about debugging a script using Print(): https://support.ninjatrader.com/s/ar...nd-TraceOrders

    Leave a comment:


  • Javierw.ok
    started a topic Adr+Std

    Adr+Std

    Hello, I am trying to calculate the average daily range and the standard deviation of that range.
    The calculation of the average range gives me good but the stdv gives me bad, can someone help me or tell me what I'm doing wrong?
    Here I leave the part of the code


    //Range High
    double sum1 = 0;
    for (int i=0; i<20; i++)
    sum1 = sum1 + (((Highs[1][i] - Opens[1][i]) / Highs[1][i]) * 100);
    adrHigh[0] = Math.Round((sum1 / 20),2);

    //Std High
    for (int i=0; i<20; i++)
    std1[0] = ((Highs[1][i] - Opens[1][i]) / Highs[1][i]) * 100;
    double stdHigh = Math.Round(StdDev(std1,20)[0],2);

    //Range Low
    double sum2 = 0;
    for (int i=0; i<20; i++)
    sum2 = sum2 + (((Opens[1][i] - Lows[1][i]) / Opens[1][i]) * 100);
    adrLow[0] = Math.Round((sum2 / 20),2);

    //Std Low
    for (int i=0; i<20; i++)
    std2[0] = ((Opens[1][i] - Lows[1][i]) / Opens[1][i]) * 100;
    double stdLow = Math.Round(StdDev(std2,20)[0],2);​




Latest Posts

Collapse

Topics Statistics Last Post
Started by ccrone2024, Today, 05:13 AM
0 responses
3 views
0 likes
Last Post ccrone2024  
Started by ttodua, Today, 03:40 AM
0 responses
5 views
0 likes
Last Post ttodua
by ttodua
 
Started by ttodua, Today, 03:18 AM
0 responses
5 views
0 likes
Last Post ttodua
by ttodua
 
Started by TraderKnG, Today, 01:30 AM
0 responses
11 views
0 likes
Last Post TraderKnG  
Started by morrnel, 05-12-2024, 06:07 PM
8 responses
156 views
1 like
Last Post nobchi
by nobchi
 
Working...
X