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

Intrabar Backtesting

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

    Intrabar Backtesting

    I found THIS reference sample.

    It seems pretty simple, but I have three questions:

    1.) Does the method of setting fixed profit targets work with this method of the strategy entering on an intrabar method? By that I mean using:
    Code:
    SetProfitTarget("3bSell", CalculationMode.Ticks, PO);
    SetStopLoss("3bSell", CalculationMode.Ticks, ISL, false);
    Where "PO" and "ISL" are the profit objective and Stop Loss?

    2.) Can someone explain the first two fields from the reference sample in the following code:
    Code:
    EnterShort(1, 1, "Short: 1min");
    I see there is a "1" in the first two fields above, referring to the 'secondary' bars we added. Is the first field the number of contracts? And the second the reference for Secondary Bars?

    3.)How would I modify the above to enter on a stop beyond price? How would I modify this to give the proper entry using Secondary Bars?
    Code:
    EnterShortStop(DefaultQuantity, Low[0] - Fade * TickSize, "3bSell")
    As you can see with the above, I'm trying to enter on a stop below my primary bars(5min), but the actual entry....and my exits for that matter I would like to be taken with the secondary bars(1min). The above code works fine with the entry on the primary bar(the 5min), where 'Fade' is the number of tics below to place the entry stop.

    Attached is a picture with an example of the type of entry I want, but just using the secondary bars for entries/exits.
    Attached Files

    #2
    1. Should work.

    2. The first 1 is to identify that this order should go to the secondary bars. The second 1 is the order quantity.

    3. EnterShortStop(1, DefaultQuantity, Lows[1][0] - Fade * TickSize, "3bshell")
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Josh View Post
      1. Should work.

      2. The first 1 is to identify that this order should go to the secondary bars. The second 1 is the order quantity.

      3. EnterShortStop(1, DefaultQuantity, Lows[1][0] - Fade * TickSize, "3bshell")
      Josh, thanks for the reply!

      1.) With the code for the fixed profit and stop losses, which part of the code tells ninja to look at the index 1 in which we added the secondary bars? Do I have to somehow modify the "PO" portion to include the secondary index?
      Code:
      SetProfitTarget("3bSell", CalculationMode.Ticks, PO);
      SetStopLoss("3bSell", CalculationMode.Ticks, ISL, false);
      2 and 3.) I've tried this and I get the following error:
      Code:
        Strategy\ThreeBar.cs    No overload for method 'EnterShortStop' takes '4' arguments    CS1501
      Which I guess is telling me that the "EnterShortStop" Normally takes in 3 arguments, and does not like the extra '1' in the front?

      Comment


        #4
        1. You don't specify it. It will just try to exit ASAP.

        2. My bad. EnterShortStop(int barsInProgressIndex, bool liveUntilCancelled, int quantity, double stopPrice, string signalName)
        EnterShortStop(1, false, DefaultQuantity, Lows[1][0] - Fade * TickSize, "3bshell")
        Josh P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by cmtjoancolmenero, Yesterday, 03:58 PM
        11 responses
        41 views
        0 likes
        Last Post cmtjoancolmenero  
        Started by FrazMann, Today, 11:21 AM
        0 responses
        5 views
        0 likes
        Last Post FrazMann  
        Started by geddyisodin, Yesterday, 05:20 AM
        8 responses
        52 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by DayTradingDEMON, Today, 09:28 AM
        4 responses
        27 views
        0 likes
        Last Post DayTradingDEMON  
        Started by George21, Today, 10:07 AM
        1 response
        22 views
        0 likes
        Last Post NinjaTrader_ChristopherJ  
        Working...
        X