Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 patrickmlee007, Today, 09:33 AM
        2 responses
        16 views
        0 likes
        Last Post patrickmlee007  
        Started by magnatauren, 08-15-2020, 02:12 PM
        5 responses
        206 views
        0 likes
        Last Post RaddiFX
        by RaddiFX
         
        Started by rene69851, 05-02-2024, 03:25 PM
        1 response
        21 views
        0 likes
        Last Post rene69851  
        Started by ETFVoyageur, Yesterday, 07:05 PM
        5 responses
        45 views
        0 likes
        Last Post ETFVoyageur  
        Started by jpeep, 08-16-2020, 08:31 AM
        13 responses
        487 views
        0 likes
        Last Post notenufftime  
        Working...
        X