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

Indicator TRIX

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

    Indicator TRIX

    I have a problem when implementing the TRIX indicator to a strategy, since when it is fulfilled this does not close the position.

    Would be it possible to assist me to solve this?

    Thanks in advance

    Be patience with me English

    // Condition set 8

    if (TRIX(6,3).Default [1] < TRIX(6,3).Signal [1])

    {

    ExitLong(
    "CIERRA BAJISTA", "");

    }

    #2
    Hello fcoobeltran,

    Thanks for writing in today.

    If I gather your code correctly, you would like to exit your position if the TRIX plot drops below the TRIX Signal plot in the previous bar. I would advise to add a condition that checks if you are already long before submitting the exit order, and I would advise to write the statement as a crossover condition. It may look like the following:

    Code:
    if (CrossBelow(TRIX(6, 3), TRIX(6, 3).Signal, 1)
                    && Position.MarketPosition == MarketPosition.Long)
    I would also take the time to double check that any "From Entry Signal" tags match the Entry Signal's string verbatim.

    Please let me know if I may be of further help.
    JimNinjaTrader Customer Service

    Comment


      #3
      Hi Jim,

      Thanks for answer, as well as your advice, which I will take to practice.

      I want to ask you another question, if it does not bother you.

      My idea is to open positions when three conditions are met:
      1) the price of the third candle is above the EMA (50),
      2) the closing price of the third candle is above an EMA (10)
      3) in addition to the FDI indicator (30) is below 1.47.

      The problem I have is that it is not activated when these conditions are met.

      I leave you the code so that with your advice you can debug


      // Condition set 1 (SOLUTION Nª3)
      If (Close [0]> EMA (50) [0]
      && Close [1]> EMA (50) [1]
      && Close [2]> EMA (50) [2]
      && Close [0]> EMA (10) [0]
      && FDI (30) .IndexAbove [0] <1.47
      && FDI (30) .IndexBelow [0] <1.47)
      {
      ;
      EnterLong (CONTRACTS, "ALCIST POSITION");
      }

      Thanks in advance,

      Un saludo (Spanish)

      Francisco
      Be patient with my english

      Comment


        #4
        Hello Francisco,

        Thanks for writing back.

        Your condition checks if the previous 3 bars are greater than the EMA of a period of 50. This is different than exclusively checking if the third bar is greater than the EMA with a period of 50. This is probably not causing your submission issue.

        Your last two conditions in your if statement check if the AboveIndex and BelowIndex lines of the FDI indicator are below 1.47. As far as I can tell, the IndexAbove line will always be greater than 1.5. Removing the condition below should allow you to enter the market.

        Code:
        && FDI (30) .IndexAbove [0] <1.47
        Please make sure this entry signal name ( "ALCIST POSITION" ) matches the From Entry Signal tag in your exit method.

        Please let me know if you have any further questions.
        JimNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Barry Milan, Today, 10:35 PM
        0 responses
        2 views
        0 likes
        Last Post Barry Milan  
        Started by DJ888, Yesterday, 06:09 PM
        2 responses
        9 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by jeronymite, 04-12-2024, 04:26 PM
        3 responses
        40 views
        0 likes
        Last Post jeronymite  
        Started by bill2023, Today, 08:51 AM
        2 responses
        16 views
        0 likes
        Last Post bill2023  
        Started by sidlercom80, 10-28-2023, 08:49 AM
        167 responses
        2,260 views
        0 likes
        Last Post jeronymite  
        Working...
        X