Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Help with Custom ATM

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

    Help with Custom ATM

    Hi,

    I'm new at programing and was wondering whether someone can guide me to a few resources . . .

    I have an indicator that will tell me where I want to enter into a position and in which direction.

    My question is 2-fold . . .

    First, if I already had an ATM strategy saved for manual trading (where I place my trades myself and then let the ATM strategy close me out of my positions), is there anyway I can reference those same ATM strategies in Ninjascript in my automated strategy? Is there any sample code I can review?

    Second, if I have to code the ATM into the strategy, then can someone point me to sample code that will handle ALL aspects of the following scenario:

    Once direction and entry price is established:

    1. Place order to go (long/short) 3 contracts at entry price
    2. When order is filled place OCO: target 1 = 15ticks, target 2 = 30 ticks, target 3 = 100 ticks and stoploss = 15ticks
    3. After price goes 15ticks in my favor (target 1 not necessarily filled), move stop on outstanding contracts to 3ticks
    4. After price goes 30ticks in my favor (target 2 not necessarily filled), move stop on outstanding contracts to breakeven.
    5. After price reaches 50ticks (both target 1 and 2 have been filled), then trail stop on target 3 to 30ticks from current price every 10ticks.

    Thanks for your help
    Last edited by Insearch; 05-18-2010, 09:02 PM.

    #2
    Insearch, for realtime trading / exit management you can just work with AtmStrategyCreate() to place an entry with an ATM exit template attached, sample code could be reviewed in the 'SampleAtmStrategy' we ship per default.

    If you want to backtest such an operation (which the above would not allow you doing), then please review the samples below for a basic starting point in your custom coding -



    BertrandNinjaTrader Customer Service

    Comment


      #3
      Thanks Bertrand,

      I've coded the logic and ATM strategy and have now activated it on my chart. I've deactivated Chart Trader from the chart after setting "ATM Strategy" property to "None".

      Will my automated executions show up on the chart as chart markers (I've set chart property to "Markers Only")?

      Originally posted by NinjaTrader_Bertrand View Post
      Insearch, for realtime trading / exit management you can just work with AtmStrategyCreate() to place an entry with an ATM exit template attached, sample code could be reviewed in the 'SampleAtmStrategy' we ship per default.

      If you want to backtest such an operation (which the above would not allow you doing), then please review the samples below for a basic starting point in your custom coding -



      http://www.ninjatrader.com/support/f...ead.php?t=3751
      Last edited by Insearch; 05-19-2010, 09:15 PM.

      Comment


        #4
        The execution from this NS strategy calling an ATM for exits would not show up in realtime operation on the chart - http://www.ninjatrader-support.com/H...trategies.html

        To monitor, just use another chart or the DOM for this instrument.

        After you've turned the NS strategy off the executions would show then.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Why would this not execute? Is there something obvious that I'm missing? . . just showing the long side of the code . . .

          if (ToTime(Time[0]) >= 093000 && ToTime(Time[0]) <= 153000)
          {
          if(goLong && placeOrder && Position.MarketPosition == MarketPosition.Flat && Low[0] <= lowerTradePrice[0])
          {
          atmStrategyId = GetAtmStrategyUniqueId();
          orderId = GetAtmStrategyUniqueId();
          AtmStrategyCreate(Action.Buy,OrderType.Limit,lower TradePrice[
          0],0,TimeInForce.Day,orderId,"COMMODITY",atmStrategyId);
          placeOrder =
          false;
          }
          Last edited by Insearch; 05-21-2010, 10:16 AM.

          Comment


            #6
            Insearch,

            I suggest you add Print() statements into your code to see if your conditions are true or not. You will want to debug it to see where the code is going. Please also note that ATM strategies only work in real-time. You will not have anything for historical bars.
            Josh P.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Barry Milan, Today, 10:35 PM
            1 response
            8 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by WeyldFalcon, 12-10-2020, 06:48 PM
            14 responses
            1,428 views
            0 likes
            Last Post Handclap0241  
            Started by DJ888, Yesterday, 06:09 PM
            2 responses
            9 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by jeronymite, 04-12-2024, 04:26 PM
            3 responses
            40 views
            0 likes
            Last Post jeronymite  
            Started by bill2023, Today, 08:51 AM
            2 responses
            16 views
            0 likes
            Last Post bill2023  
            Working...
            X