• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Closing time

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

  • NinjaTrader_Jesse
    replied
    Hello

    You can see an example of the OnMarketData override here: https://ninjatrader.com/support/help...b=OnMarketData
    OnMarketData is called for market data events, you could execute that code from that override if you wanted to break away from the renko series and OnBarClose. That would only work in realtime so if you need to backtest the strategy this likely is not the best solution as TickReplay would be required.

    Otherwise for an example of a multi series strategy you can see the SampleMultiInstrument or SampleMultiTimeFrame strategies that come with NinjaTrader. Because this is a more complicated subject I would suggest to read the multi series documentation to better understand using multiple series to control logic: https://ninjatrader.com/support/help...lightsub=multi

    After adding a secondary series you would execute the code you had provided from a BarsInProgress condition:

    Code:
    if(BarsInProgress == 1)
    {
    
    }


    I look forward to being of further assistance.

    Leave a comment:


  • oscsoft
    replied
    Thank you for the answer !
    honestly, I did not quite understand how to implement this!
    But can I see an example of the implementation of this issue? using an example of a simple strategy.

    thanks

    Leave a comment:


  • NinjaTrader_Jesse
    replied
    Hello oscsoft,

    OnBarUpdate would generally be where this type of logic would go, you could also use the other overrides like OnMarketData to have this checked for incoming realtime data. If the reason this cannot go in OnBarUpdate is due to the interval or bars type being used you could make a multi series strategy which has a more granular secondary series such as 10 seconds. That would allow you to execute some logic every 10 seconds and other logic at the rate of the renko.

    https://ninjatrader.com/support/help...lightsub=multi

    I look forward to being of further assistance.

    Leave a comment:


  • oscsoft
    started a topic Closing time

    Closing time

    Hello!
    I wrote schedules when the order should be closed! that is, time to exit the market.
    question where to put this code ??

    if((exitSesion1 && ToTime(Time[0]) >= end_time && ToTime(Time[0]) <= start_time_1) || (exitSesion2 && ToTime(Time[0]) >= end_time_1 && ToTime(Time[0]) <= start_time_2))
    {
    ExitLong();
    ExitShort();
    CancelOrder(entryOrder1);
    CancelOrder(entryOrder2);
    }

    OnBarUpdate is not correct as the work on closing the bar and the strategy works a long interval or long renko

Latest Posts

Collapse

Topics Statistics Last Post
Started by evanp90, Today, 06:30 AM
1 response
11 views
0 likes
Last Post NinjaTrader_Manfred  
Started by sandman, Today, 07:13 AM
0 responses
2 views
0 likes
Last Post sandman
by sandman
 
Started by GLFX005, Today, 03:54 AM
1 response
9 views
0 likes
Last Post NinjaTrader_PaulH  
Started by pol133, Today, 04:36 AM
1 response
6 views
0 likes
Last Post NinjaTrader_ChristopherS  
Started by login_dejavu, 07-12-2020, 07:28 AM
6 responses
50 views
0 likes
Last Post MojoJojo  
Working...
X