Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Minimum required history

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

    Minimum required history

    I am doing a lot of experimenting to try and debug my problem(s) with the code.

    Most recently I tried to just run the test on the last 6 months of data (daily candles) but no trades were placed at all. I thought this to be strange because there were definitely signals and I have not changed any of the entry logic and it has correctly placed trades in the past.

    I then continued to increase the length of time by 6 months until it finally placed a trade. It required me to go all the way back to Feb 2012 before it would place even a single trade....but, all of the entry logic is there and correct as it properly placed trades before.

    Furthermore, the minimum bars required is set to 20 and the maximum bars look back is TwoHundredFiftySix. Do those values make a difference?

    Also, here is the entry logic for anyone to take a look at if they need.

    Code:
           protected override void OnBarUpdate()
            {
    			/* Conditions for Long Entry */
                if (Close[0] > Open[0]
                    && Close[0] > MAEnvelopes(MAEPerc, 3, 25).Upper[0]
                    && Aroon(14).Up[0] == 100
                    && Close[0] > ParabolicSAR(0.02, 0.2, 0.02)[0]
                    && Close[0] > Ichimoku(9, 26, 52).KijunSen[0]
                    && Close[0] > SMA(SMAPeriod)[0]
    				&& !barResetUp)
    			{
    				signalHigh = High[0];
    				signalLow = Low[0];
    				
    				//Order Entries A & B
                    LongEntryA = EnterLongStop(DefaultQuantity, TrendPilotPricesLong(EntryPerc, StopPerc, TargetPerc).LongEntry[0], "LongEntryA");
                    LongEntryB = EnterLongStop(DefaultQuantity, TrendPilotPricesLong(EntryPerc, StopPerc, TargetPerc).LongEntry[0], "LongEntryB");
    				barResetUp = true;
                }
    			
    
    			// Required reset in order to establish a new trend
    			if (Close[0] < Ichimoku(9,26,52).KijunSen[0])
    			{
    				// Allows for a new trend to be determined after it has closed below the KijunSen
    				barResetUp = false;
    				// ***NEED TO SET IT TO CANCEL ANY PENDING ORDERS AND CLOSE ANY OPEN ORDERS***
    			}
    			if (Close[0] < SMA(sMAPeriod)[0]
    				|| Close[0] < Ichimoku(9,26,52).KijunSen[0])
    			{
    				CancelOrder(LongEntryA);
    				CancelOrder(LongEntryB);
    			}
    			
    			if (LongEntryA != null
    				&& Close[0] < SMA(sMAPeriod)[0]
    				|| Close[0] < Ichimoku(9,26,52).KijunSen[0])
    			{
    				ExitLong("LongEntryA");
    				ExitLong("LongEntryB");
    			}
    and attached is a picture from a perfect setup that occurred in November 2013.
    Attached Files

    #2
    jg123,

    Its hard to tell without all the code, but I highly suggest using TraceOrders = true in the initialize and running some print statements to see what is happening to these orders and if your values are the correct ones.
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      i do have the traceorders set to true. but i don't have print setup.

      What exactly should i be setting to print?

      Comment


        #4
        You would want to check your conditions values and your bools to ensure the switch is being turned off and on at the right time
        Cal H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        647 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        368 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        108 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        571 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        573 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X