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

Stochastics

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

    Stochastics

    Dear Cservice,

    I'm trying to build an exit strategy on the stochastics. I used the following line:

    if (Stochastics(3,5,4).Values[1][1] < Stochastics(3,5,4).Values[2][1] && Stochastics(3,5,4).Values[1][0] > Stochastics(3,5,4).Values[2][0])
    {
    ExitShort();

    I should be a crossover of the stochastics line up and down. On this line my exit is later then the crossover. Am I using the right value?

    #2
    Hello,

    Thank you for the question.

    I wanted to clarify, by "On this line my exit is later then the crossover" do you mean it appears on the following bar or is the exit multiple bars after?

    Additionally, can you tell me is this a Backtest or Realtime you are referring to?

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thanks for your reply.

      The exit follows diverse. Sometimes multiple bars later and sometimes 1 bar later. I use the calculate on close is true.

      I've only used it in backtesting.

      In addition, I thought that multiplying the OsMA or MACD would give me a perspective of a later chart. But when I tested it, it had a delay of aprox 4/8 hours.

      I'm trying to filter my rules by adding the OsMA or MACD on a 4H chart. The basic rules are on a 1H chart. Is it possible to build a strategy on multiple timeframes?

      Kind regards,

      Comment


        #4
        Hello,

        Thank you for the additional details.

        It is possible to build multi time frame strategies, in that case you could calculate the indicators on a secondary series data and do other logic with the base chart series.
        We have more on this here: http://ninjatrader.com/support/helpG...nstruments.htm

        Regarding your initial question, it helps to know this is variable when the exit is happening, that could indicate either the condition is becoming true at random points after the point in which you think it should. It could also be that there is other logic creating an ignored order situation.

        Its really hard to say with only this part of the code, would you be able to upload the full script or a sample and possibly an image of the results you get?

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Here it is in a .doc file. Hope you can find the error.

          For the multiple I'm using the BarArray. Is that still in use?
          Attached Files

          Comment


            #6
            Hello Robert87,

            Thanks for your post.

            Please try the syntax of:

            Stochastics(Barsarray[0], 3, 5, 4).D[0] this is the primary bars (BarsArray[0]) Stochastics "D" using the current bar [0]

            Here is a link to the helpguide: http://ninjatrader.com/support/helpG...tochastics.htm
            Paul H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Haiasi, 04-25-2024, 06:53 PM
            2 responses
            16 views
            0 likes
            Last Post Massinisa  
            Started by Creamers, Today, 05:32 AM
            0 responses
            4 views
            0 likes
            Last Post Creamers  
            Started by Segwin, 05-07-2018, 02:15 PM
            12 responses
            1,785 views
            0 likes
            Last Post Leafcutter  
            Started by poplagelu, Today, 05:00 AM
            0 responses
            3 views
            0 likes
            Last Post poplagelu  
            Started by fx.practic, 10-15-2013, 12:53 AM
            5 responses
            5,407 views
            0 likes
            Last Post Bidder
            by Bidder
             
            Working...
            X