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 M.NinjaTrader 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 M.NinjaTrader 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 algospoke, Yesterday, 06:40 PM
                2 responses
                19 views
                0 likes
                Last Post algospoke  
                Started by ghoul, Today, 06:02 PM
                3 responses
                14 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by jeronymite, 04-12-2024, 04:26 PM
                3 responses
                45 views
                0 likes
                Last Post jeronymite  
                Started by Barry Milan, Yesterday, 10:35 PM
                7 responses
                20 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by AttiM, 02-14-2024, 05:20 PM
                10 responses
                180 views
                0 likes
                Last Post jeronymite  
                Working...
                X