Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SetProfitTarget() does not appear to work in SampleMACrossOver strategy.

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

    SetProfitTarget() does not appear to work in SampleMACrossOver strategy.

    I am trying to get a working knowledge of SetProfitTarget() in a working ninjascript strategy.
    I made a copy of the SampleMACrossOver strategy

    I added the following lines in OnStateChange():

    else if (State == State.Configure) {
    SetParabolicStop(CalculationMode.Ticks, 20);
    }

    In OnBarUpdate() I commented out the short order so that only long orders would be generated:

    else if (CrossBelow(smaFast, smaSlow, 1)) {
    // EnterShort();
    }

    I ran the strategy on CL 04-20 around the date 3/1/2020. Almost all of the time the strategy exited based on session close even though the stop losses were huge and the long order should have been stopped out by the Parabolic stop. Running the same strategy with a Trailing Stop of 20 ticks creates a lot of stop orders.

    I do not understand why SetParabolicStop() does not create obvious stop orders.

    #2
    Hello robertlaub,

    Are you using the settings suggested by the indicator of 0.02, 0.2, and 0.02?

    Try setting the parabolic stop to a smaller tick distance like 5.

    Do you still see that there are no exits when using these settings?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I mistyped in the title: "SetProfitTarget()" should have read "SetParabolicStop()".

      I attached two files. One is the script which I used called SamepleMACrossOverRob. It is a modified version of the SampleMACrossOver strategy found in the standard NT8 distribution.The second file is a pdf which shows the results of running a backtest on SamepleMACrossOverRob using the "Strategy Analyzer".

      Even though the script uses "SetParabolicStop(CalculationMode.Ticks, 60);", the backtest shows one of the trades losing over $10,000. 60 ticks on the ES is worth $750.
      Attached Files

      Comment


        #4
        Hello robertlaub,

        What is the entry price and exit price of the trade?
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by techgetgame, Yesterday, 11:42 PM
        0 responses
        8 views
        0 likes
        Last Post techgetgame  
        Started by sephichapdson, Yesterday, 11:36 PM
        0 responses
        2 views
        0 likes
        Last Post sephichapdson  
        Started by bortz, 11-06-2023, 08:04 AM
        47 responses
        1,613 views
        0 likes
        Last Post aligator  
        Started by jaybedreamin, Yesterday, 05:56 PM
        0 responses
        10 views
        0 likes
        Last Post jaybedreamin  
        Started by DJ888, 04-16-2024, 06:09 PM
        6 responses
        20 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Working...
        X