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

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.
    Paul H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by kempotrader, Today, 08:56 AM
    0 responses
    6 views
    0 likes
    Last Post kempotrader  
    Started by kempotrader, Today, 08:54 AM
    0 responses
    4 views
    0 likes
    Last Post kempotrader  
    Started by mmenigma, Today, 08:54 AM
    0 responses
    2 views
    0 likes
    Last Post mmenigma  
    Started by halgo_boulder, Today, 08:44 AM
    0 responses
    1 view
    0 likes
    Last Post halgo_boulder  
    Started by drewski1980, Today, 08:24 AM
    0 responses
    4 views
    0 likes
    Last Post drewski1980  
    Working...
    X