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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    156 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    90 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    140 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    130 views
    1 like
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    107 views
    0 likes
    Last Post CarlTrading  
    Working...
    X