• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SampleAtmStrategy

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

    SampleAtmStrategy

    Hi,



    I looked into other user comments and saw that it is possible to use ATM templates to work with strategies through the SampleAtmStrategy. Is this correct? I was trying to make one such work however i got the following error. this is a SMA crossover strategy just to see it work.

    I get following errors when I try to compile:


    Strategy\TestAtm.cs 'System.Action' does not contain definition of 'Buy' CS0117 - click for info 79 30


    AtmStrategyCreate(Action.Buy, OrderType.Limit, Close[0], 0, TimeInForce.Day, orderId, "StopToEntryStrategy", atmStrategyId);

    Strategy\TestAtm.cs 'System.Action' does not contain definition of 'Sell' CS0117 - click for info 90 31


    AtmStrategyCreate(Action.Sell, OrderType.Limit, Close[0], 0, TimeInForce.Day, orderId, "StopToEntryStrategy", atmStrategyId);



    Thanks in advance,
    Troy
    Last edited by TroyEarth; 01-05-2012, 03:19 PM.

    #2
    Hi Troy,

    I suggest deleting what you have currently and working from the existing sample for this.

    Click Tools > Edit NinjaScript > Strategy
    Select your custom strategies producing errors and then click delete.

    To make a copy of the SampleAtmStrategy, select it first to get to the editor.
    Then right click > Save As and provide a new name

    You now have a working copy of the sample that you can modify.
    Ryan MNinjaTrader Customer Service

    Comment


      #3
      Hi Ryan,

      Thanks a lot for your reply. I managed to compile the SampleAtmStrategy with a simple SMA CrossOverStrategy with no errors YEZZZZ. However when I test this on strategy analyzer its not really working. Not sure what the problem is, but looks like no trades are being entered. Please tell if you see something wrong with this here:

      if (orderId.Length == 0 && atmStrategyId.Length == 0 && CrossAbove(SMA(Fast), SMA(Slow),1))

      {
      atmStrategyId = GetAtmStrategyUniqueId();
      orderId = GetAtmStrategyUniqueId();
      AtmStrategyCreate(Cbi.OrderAction.Buy, OrderType.Limit, Low[0], 0, TimeInForce.Day, orderId, "StopToEntryStrategy", atmStrategyId);
      }


      if (orderId.Length == 0 && atmStrategyId.Length == 0 && CrossBelow(SMA(Fast), SMA(Slow),1))

      {
      atmStrategyId = GetAtmStrategyUniqueId();
      orderId = GetAtmStrategyUniqueId();
      AtmStrategyCreate(Cbi.OrderAction.Sell, OrderType.Limit, Low[0], 0, TimeInForce.Day, orderId, "StopToEntryStrategy", atmStrategyId);

      Thanks in advance.
      Troy

      Comment


        #4
        Unfortunately this is expected. ATM-based strategies are real time only and won't produce trades in a backtest or historical bars.
        Ryan MNinjaTrader Customer Service

        Comment


          #5
          That´s a shame, would have been nice to test :-(.


          Thanks,
          Troy

          Comment


            #6
            Hi Ryan,


            How do I put a simple strategy as the below into action with live data in order to see how it works in the market? and Is it possible to bring it into action with simulated data?


            Thanks in advance,
            Troy

            Comment


              #7
              Yes, you could use Market Replay, live or simulated data here. Just keep in mind the simulated feed option has no historical data. You can activate the SampleAtmStrategy or your modified one directly from the chart (right click > Strategies > pick yours > doubleclick on it > set 'enabled' to 'true' > OK). Open a SuperDOM of your contract then as well to monitor it working.
              BertrandNinjaTrader Customer Service

              Comment


                #8
                Thanks a lot Bertrand, all done. Now curious to see it work:-)

                Troy

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by pstrusi, Today, 03:29 PM
                2 responses
                8 views
                0 likes
                Last Post pstrusi
                by pstrusi
                 
                Started by ntbone, Today, 03:06 PM
                0 responses
                4 views
                0 likes
                Last Post ntbone
                by ntbone
                 
                Started by AMATX, Today, 01:43 PM
                2 responses
                7 views
                0 likes
                Last Post AMATX
                by AMATX
                 
                Started by razeus, Today, 12:00 PM
                3 responses
                17 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by kitwit, Today, 09:47 AM
                5 responses
                24 views
                0 likes
                Last Post NinjaTrader_PaulH  
                Working...
                X