Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Filter multitime

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

    Filter multitime

    Hi,

    I made simple filter, but tester doesn't work and I don't know why (4 versions). There are not any errors. Assumptation is if the day before closed higher than SMA (daily close) go long on the TF 5M.
    Thank you.

    Code below:

    protected override void Initialize()
    {
    Add("$EURUSD",PeriodType.Minute,5);
    Add("$EURUSD",PeriodType.Day,1);
    CalculateOnBarClose = true;
    }

    protected override void OnBarUpdate()
    {
    int ABC=1234;

    if (GetCurrentAsk()>1234)

    // nor if (GetCurrentAsk()>1234 && Closes[2][1] > SMA(BarsArray[2],21)[1])

    // nor if (Closes[1][1]>1234 && Closes[2][1] > SMA(BarsArray[2],21)[1])

    // nor if (CurrentDayOHL().CurrentHigh[1]>1234)
    {
    EnterLong();
    }
    }

    #2
    Hello,

    Thank you for your note.

    From the code the behavior I would expect is that it would try and place trades to each of the 3 data series (the primary of the chart and the 2 added series).

    If the current ask is greater than 1234 then it places a long order.

    GetCurrentAsk() does not work historically. Instead, when in historical data it uses the close price. (This is outlined in the help guide)
    http://www.ninjatrader.com/support/h...currentask.htm

    There is no code to exit the trade, and by default the strategy will have exit on close set to true, causing one exit at the end of the session.

    Also by default the entries per direction is set to 1, meaning if you have one long position, all new long orders are ignored.

    This means, with this script used in the default settings, I would never expect this to make any live trades because it will likely always have a historical position (the script will be yellow in the strategies tab of the control center when started if this is the case).

    Also, the only reference to the SMA is commented out. How is this involved?

    What is the behavior you are getting and what behavior are you expecting?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea,

      thank you for answer.

      If I use: Close[1]>1234 nothing happened.

      There isn't the code to exit because I used SetTrailStop() and SetProfitTarget().

      Yes exactly, because I'd like only one trade per day.

      In the Control center --> Log tab there isn't any info after test.

      Behavior - nothing. No yellow info in the Log tab, no any result in the Strategy Analizer

      If I use syntax from the comment line (any) nothing changed.

      I expect:

      TF of trading is 5M

      If Close day before > SMA 21 && Close 5M candle today > 1234 --> go long

      Comment


        #4
        Hello kot_filemon,

        Are you adding the script to a chart?

        What color is the script in Strategies tab of the Control Center?


        Also there is no stop loss or profit target in your code.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi Chelsea,

          I see misunderstanding. I'd like to do only backtest not on-line trading.

          Comment


            #6
            Hello kot_filemon

            In that case, add TraceOrders = true to Initialize().

            Add a print that prints the bar time when the condition is true just before the order is submitted.

            Open the output window and then backtest again. Post the output on your next post.


            Also, is there data on the Chart tab of the Strategy Analyzer?
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hi Chelsea,

              I add such print function:

              Print("bar time="+Time.ToString());

              directly under conditions.

              Result and chart are in files.
              Attached Files

              Comment


                #8
                Hello,

                There is no text file attached with the output from the output window.

                May I have the text from the output window?
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Yes, of course.....but how do it?

                  Comment


                    #10
                    Hello,

                    Right-click the output window -> select Save As... -> give the file a name.. -> click OK

                    Attach this to your post by clicking the paperclip icon -> select Choose File -> navigate to where the file was saved and select it -> click Open -> click the Upload button -> click OK
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      Hello Chelsea,

                      which output window?

                      Comment


                        #12
                        Hello kot_filemon,

                        The output from the prints... In the output window...

                        Tools -> Output Window...

                        (NinjaTrader 7 only has one output window)
                        Chelsea B.NinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by GLFX005, Today, 03:23 AM
                        0 responses
                        1 view
                        0 likes
                        Last Post GLFX005
                        by GLFX005
                         
                        Started by XXtrader, Yesterday, 11:30 PM
                        2 responses
                        11 views
                        0 likes
                        Last Post XXtrader  
                        Started by Waxavi, Today, 02:10 AM
                        0 responses
                        6 views
                        0 likes
                        Last Post Waxavi
                        by Waxavi
                         
                        Started by TradeForge, Today, 02:09 AM
                        0 responses
                        14 views
                        0 likes
                        Last Post TradeForge  
                        Started by Waxavi, Today, 02:00 AM
                        0 responses
                        3 views
                        0 likes
                        Last Post Waxavi
                        by Waxavi
                         
                        Working...
                        X