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 benmarkal, Yesterday, 12:52 PM
    3 responses
    23 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by helpwanted, Today, 03:06 AM
    1 response
    18 views
    0 likes
    Last Post sarafuenonly123  
    Started by Brevo, Today, 01:45 AM
    0 responses
    11 views
    0 likes
    Last Post Brevo
    by Brevo
     
    Started by pvincent, 06-23-2022, 12:53 PM
    14 responses
    244 views
    0 likes
    Last Post Nyman
    by Nyman
     
    Started by TraderG23, 12-08-2023, 07:56 AM
    9 responses
    388 views
    1 like
    Last Post Gavini
    by Gavini
     
    Working...
    X