Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

multitime frame, addlinebreak

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

    multitime frame, addlinebreak

    for a strategy i want to use multitimeframe strategy.my querry is ::
    to the default instrument on which the strategy is running
    how to add linebreak data series in initialise().when i try following i get no error compliling the startegy but the stratgy wont start qhwn i run it.
    i
    AddLineBreak(Instrument.MasterInstrument.Name, PeriodType.Day, 1, 1, MarketDataType.Last);
    if i use following then i have to change the code every time i change the instrument or rollover period .
    AddLineBreak("FDAX 06-14", PeriodType.Day, 1, 1, MarketDataType.Last);
    .
    is there a way to addlinebreak which will work for all instruments ,pls advise

    #2
    Hello,

    Thank you for the question.

    If you print the Instrument.MasterInstrument.Name this returns only the name of the instrument you are on, not the full name.
    For futures this does not work because the ES 09-14 would just be ES and NinjaTrader does not have a instrument named just ES, it does have an instrument named ES followed by the contract month.

    You would need to change the line to
    Code:
    Instrument.FullName
    OR:

    Code:
    protected override void Initialize()
            {
    	 AddLineBreak(Instrument.FullName, PeriodType.Day, 1, 1, MarketDataType.Last);
                CalculateOnBarClose = true;
            }
            protected override void OnBarUpdate()
            {
    			if (BarsInProgress == 1)
    		{
    			Print(Closes[1][0]); //print the close from the linebreak series only
    		}
       	 }
    Please let me know if I may be of additional assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    52 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    142 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    160 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    96 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    276 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X