Announcement

Collapse
No announcement yet.

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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        79 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        40 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        63 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        63 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        54 views
        0 likes
        Last Post CarlTrading  
        Working...
        X