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

Pulling Data from Unirenko

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

    Pulling Data from Unirenko

    I have a strategy that has to pull data from 2 UniRenko charts.

    When I try to run the script, it doesnt do anything and the strategy automatically un-checks itself.
    Can you spot what the issue is?
    It's pulling the MACD, Stochastic, OrderFlow info from the 2 other unirenko charts.

    Code:
                else if (State == State.Configure)
                {
                    AddDataSeries(new BarsPeriod() { BarsPeriodType = (BarsPeriodType)20, Value = 4, Value2 = 10 });
                    AddDataSeries(new BarsPeriod() { BarsPeriodType = (BarsPeriodType)20, Value = 6, Value2 = 10 });
                }
                else if (State == State.DataLoaded)
                {                
                    MACD1                = MACD(Closes[1], 12, 26, 9);
                    MACD2                = MACD(Closes[2], 12, 26, 9);
                    Stochastics1                = Stochastics(Closes[1], 7, 14, 3);
                    Stochastics2                = Stochastics(Closes[2], 7, 14, 3);
                    OrderFlowCumulativeDelta1                = OrderFlowCumulativeDelta(Closes[1], NinjaTrader.NinjaScript.Indicators.CumulativeDeltaType.BidAsk, NinjaTrader.NinjaScript.Indicators.CumulativeDeltaPeriod.Session, 0);
                    OrderFlowCumulativeDelta2                = OrderFlowCumulativeDelta(Closes[2], NinjaTrader.NinjaScript.Indicators.CumulativeDeltaType.BidAsk, NinjaTrader.NinjaScript.Indicators.CumulativeDeltaPeriod.Session, 0);
                    SMA1                = SMA(OrderFlowCumulativeDelta1.DeltaClose, 15);
                    SMA2                = SMA(OrderFlowCumulativeDelta2.DeltaClose, 15);
                }
            }
    
            protected override void OnBarUpdate()
            {
                if (BarsInProgress != 0) 
                    return;
    
                if (CurrentBars[0] < 1
                || CurrentBars[1] < 1
                || CurrentBars[2] < 1)
                    return;
    
                 // Set 1
                if ((Open[0] < Close[0])
                     && (MACD1.Default[0] > MACD1.Default[1])
                     && (MACD2.Default[0] > MACD2.Default[1])
                     && (Stochastics1.K[0] <= 20)
                     && (Stochastics2.K[0] <= 20)
                     && (SMA1[0] > SMA2[1])
                     && (SMA2[0] > SMA2[1]))
                {
                    EnterLong(Convert.ToInt32(DefaultQuantity), "");
                }
    
                 // Set 2
                if (Open[0] > Close[0])
                {
                    ExitLong(Convert.ToInt32(DefaultQuantity), "", "");
                }

    Thanks!

    #2
    Hello Ousher,

    If the strategy is immediately disabled its probably due to a run-time error.

    Do you see any errors on the Log tab of the Control Center when attempting to enable the script?

    What does the full error message?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChelseaB View Post
      Hello Ousher,

      If the strategy is immediately disabled its probably due to a run-time error.

      Do you see any errors on the Log tab of the Control Center when attempting to enable the script?

      What does the full error message?
      Hi, thanks for the quick response!

      Error says
      7/29/2020 9:45:17 AM Default 'Order Flow Cumulative Delta' tried to load additional data. All data must first be loaded by the hosting NinjaScript in its configure state. Attempted to load ES 09-20 Globex: 1 Tick

      Comment


        #4
        Hello Ousher,

        The Order Flow Cumulative Delta has an internal 1 tick series.

        To call this from another script, that host script also has to add a 1 tick series.

        The example in the help guide demonstrates.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by bortz, 11-06-2023, 08:04 AM
        47 responses
        1,607 views
        0 likes
        Last Post aligator  
        Started by jaybedreamin, Today, 05:56 PM
        0 responses
        9 views
        0 likes
        Last Post jaybedreamin  
        Started by DJ888, 04-16-2024, 06:09 PM
        6 responses
        19 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by Jon17, Today, 04:33 PM
        0 responses
        6 views
        0 likes
        Last Post Jon17
        by Jon17
         
        Started by Javierw.ok, Today, 04:12 PM
        0 responses
        15 views
        0 likes
        Last Post Javierw.ok  
        Working...
        X