Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Understanding start behavior

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

  • Bionian
    replied
    Chelsea:

    I inserted your code into the strategy. I don't necessarily want to prevent the strategy from processing historical data, but I do want to be able to apply the script and begin executing trades immediately, without waiting for the virtual order to close the historical position, when I see signs from price action that the market has temporarily converted into a sideways market. Can you tell me if I inserted the script properly? The strategy appear to still function, but I don't know if it will accurately begin generating signals on live data immediately.

    OneMinSwingIndScalpCloseOnRevC345StartNow.zip

    Thanks-
    Rick

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello Bionian,

    This logic would be in OnBarUpdate().
    https://ninjatrader.com/support/help...nbarupdate.htm

    Below I am providing a public link to a forum post with helpful information about getting started with NinjaScript.
    https://ninjatrader.com/support/foru...040#post786040

    Leave a comment:


  • Bionian
    replied
    I have been trying to study C#, but since this will be by first time unlocking code, where should I place this? And I assume I begin at the "if" statement?

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello Bionian,

    The strategy will process historical data before real-time data.
    Historical orders will appear on the chart.
    https://ninjatrader.com/support/foru...442#post782442

    With Wait until flat, if the strategy calculates a historical position open, it will wait until a virtual order closes the historical position before placing any real-time orders.
    Once the strategy has become flat or crossed through flat, the strategy name will become green indicating the strategy is now sending real-time orders.
    https://ninjatrader.com/support/foru...541#post811541

    To prevent a strategy from processing any historical data use:
    if (State == State.Historical)
    return;

    To exit a position on the last historical bar use:
    if (State == State.Historical && CurrentBar == Count - 2)
    {
    if (Position.MarketPosition == MarketPosition.Long)
    ExitLong();
    if (Position.MarketPosition == MarketPosition.Short)
    ExitShort();
    }

    Leave a comment:


  • Bionian
    started a topic Understanding start behavior

    Understanding start behavior

    Please help me to understand Start Behavior for a strategy. I currently have the behavior set to "Wait until flat, synchronize account". But I just activated a strategy, and on the chart it shows that there is an active short on the chart. I believe currently the strategy will wait until that trade finishes, and then it will start initiating trades once the strategy is flat. How can I get the strategy to activate a trade on the NEXT signal, without having it activate immediately based on the last signal?

Latest Posts

Collapse

Topics Statistics Last Post
Started by Tuxstuff215, Today, 06:32 AM
1 response
12 views
0 likes
Last Post NinjaTrader_ChrisL  
Started by carlot, Today, 08:10 AM
0 responses
7 views
0 likes
Last Post carlot
by carlot
 
Started by KirkHammett, Yesterday, 11:15 PM
1 response
13 views
0 likes
Last Post NinjaTrader_ChrisL  
Started by soon123, Yesterday, 11:12 PM
1 response
7 views
0 likes
Last Post NinjaTrader_ChrisL  
Started by Unsuitable, Yesterday, 06:30 PM
1 response
11 views
0 likes
Last Post NinjaTrader_ChrisL  
Working...
X