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

Several questions about Displaying Trades/Orders

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

    Several questions about Displaying Trades/Orders

    I have several questions.

    1) when XYZ strategy is applied on chart, there is no indication, whether trade happened on "historical" or really executed ones. However, as i know, the only solution is to use
    Code:
    if(Historical) return
    , right?

    2) there is another problem. Let's say, i disable showing trades on historical bars. But lets say, the XYZ strategy made a trade and then i close NinjaTrader and re-opened the chart. Then it wont show the "historical" (but real trade). How can i force NT to show the "real" but historical trades?
    Code:
    if(Historical) return
    is not SOLUTION!

    3) this raises another problem. When strategy has open position, and CHART/NT is closed, then position remains. When I re-apply that strategy on chart (and it uses
    Code:
    if(Historical) return
    ) then XYZ strategy thinks that at this moment, MARKETPOSITION variable is FLAT, and tries to execute the "ENTRY" trade on chart, which causes double trades and serious problems.

    what are easy solutions and reccommendations for people, who want to REAL TRADE with strategies? so many problems are there ...

    please divide your answer in paragraphs (like I've asked). thanks so much
    Last edited by ttodua; 10-12-2017, 02:09 AM.

    #2
    Hello TazoTodua,

    Thank you for your note.

    If you use,

    Code:
    if(Historical) return
    Do you get the results you desire?

    Your code below is checking if the state is not historical, and if so, return, rather than checking if it is historical then returning.
    Code:
    if(!Historical) return
    I look forward to your reply.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Alan, sorry, mechanical mistake was that. i wanted to say `if(Historical) return;`
      i have modified original question too.
      now you can answer it.

      Comment


        #4
        Hello TazoTodua,

        Are you seeing historical trades which were not taken live with,

        Code:
        if(Historical) return
        I look forward to your reply.
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          i dont see any trades when using that.

          Comment


            #6
            Hello TazoTodua,

            Thank you for your response.

            Please see my responses to your inquiries below:
            Originally posted by TazoTodua View Post
            1) when XYZ strategy is applied on chart, there is no indication, whether trade happened on "historical" or really executed ones. However, as i know, the only solution is to use
            Code:
            if(Historical) return
            , right?

            2) there is another problem. Let's say, i disable showing trades on historical bars. But lets say, the XYZ strategy made a trade and then i close NinjaTrader and re-opened the chart. Then it wont show the "historical" (but real trade). How can i force NT to show the "real" but historical trades?
            Code:
            if(Historical) return
            is not SOLUTION!
            I would like to answer both of these question together. If we don't have the 'if (Historical) return;' line of code in the strategy then, as you stated, it only shows the historical trades on the chart going back from the first real-time bar on the chart. However, there is a means to show actual trades the strategy took and the historical trades separately.

            Please right click in your chart that the strategy is applied to -> select 'Strategy Performance' -> then select your strategy -> please then select 'Realtime Performance'. This will show the actual trades the strategy instance has taken on the account selected for the strategy.

            To show only the historical (backtest trades) right click in the chart -> select 'Strategy Performance' -> select your strategy -> 'Historical performance'.

            Unfortunately, there is no means to separate the historical and real-time trades on the chart itself.

            Originally posted by TazoTodua View Post
            3) this raises another problem. When strategy has open position, and CHART/NT is closed, then position remains. When I re-apply that strategy on chart (and it uses
            Code:
            if(Historical) return
            ) then XYZ strategy thinks that at this moment, MARKETPOSITION variable is FLAT, and tries to execute the "ENTRY" trade on chart, which causes double trades and serious problems.

            what are easy solutions and reccommendations for people, who want to REAL TRADE with strategies? so many problems are there ...
            For this, I would say the use of 'if (Historical) return;' should be removed from your strategy, as the 'if (Historical) return;' line is only implemented in your case to prevent historical (backtest trades) that did not occur from showing on the chart.

            Your strategy logic is hindered in this case by that line of code, it is preventing your strategy from picking up prior orders.

            Please let me know if you have any questions.

            Comment


              #7
              Unfortunately, there is no means to separate the historical and real-time trades on the chart itself.
              this will be good if you will implement some option to differentiate them. I am surprised how other people dont request this change as a ticket.

              thanks.

              Comment


                #8
                Hello TazoTodua,

                I will put in a feature request for this.

                Thank you for your suggestion.
                Alan P.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by RookieTrader, Today, 09:37 AM
                3 responses
                15 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by kulwinder73, Today, 10:31 AM
                0 responses
                5 views
                0 likes
                Last Post kulwinder73  
                Started by terofs, Yesterday, 04:18 PM
                1 response
                23 views
                0 likes
                Last Post terofs
                by terofs
                 
                Started by CommonWhale, Today, 09:55 AM
                1 response
                4 views
                0 likes
                Last Post NinjaTrader_Erick  
                Started by Gerik, Today, 09:40 AM
                2 responses
                7 views
                0 likes
                Last Post Gerik
                by Gerik
                 
                Working...
                X