Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Help

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

    Help

    In chart loaded on NT8, appears yellow instead of green or red on loading in real-time programmatically . Please , is there a way of making this happen.

    IsInstantiatedOnEachOptimizationIteration = true;
    TakeProfit = 8;
    Stoploss = 16;
    }
    else if (State == State.Configure)
    {
    }
    else if (State == State.DataLoaded)
    {
    EMA1 = EMA(Close, 21);
    EMA2 = EMA(Close, 50);
    EMA1.Plots[0].Brush = Brushes.Yellow;
    EMA2.Plots[0].Brush = Brushes.Lime;
    AddChartIndicator(EMA1);
    AddChartIndicator(EMA2);
    SetProfitTarget(@"EMAshort", CalculationMode.Ticks, TakeProfit);
    SetStopLoss(@"EMAShort", CalculationMode.Ticks, Stoploss, false);
    }

    else if(State==State.Historical)
    {
    load buttons
    }
    OnBarUpdate()

    if (Realtime)
    {
    if(CurrentBar>1)
    {
    if(Position.MarketPosition=MarketPosition.Flat)

    {
    currentpos= 1
    }
    }


    }



    .

    #2
    Hello Emma1,

    Thanks for your post.

    This appears to be a similar inquiry to what you wrote in on.

    When the strategy name is in yellow, this would indicate that the strategy has not completed the last historical trade made prior to the real-time data. For your understanding, when you apply a strategy to a chart, the strategy will begin executing its code on the historical bars first, in sequence, up to the current bar. The trade made historically is virtual (not real) and represents what the strategy would have done. Please see: https://ninjatrader.com/support/help..._account_p.htm
    What happens is that the strategy entered a position and before the position was closed (by the logic of your strategy) it encountered the real-time data. Once the exit conditions occur in real-time and the last virtual trade is closed, the strategy name will turn green indicating it is now ready to trade live. Reference: https://ninjatrader.com/support/help...eStrategiesTab

    How the strategy handles the transition from historical to real-time is called the strategy start behavior and by default is set to "Wait until Flat".
    You can change the strategy start behavior. Please review the choices here: https://ninjatrader.com/support/help..._positions.htm"


    If you prefer, another option to consider would be skipping historical bars processing, you can do this in OnBarUpdate() by:

    if (State == State.Historical) return; // do not process below this line until real time data.

    Reference: https://ninjatrader.com/support/help...nt8/?state.htm

    Paul H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by AHamxa, Yesterday, 11:24 PM
    0 responses
    5 views
    0 likes
    Last Post AHamxa
    by AHamxa
     
    Started by AHamxa, Yesterday, 11:22 PM
    0 responses
    4 views
    0 likes
    Last Post AHamxa
    by AHamxa
     
    Started by AHamxa, Yesterday, 11:17 PM
    0 responses
    5 views
    0 likes
    Last Post AHamxa
    by AHamxa
     
    Started by Spiderbird, 07-27-2018, 07:52 PM
    12 responses
    9,240 views
    2 likes
    Last Post Mountain_cast  
    Started by chrischongpdx, Yesterday, 09:39 PM
    0 responses
    7 views
    0 likes
    Last Post chrischongpdx  
    Working...
    X