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

Accumulation distribution formula larry william for stocks

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

    Accumulation distribution formula larry william for stocks

    hello..
    I'm reading an old book by Larry William that says:

    "In a concise form the equation is this: Close minus the opening, divided by high
    minus the low, times daily volume = net buying or selling volume for the day (net
    daily A/D figure).

    This is equated as :
    close-open
    -----------------
    high -low X total volume = net buying or selling pressure for the day."

    can you help me write this indicator?please

    thank you very much

    Simone

    #2
    Hello lion1980, thanks for your note.

    The first thing the script will need is a secondary daily series. This will let us get the daily volume. Use AddDataSeries() to add a daily series.

    After this, in BarsInProgress == 0, perform the calculation:

    Code:
    [I]protected override void OnStateChange()
            {
                if (State == State.SetDefaults)
                {
                    ...
                    AddPlot(Brushes.Red, "MyPlot");
                }
                else if (State == State.Configure)
                {
                    AddDataSeries(BarsPeriodType.Day, 1);
                }
            }
    
            protected override void OnBarUpdate()
            {
                if(CurrentBars[1] < 1 || CurrentBars[0] < 1)
                    return;
    
                if(BarsInProgress == 0)
                {
                    Value[0] = (Close[0] - Open[0])/((High[0] - Low[0])*Volumes[1][0]);
                }
    
            }[/I]
    Chris L.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by zstheorist, Today, 07:52 PM
    0 responses
    3 views
    0 likes
    Last Post zstheorist  
    Started by pmachiraju, 11-01-2023, 04:46 AM
    8 responses
    149 views
    0 likes
    Last Post rehmans
    by rehmans
     
    Started by mattbsea, Today, 05:44 PM
    0 responses
    5 views
    0 likes
    Last Post mattbsea  
    Started by RideMe, 04-07-2024, 04:54 PM
    6 responses
    33 views
    0 likes
    Last Post RideMe
    by RideMe
     
    Started by tkaboris, Today, 05:13 PM
    0 responses
    5 views
    0 likes
    Last Post tkaboris  
    Working...
    X