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

Delta Elasticity Indicator - Help with Script Editor Wizard

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

    Delta Elasticity Indicator - Help with Script Editor Wizard

    Hi,

    I am trying to create what I think will be a very simple indicator. Delta Elasticity or DE

    The formula being

    Delta elasticity= barsType.Volumes[CurrentBar].BarDelta / ( Bid[0] - Open[0] )


    How do I buld this into the Editor Indicator wizard?





    #2
    Hello horacioofman,

    You would not be able to do this with the Strategy Builder or Indicator Wizard.

    The Order Flow + indicators and bar types require advanced code to call from a script.
    Unfortunately, because of this, these cannot be used in the Strategy Builder. To call these scripts from NinjaScript the strategy will need to be unlocked and coded by hand.
    The Order Flow Cumulative Delta, Order Flow Volumetric Bars, and Order Flow VWAP are able to be called from an unlocked script.
    Below are links to the help guide.
    https://ninjatrader.com/support/help...ive_delta2.htm
    https://ninjatrader.com/support/help...tric_bars2.htm
    https://ninjatrader.com/support/help...flow_vwap2.htm

    However, you have suggested something close to what might be used.

    Likely you might want something like:

    Code:
    private NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsType volumetricBars;
    private double currentBarDelta;​
    private double elasticity;
    Code:
    protected override void OnStateChange()
    {
         if (State == State.SetDefaults) { }
    
         else if (State == State.DataLoaded)
         {
              if (BarsArray.Count() > 0 && BarsArray[0] != null)
                   volumetricBars = BarsArray[0].BarsSeries.BarsType as NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsType;
         }
    }​
    Code:
    protected override void OnBarUpdate()
    {
         if (CurrentBars[0] < 1 || volumetricBars == null)
              return;
    
         currentBarDelta    = volumetricBars.Volumes[CurrentBars[0]].BarDelta;
         elasticity         = barsType.Volumes[CurrentBar].BarDelta / ( GetCurrentBid() - Open[0] );
    
         Print( string.Format( "{0} | currentBarDelta: {1} / ( GetCurrentBid(): {2} - Open[0]: {3} ) = elasticity: {4}",
              Times[0][0], currentDelta, GetCurrentBid(), Open[0], elasticity ));
    }​
    I am also including a link to a forum post with helpful resources and videos on getting started with NinjaScript and C#.
    Last edited by NinjaTrader_ChelseaB; 10-17-2022, 02:12 PM.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Klaus Hengher, Today, 03:13 AM
    0 responses
    3 views
    0 likes
    Last Post Klaus Hengher  
    Started by ewileznwpods, Today, 02:57 AM
    0 responses
    1 view
    0 likes
    Last Post ewileznwpods  
    Started by 1001111, Today, 01:35 AM
    0 responses
    5 views
    0 likes
    Last Post 1001111
    by 1001111
     
    Started by ETFVoyageur, Yesterday, 07:05 PM
    1 response
    16 views
    0 likes
    Last Post ETFVoyageur  
    Started by MarianApalaghiei, Today, 12:35 AM
    1 response
    8 views
    0 likes
    Last Post MarianApalaghiei  
    Working...
    X