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 Radano, 06-10-2021, 01:40 AM
        19 responses
        606 views
        0 likes
        Last Post Radano
        by Radano
         
        Started by KenneGaray, Today, 03:48 AM
        0 responses
        4 views
        0 likes
        Last Post KenneGaray  
        Started by thanajo, 05-04-2021, 02:11 AM
        4 responses
        470 views
        0 likes
        Last Post tradingnasdaqprueba  
        Started by aa731, Today, 02:54 AM
        0 responses
        5 views
        0 likes
        Last Post aa731
        by aa731
         
        Started by Christopher_R, Today, 12:29 AM
        0 responses
        11 views
        0 likes
        Last Post Christopher_R  
        Working...
        X