Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

up/Down Swing average volume

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

    up/Down Swing average volume

    Hello

    Does somebody know how to create a up/down swing average volume indicator for ninja trader 7.0 ?

    Like the one I found for metastock 11.0
    This is the formula :

    ©Copyright 2006 Jose Silva.
    For personal use only.
    http://www.metastocktools.com }

    { User inputs }
    choose:=Input("Avg Volume: [1]UpSwing, [2]DownSwing, [3]Both",1,3,3);
    ch:=Input("ZigZag minimum change %",.01,100,2);
    plot:=Input("Up/Down [1]Avg Vol [2]Swings, [3]ZigZag, [4]Pk/Tr",1,4,1);

    { ZigZag }
    zz:=Zig(C,ch,%);

    { Up/Down bar count }
    pkBars:=PeakBars(1,C,ch);
    trBars:=TroughBars(1,C,ch);

    { Peaks/Troughs }
    pk:=pkBars=0;
    tr:=trBars=0;

    { ---------- *** UpSwing Volume *** ---------- }

    { Up swings }
    UpSwing:=zz>Ref(zz,-1);

    { Up swing volume }
    UpSwingVol:=V*UpSwing;

    { Accumulate & reset UpVolume }
    acc:=Cum(UpSwingVol);
    accUpVol:=acc-ValueWhen(1,pkBars=0,acc);

    { Average UpSwing Volume }
    avgUpVol:=accUpVol/Max(trBars,.00001);

    { Restrict avg Volume to peak bar }
    avgUpVolPk:=Ref(avgUpVol,-1)*pk;

    { --------- *** DownSwing Volume *** --------- }

    { Down swings }
    DwSwing:=zz<Ref(zz,-1);

    { Down swing volume }
    DwSwingVol:=V*DwSwing;

    { Accumulate & reset DownVolume }
    acc:=Cum(DwSwingVol);
    accDwVol:=acc-ValueWhen(1,trBars=0,acc);

    { Average DownSwing Volume }
    avgDwVol:=accDwVol/Max(pkBars,.00001);

    { Restrict avg Volume to trough bar }
    avgDwVolTr:=Ref(avgDwVol,-1)*tr;


    { Choose Volume display }
    swingAvgVol:=
    If(choose=1,avgUpVol,
    If(choose=2,avgDwVol,
    avgUpVolPk-avgDwVolTr));

    { Plot in own window }
    If(plot=1,swingAvgVol,
    If(plot=2,UpSwing-DwSwing,
    If(plot=3,zz,pk-tr)))
    Attached Files
    Last edited by [email protected]; 02-13-2018, 12:44 PM. Reason: Remove my public email view

    #2
    Hello,

    Thanks for your first post on the forums!

    The support team at NinjaTrader does not provide coding services. We can leave this thread open for any forum member that may wish to provide this.

    Alternatively, if you wish it coded for you we can certainly provide references to 3rd party coders.

    We would suggest not using an e-mail address for a forum name as you are likely to get a lot of spam e-mails dues to the various bots that scan boards like this just for e-mail addresses.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    563 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    329 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
    547 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    547 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X