• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Crossbelow PRC

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

    Crossbelow PRC

    Hi,

    I am using the following to enter a short position when the currentbid has passed above the Sqh line of a polynominal regression channel. I am offsetting the channel, I know the channel is adjusted by current price so is not perfect for a strategy, but I am just experimenting.

    I would like to enter a short position when the price passes above and then crosses below the Sqh line.

    if (GetCurrentBid() >= PRC2(3, 105, 1.62, 2, 34, 34).Sqh[0] + 0 * TickSize)
    {
    EnterShort(DefaultQuantity, "");
    }

    Can anyone help me with the code for this?

    #2
    Hello mccallum28,

    I am not familiar with the PRC2 indicator, but if you are accessing a lines value note that they are not meant to be dynamic; unless it is being drawn from using the DrawHorizontalLine() method or it used the plot value. For an example using the plot as lines you can view the system indicator ConstantLines().

    With that said, what are you expecting to happen and what is happening with that code?

    Happy to be of further assistance.
    JCNinjaTrader Customer Service

    Comment


      #3
      Hi,

      I have attached the strategy and indicator, I just want the strategy to enter short when the price crosses bellow tthe Sqh2 line. And enter long when the price crosses above Sql2.

      I have it set to enter short when the current bid is >= Sqh. So if the price passes through the Sqh line and does not reverse I will have a loosing position.

      I want to enter the trade if the price passes above the line and then crosses back below .

      Does that make sense?
      Attached Files

      Comment


        #4
        Originally posted by mccallum28 View Post
        Hi,

        I have attached the strategy and indicator, I just want the strategy to enter short when the price crosses bellow tthe Sqh2 line. And enter long when the price crosses above Sql2.

        I have it set to enter short when the current bid is >= Sqh. So if the price passes through the Sqh line and does not reverse I will have a loosing position.

        I want to enter the trade if the price passes above the line and then crosses back below .

        Does that make sense?
        There would be no difference if I entered the trade = to or crossing bellow if the price trended within the channels, the reason I want to enter on a specific cross bellow once it has crossed above is in case the price breaks away and the channels adjust as the current bar closes.

        Comment


          #5
          Hello mccallum28,

          Thanks for those files, but I am unable compile due to a dependency of the ZeroLagTEMAandHATEMA indicator. After reviewing the PCR2 indicator though, it is using the plot method for the variables so there should be no problem accessing them.

          You can check the values before you condition(s) to ensure that it is the conditions that you want to enter a trade by using the Print() statement. See the following forum post on how to debug your strategy.
          http://www.ninjatrader.com/support/f...ead.php?t=3418

          Also if you wanted to either post or send me a copy of the PRC2 in the exported zip format I could try to further point you in the right direction. If you want to send it in an email you can send it to support [at] ninjatrader [dot] com and put ATTN: JC with reference to this forum.

          Happy to be of further assistance.
          JCNinjaTrader Customer Service

          Comment


            #6
            Log Error

            When I try to export I get this log error, how do I fix this so i can send you the files?
            Attached Files

            Comment


              #7
              Hello mccallum28,

              That error indicates that there is another indicator that it replies upon for functionality so it will need to be added when you export. When you are trying to export that indicator can you left click on the Export Objects drop down menu then select System indicators, and double click on the @EMA to add it to the export list. Now try to Export it once more.

              Happy to be of further assistance.
              JCNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by martyn73, Today, 05:27 PM
              0 responses
              5 views
              0 likes
              Last Post martyn73  
              Started by MichaelAlexander, 02-22-2017, 05:06 AM
              5 responses
              1,402 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by walter739, Today, 11:56 AM
              3 responses
              10 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by kevinfloresz, Today, 09:46 AM
              4 responses
              29 views
              0 likes
              Last Post kevinfloresz  
              Started by digibob, 12-13-2019, 10:01 PM
              7 responses
              20 views
              0 likes
              Last Post NinjaTrader_ChrisL  
              Working...
              X