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

Swing() on delta

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

    Swing() on delta

    Hello fine folks!

    I'm considering starting a project that involves using Swing() on cumulative delta.

    Looking at the documentation it looks like what I need to do is create a series for the delta value and then use that as the input parameter using:

    Code:
    Swing([B]ISeries<double> input, int strength[/B]).SwingLowBar(int barsAgo, int instance, int lookBackPeriod)
    It seems like I'd have to settle with using the closing delta value for that bar because it doesn't look like I can specify OHLC as an input to the function.

    I'm happy to do that if trying to get delta OHLC would be a pain.

    Am I looking at this right?

    Just wanted to run this past you fine folks before I invest that precious weekend time into the project.

    Thanks!

    #2
    Hello WalterSkinner,

    Thank you for your post.

    You don't actually need to create a series to hold the delta value, just use the Cumulative Delta indicator (you're correct, you can only select one plot, not the OHLC) when you call the Swing indicator:


    Code:
    private OrderFlowCumulativeDelta OFCD1;
    private Swing Swing1;
    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = @"Enter the description for your new custom Strategy here.";
    Name = "MyCustomStrategy5";
    Calculate = Calculate.OnBarClose;
    EntriesPerDirection = 1;
    EntryHandling = EntryHandling.AllEntries;
    IsExitOnSessionCloseStrategy = true;
    ExitOnSessionCloseSeconds = 30;
    IsFillLimitOnTouch = false;
    MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
    OrderFillResolution = OrderFillResolution.Standard;
    Slippage = 0;
    StartBehavior = StartBehavior.WaitUntilFlat;
    TimeInForce = TimeInForce.Gtc;
    TraceOrders = false;
    RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
    StopTargetHandling = StopTargetHandling.PerEntryExecution;
    BarsRequiredToTrade = 20;
    // Disable this property for performance gains in Strategy Analyzer optimizations
    // See the Help Guide for additional information
    IsInstantiatedOnEachOptimizationIteration = true;
    }
    else if (State == State.DataLoaded)
    {
    OFCD1 = OrderFlowCumulativeDelta(CumulativeDeltaType.BidAs k, CumulativeDeltaPeriod.Session, 0);
    Swing1 = Swing(OFCD1.DeltaClose, 5);
    }
    }
    You can then refer to Swing1 when you want to get swing values based on the Cumulative Delta's Delta Close.

    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by alifarahani, Today, 09:40 AM
    6 responses
    36 views
    0 likes
    Last Post alifarahani  
    Started by Waxavi, Today, 02:10 AM
    1 response
    17 views
    0 likes
    Last Post NinjaTrader_LuisH  
    Started by Kaledus, Today, 01:29 PM
    5 responses
    14 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by Waxavi, Today, 02:00 AM
    1 response
    12 views
    0 likes
    Last Post NinjaTrader_LuisH  
    Started by gentlebenthebear, Today, 01:30 AM
    3 responses
    17 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Working...
    X