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

Orders entered w/o crossover signals

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

    Orders entered w/o crossover signals

    Guys, my NinjaScript only enters an order when there's a cross, but as you can see, i'm getting orders way after crosses.

    Here's the code:

    if (CrossAbove(longSeries, ADX(ADX_Per).ADXPlot, 1) )
    {
    if (Position.MarketPosition == MarketPosition.Short ) {
    exitOrder = ExitShort(Position.Quantity, "exitShortOnLongX", "enterShortOnADX");
    } else if (Position.MarketPosition == MarketPosition.Flat){

    entryOrder = EnterLongLimit(simLotsTraded, GetCurrentBid(), "enterLongOnADX");
    }
    }
    // Condition to short
    if (CrossBelow(shortSeries, ADX(ADX_Per).ADXPlot, 1))
    {
    if (Position.MarketPosition == MarketPosition.Long){
    exitOrder = ExitLong(Position.Quantity, "exitLongOnShortX", "enterLongOnADX");
    } else if (Position.MarketPosition == MarketPosition.Flat){
    entryOrder = EnterShortLimit(simLotsTraded, GetCurrentAsk(), "enterShortOnADX");

    }
    }
    Attached Files

    #2
    Are you referring to the MA plotted on the chart as far as the crossover signals go? Your strategy calls and works with the ADX crossovers...
    BertrandNinjaTrader Customer Service

    Comment


      #3
      no, the green line in the pic is the ADX. I said MA by mistake. don't forget, in the Crosses() functions, I'm using either one of two DataSeries depending upon going long or short, equal to Close-5 pips or Close+5 pips respectively.

      It doesn't seem right and perhaps I just just test whether or not the close crosses && it's 5 pips above/below the ADX.

      Comment


        #4
        You would then need to use the ADXVMA (the MA on the chart) formula then for the strategy, you use the ADX in your strategy code, thus the entries that do not seem to fit.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          why are my ADXVMA plots different

          Hi Bertrand and guys,

          Ok, here's the code and a screenshot. The strategy plots ADXVMA and my chart has the ADXVMA indicator also. As you can see, the two plots are different eventhough the period is the same. Why would this be? The indicator added in the Chart is colored blue and dashed. The green line is added by the strategy.

          protected override void Initialize()
          {
          Log("starting Strategy at " + DateTime.Now.ToString(), LogLevel.Error);
          Add(ADXVMA(ADX_Per));

          CalculateOnBarClose = true;
          //DataSeries shortSeries = new DataSeries(this);
          longSeries = new DataSeries(this);
          shortSeries = new DataSeries(this);

          }

          Comment


            #6
            crmcwi, are the actual values different or just the color / visualization? You can change those with the help of this tip here - http://www.ninjatrader-support2.com/...ead.php?t=3228
            BertrandNinjaTrader Customer Service

            Comment


              #7
              crmcwi,
              please have look here - there is a known issue with ADXVMA in strategys :

              also a discusion about it here :


              maybe that helps.
              max-td
              Last edited by max-td; 08-22-2009, 11:30 AM.

              Comment


                #8
                max-td,

                Thank you very much. The code fix suggested by Josh fixed the issue. I appreciate your help on this.

                Comment


                  #9
                  nice to hear

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by andrewtrades, Today, 04:57 PM
                  1 response
                  5 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Started by chbruno, Today, 04:10 PM
                  0 responses
                  3 views
                  0 likes
                  Last Post chbruno
                  by chbruno
                   
                  Started by josh18955, 03-25-2023, 11:16 AM
                  6 responses
                  436 views
                  0 likes
                  Last Post Delerium  
                  Started by FAQtrader, Today, 03:35 PM
                  0 responses
                  7 views
                  0 likes
                  Last Post FAQtrader  
                  Started by rocketman7, Today, 09:41 AM
                  5 responses
                  19 views
                  0 likes
                  Last Post NinjaTrader_Jesse  
                  Working...
                  X