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

The BarsArray [1], do not work when CalculateOnBarClose = false;

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

    #16
    Hi All,
    Thank you all, for your recomendations.
    Now all the entry parameters are satisfied, I have a problem with the exit
    ************************************************** ******************************************
    protected override void Initialize()
    {
    AddLineBreak("6E ##-##",PeriodType.Tick,LBticks, LBretorno, MarketDataType.Last);

    Add("6E ##-##",PeriodType.Volume,Volumen,MarketDataType.Last) ;


    protected override void OnBarUpdate()
    {
    if(BarsInProgress != 0)
    return;
    if (Position.MarketPosition == MarketPosition.Flat)
    {
    ..............
    && Close[0] < BollingerBorde(2, PerBoll).Middle[0] - VarBoll * TickSize
    && Closes[1][1] < BollingerBorde((BarsArray[1]),2, PerBoll).InfB[1]
    && WMA(BarsArray[2],PerWMA)[0] > WMA(BarsArray[2],PerWMA)[1])
    {
    EnterLong(DefaultQuantity, "1LBW");
    }
    ,,,,,,,,,,,
    else if (Position.MarketPosition == MarketPosition.Long)
    {
    if (WMA(BarsArray[2],PerWMA)[0] < WMA(BarsArray[2],PerWMA)[1])
    {
    ExitLong("1LBW", "1LBW");
    }
    }
    ************************************************** *******************************************
    I can not find the error.
    Last edited by MarianoMA; 09-15-2014, 10:06 AM.

    Comment


      #17
      MarianoMA, great the entries issue is resolved - what issue exactly is happening on the exits? Are you not seeing it trigger at all? Or at a place you would not expect?
      BertrandNinjaTrader Customer Service

      Comment


        #18
        Thank you very much

        No out where you are asked.

        WMA(BarsArray[2],PerWMA)[0] < WMA(BarsArray[2],PerWMA)[1]

        Exit only, after closing the candle at based chart (BarsInProgress == 0)
        Please look at the attached charts.
        Attached Files
        Last edited by MarianoMA; 09-15-2014, 11:42 AM.

        Comment


          #19
          Hello MarianoMA,

          Thank you for your response.

          Can you attach the strategy's .cs file to your reponse? You will find the .cs file under the following directory on your PC: (My) Documents\NinjaTrader 7\bin\Custom\Strategy

          Comment


            #20
            thank you very much Patrick H.

            I also added the "BollingerBorde" indicator
            Attached Files
            Last edited by MarianoMA; 09-15-2014, 02:44 PM.

            Comment


              #21
              Hello MarianoMA,

              Thank you for your response.

              Since you are using both Set and Exit methods they are likely conflicting and the Exit methods are being ignored. Please try commenting out the SetProfitTarget() and SetStopLoss() methods in the Initialize() method, then test the strategy again.

              Comment


                #22
                Thank you very much
                I have removed the set Profit / Stoploss,

                In both areas (see attached in Simulated Data Feed) WMA (BarsArray [2] PerWMA) [0] <WMA (BarsArray [2] PerWMA) [1] and does not satisfy the exit condition
                Attached Files
                Last edited by MarianoMA; 09-16-2014, 03:01 AM.

                Comment


                  #23
                  Hello MarianoMA,

                  Thank you for your response.

                  Please enable TraceOrders for your strategy and test again, then check the Output window (Tools > Output). For information on TraceOrders please visit the following link: http://www.ninjatrader.com/support/h...raceorders.htm

                  Comment


                    #24
                    Thank you Patrick H.

                    I've put the TraceOrders = true; as you recommended me,
                    but I still can not find the problem.
                    Exit only after the close of the candle LineBreak
                    No satisfies the exit conditions
                    Please see the attached chart.
                    Attached Files

                    Comment


                      #25
                      Now worse, is that they have not respected conditions of exit

                      This is what writes the output window:

                      16/09/2014 20:18:45 Entered internal PlaceOrder() method at 16/09/2014 20:18:45: BarsInProgress=0 Action=SellShort OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='1CBW' FromEntrySignal=''
                      16/09/2014 20:19:22 Entered internal PlaceOrder() method at 16/09/2014 20:19:22: BarsInProgress=0 Action=BuyToCover OrderType=Market Quantity=0 LimitPrice=0 StopPrice=0 SignalName='1CBW' FromEntrySignal='1CBW'

                      Please observe in the chart
                      Attached Files

                      Comment


                        #26
                        Hello MarianoMA,

                        Thank you for your response.

                        So you don't want them to close on the LineBreak?

                        Comment


                          #27
                          Thank you so much Patrick H.

                          I want to satisfy the only exit condition, is when WMA(BarsArray[2],PerWMA)[0] > WMA(BarsArray[2],PerWMA)[1] , for volume candles

                          Comment


                            #28
                            Thank you so much Patrick H.

                            Another example of a simple strategy and does not satisfies the exit conditions

                            I added the strategy
                            Attached Files

                            Comment


                              #29
                              Hello MarianoMA,

                              Thank you for your response.

                              I would recommend enabling TradeOrders in your strategy and opening the Output window to see information on the orders after backtesting the strategy. You can find information on TraceOrders at the following link: http://www.ninjatrader.com/support/h...raceorders.htm

                              Comment


                                #30
                                Thank you Patrick H.

                                These are the results of the output window so normal.
                                Still does not satisfy the exit conditions

                                AlertLevel: 40
                                17/09/2014 20:28:13 Entered internal PlaceOrder() method at 17/09/2014 20:28:13: BarsInProgress=0 Action=Buy OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal=''
                                17/09/2014 20:28:51 Entered internal PlaceOrder() method at 17/09/2014 20:28:51: BarsInProgress=0 Action=Sell OrderType=Market Quantity=0 LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal=''
                                Attached Files

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Taddypole, Today, 02:47 PM
                                0 responses
                                0 views
                                0 likes
                                Last Post Taddypole  
                                Started by chbruno, 04-24-2024, 04:10 PM
                                4 responses
                                50 views
                                0 likes
                                Last Post chbruno
                                by chbruno
                                 
                                Started by TraderG23, 12-08-2023, 07:56 AM
                                10 responses
                                399 views
                                1 like
                                Last Post beobast
                                by beobast
                                 
                                Started by lorem, Yesterday, 09:18 AM
                                5 responses
                                22 views
                                0 likes
                                Last Post NinjaTrader_ChelseaB  
                                Started by WHICKED, Today, 12:56 PM
                                2 responses
                                15 views
                                0 likes
                                Last Post WHICKED
                                by WHICKED
                                 
                                Working...
                                X