Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Advanced Sample

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

    Advanced Sample

    Hello,

    I read all tips and samples about strategy development. But already i can't code my strategy idea(Before i wrote dozzens of indicator for ninja trader platform). Samples very basic and there is not any complex sample. Could you please help me. My idea so complex and have many drudgery steps. But basically:

    PHASE 1) Give Order

    1-If price above 200SMA and price.close crossabove EMA50 (this is signal bar) go long next bar
    2-Long like this,
    entry...3 unique 1lot size position signalbar.high + 10pip (3 times BuyStop Order)
    stoploss... all position stopploss same entryprice - 50pip
    takeprofit...each position takeprofit different 1.entryprice+50pip, 2.entryprice+100pip, 3.0pip(we'll trail via EMA)
    4-If price below 200SMA and price.close crossbelow EMA50 (signal bar) go short
    5-Short like this,
    entry...3 unique 1lot size position signalbar.low - 10pip (3 times SellStop Order)
    stoploss... all position stopploss same entryprice + 50pip
    takeprofit...each position takeprofit different 1.entryprice-50pip, 2.entryprice-100pip, 3.0pip(we'll trail via EMA)

    PHASE 2) Manage Orders
    1-If BuyStop order not triggered and Bars after signal bar crossbelow 50EMA all orders cancel(we will wait other cross for entry)
    2-If SellStop order not triggered and Bars after signal bar crossabove 50EMA all orders cancel(we will wait other cross for entry)
    3-If any order filled, If trio target1 is attain then other two position will move breakeven(stoploss levels don't change if this event don't accrue). Then if target2 is attain, so we have only one open position at this time, we start follow market via 20EMA. I mean we have to update stoploss level via 20EMA value each bar close
    4-More importantly maybe we have many orders at any time I mean maybe price cross 50EMA more then one but we have to manage this trios separately.

    I don't imagine all problems about open positions in this strategy. I mean suppose we give an BuyStop Order next bar open with GAP more then our enttry price. So this order maybe have to update Buy Limit. Actually i have difficulties about order management phase.

    If you write this sample i'll continue to write to my orginal idea. Plus excuse me about my poor English. Thanks.

    Best Regards.
    Last edited by aytacasan; 08-16-2011, 01:44 PM. Reason: Addition

    #2
    Hello aytacasan,

    NinjaTrader does not provide custom strategy development services, but this is offered by our partners: NinjaScript consultants. Please see the link below for a list of our 3rd party NinjaScript consultants:

    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Hello Ryan,

      Yes I know that NinjaTrader does not provide custom strategy development services. Already I don't want to this from Ninja Trader. Beside, I don't want to contact 3rd party NinjaScript consultants. I'm only need what is order manangment process(logic) in Nina Trader. Your helps and samples not insufficient for this. Maybe this way all forum users can take advantage of code strategy. I don't want to do any patment for your deficiency.

      Still thanks for response.

      Comment


        #4
        Sure, will leave this open for other community members to respond.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Well, I agree that we don't have enough informations about the unmanaged method.We can find many pieces but not a strategy using all the power of this method.
          It would be nice to have a simple sample strategy with a complet order handling method, even only a MMA crossover system.
          Alchi

          Comment


            #6
            Hello My Friend,

            Yes i'm thinking like you. Strategy samples so simple and inadequate. Help files too. I don't belive strategies, because technology without human is worthless and prone to error. But belive or not, you must have system for success when you trade manually. First you must test your system before use it in real account. At this point Ninja Trader very valuable but we don't benefit it. Because resources not enough. For example already i don't understand how can i do simple order and position tracking in Ninja via managed or unmanaged method. I don't say Ninja have to code our systems or ideas, but have to show the road and to tell what is platform concept.

            Additionally this will benefit for Ninja Trader platform. If platform uses many traders so it'll be more popular. For example because of this difficulties i'll try to code my strategy other trading platform that support c# too(Because of not be ethically correct i don't say its name here). So i'll talk other traders this platform not Ninja Trader platform.

            My suggestion Ninja Trader have to tell and show more about logic via good samples. And don't forward your funs to 3 parties in simplest cases.

            Am I wrong?
            Last edited by aytacasan; 08-17-2011, 12:47 AM.

            Comment


              #7
              Humm, may be you're a little bit rough, because NT is well documented. Righ now the unmanaged method is the only part that is less on my point of view. And it is for advanced programmers. As you said in a post in 2010 "I don't need assist any NinjaScript consultant. Already I'm proffessional programmer". So i guess it should not be so complicate for you to handle this process. For variables tracking I use printing in the output windows and "traceorder" to see what happen exactly. I also use "strategyplot" to put my Dataseries on the screen to see when it trigger. I would add that paying few $ to have a consultant helps is not that much comparing to what the market rewards us, but it's clearly more interessting to learn how to do it ourself.
              Keep cool

              Comment


                #8
                Hello Alchimix,

                No Ninja Trader not well documented and samples have 5-10 lines. if the subject on writing indicator this help documents maybe enough but for writing strategy certainly not. You can write strayegy with through this help documents you win in test account but not real account. I'm writing strategies for other trading platforms that have 100-700 lines code. There is no difference managed and unmanaged strategies, only managed strategy safe you some difficuties. For example in my example you have to use unmanaged type strategy. Yes I write code since 1997 but this does not require to write strategy with trouble(actually i'm writing production softwares for companies). I know about the methods you mentioned, thank you anyway. Definitely i don't any payment while i continue to write, even if I'm a millionaire

                "I would add that paying few $ to have a consultant helps is not that much comparing to what the market rewards us" you must be in %5 trader profile, nice In the economy schools, the first rule taught is small invester always loses. I trade real account only for real account tests. Whatever i give up write strategy with NT.

                Have a nice day.

                Comment


                  #9
                  We have a couple dedicated samples for order management. They are available for programmers to make use of, and some aspects of these require an understanding of object oriented coding principles.

                  Here are a few to get you started working with these concepts:
                  Using OnOrderUpdate() and OnExecution() methods to submit protective orders
                  Using CancelOrder() method to cancel orders

                  The advanced event handlers are detailed here:
                  Ryan M.NinjaTrader Customer Service

                  Comment


                    #10
                    Hello Ryan,

                    I don't sure am i explored this links before. But this night i'll check this links.

                    Thanks.

                    Comment


                      #11
                      Hi Ryan,

                      http://www.ninjatrader.com/support/f...ead.php?t=7499 example have this line in OnExecution method:

                      if (execution.Order.OrderState == OrderState.Filled || execution.Order.OrderState == OrderState.PartFilled || (execution.Order.OrderState == OrderState.Cancelled && execution.Order.Filled > 0))

                      I think (execution.Order.OrderState == OrderState.Cancelled && execution.Order.Filled > 0) must be like this (execution.Order.OrderState != OrderState.Cancelled && execution.Order.Filled > 0)

                      Am i right or mising something?

                      Also I write unmanaged type strategy. I have one problem when i enter "moving stoploss for last position" phase i have receive error message belove:

                      **NT** A BuyToCover stop order placed at '11.02.2011 03:00:00' has been ignored since the stop price is less than or equal to the close price of the current bar. This is an invalid order and subsequent orders may also be ignored. Please fix your strategy.

                      The strategy runing CalculateOnBarClose. And before set new stoploss level i'm checking new stoploss level < close[0]. And when i look chart '11.02.2011 03:00:00' and later bars there is no closed bar at this level. Could you please tell me where is my fault?

                      Thanks...
                      Last edited by aytacasan; 08-18-2011, 03:42 PM.

                      Comment


                        #12
                        The sample is illustrative, and you can take concepts and integrate it into your own strategy. Those lines are showing examples of OrderStates you can check for.

                        You will have to debug and check all values there. That message should not be coming up unless you're submitting an invalid order. You can use the IOrders interface to expose information about an order, like the price submitted, and compare that to close price.
                        Ryan M.NinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                        0 responses
                        669 views
                        0 likes
                        Last Post Geovanny Suaza  
                        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                        0 responses
                        378 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by Mindset, 02-09-2026, 11:44 AM
                        0 responses
                        111 views
                        0 likes
                        Last Post Mindset
                        by Mindset
                         
                        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                        0 responses
                        575 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by RFrosty, 01-28-2026, 06:49 PM
                        0 responses
                        580 views
                        1 like
                        Last Post RFrosty
                        by RFrosty
                         
                        Working...
                        X