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 NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        58 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        133 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        73 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        45 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        50 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X