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

Is there a way to copy and paste an ATMs code into the unlocked code of a strategy?

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

    Is there a way to copy and paste an ATMs code into the unlocked code of a strategy?

    Hello there,

    I have built several strategies in SB and while I like how they perform in general, I would really like the option to trail positions as I would using my ATMs I built and tested. I know it has been requested for quite some time for us to have the ability to use ATMs in the strategy builder and I am not sure if this has been worked on or not. I do not see a way to do it if it exists. What I have experienced is I create a great entry strategy but the trailing stop performs in a very unacceptable way. I would like to have the price action move x amount of ticks before the trailing stop moves.

    Doing this in a multi step is preferred but I don't see where this is possible either. A 20 tick trailing stop gets hit immediately, a 60 tick stop moves forward but usually doesn't make it to BE and then gets stopped out.

    So as a workaround, I am wondering if this will work and if so, how is it done?

    I have the script for the trailing stop I use in one of my favorite ATMS. Where would I paste this into my strategy unlocked code in order to get it to work? IE: If I put in the user input of 5 lot TS as the trade quantity and associated signal. Where would it need to be pasted in the code?

    Can you see how beneficial it would be if ATM association was built into NT? This is a very round about way to get this to work if it's even possible. I can't upload the file but I will show you what the code looks like for the ATM.

    Thanks for any insight you may be able to provide.

    This XML file does not appear to have any style information associated with it. The document tree is shown below.

    <NinjaTrader>
    <AtmStrategy xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <IsVisible>true</IsVisible>
    <AreLinesConfigurable>true</AreLinesConfigurable>
    <ArePlotsConfigurable>true</ArePlotsConfigurable>
    <BarsToLoad>0</BarsToLoad>
    <DisplayInDataBox>true</DisplayInDataBox>
    <From>2099-12-01T00:00:00</From>
    <Panel>0</Panel>
    <ScaleJustification>Right</ScaleJustification>
    <ShowTransparentPlotsInDataBox>false</ShowTransparentPlotsInDataBox>
    <To>1800-01-01T00:00:00</To>
    <Calculate>OnBarClose</Calculate>
    <Displacement>0</Displacement>
    <IsAutoScale>true</IsAutoScale>
    <IsDataSeriesRequired>false</IsDataSeriesRequired>
    <IsOverlay>false</IsOverlay>
    <Lines/>
    <MaximumBarsLookBack>TwoHundredFiftySix</MaximumBarsLookBack>
    <Name>AtmStrategy</Name>
    <Plots/>
    <SelectedValueSeries>0</SelectedValueSeries>
    <BarsRequiredToTrade>0</BarsRequiredToTrade>
    <Category>Atm</Category>
    <ConnectionLossHandling>KeepRunning</ConnectionLossHandling>
    <DaysToLoad>1</DaysToLoad>
    <DefaultQuantity>1</DefaultQuantity>
    <DisconnectDelaySeconds>0</DisconnectDelaySeconds>
    <EntriesPerDirection>1</EntriesPerDirection>
    <EntryHandling>AllEntries</EntryHandling>
    <ExitOnSessionCloseSeconds>0</ExitOnSessionCloseSeconds>
    <IncludeCommission>false</IncludeCommission>
    <IsAggregated>false</IsAggregated>
    <IsExitOnSessionCloseStrategy>false</IsExitOnSessionCloseStrategy>
    <IsFillLimitOnTouch>false</IsFillLimitOnTouch>
    <IsOptimizeDataSeries>false</IsOptimizeDataSeries>
    <IsStableSession>false</IsStableSession>
    <IsTickReplay>false</IsTickReplay>
    <IsTradingHoursBreakLineVisible>false</IsTradingHoursBreakLineVisible>
    <IsWaitUntilFlat>false</IsWaitUntilFlat>
    <NumberRestartAttempts>0</NumberRestartAttempts>
    <OptimizationPeriod>10</OptimizationPeriod>
    <OrderFillResolution>High</OrderFillResolution>
    <OrderFillResolutionType>Tick</OrderFillResolutionType>
    <OrderFillResolutionValue>1</OrderFillResolutionValue>
    <RestartsWithinMinutes>0</RestartsWithinMinutes>
    <SetOrderQuantity>Strategy</SetOrderQuantity>
    <Slippage>0</Slippage>
    <StartBehavior>AdoptAccountPosition</StartBehavior>
    <StopTargetHandling>ByStrategyPosition</StopTargetHandling>
    <SupportsOptimizationGraph>false</SupportsOptimizationGraph>
    <TestPeriod>28</TestPeriod>
    <TradingHoursSerializable/>
    <Gtd>1800-01-01T00:00:00</Gtd>
    <Template>5 Contract 35 Trail</Template>
    <TimeInForce>Gtc</TimeInForce>
    <AtmSelector>288dbb5251014785a8a955f0e1492f53</AtmSelector>
    <OnBehalfOf/>
    <ReverseAtStopStrategyId>-1</ReverseAtStopStrategyId>
    <ReverseAtTargetStrategyId>-1</ReverseAtTargetStrategyId>
    <ShadowStrategyStrategyId>-1</ShadowStrategyStrategyId>
    <ShadowTemplate/>
    <Brackets>
    <Bracket>
    <Quantity>1</Quantity>
    <StopLoss>35</StopLoss>
    <Target>9</Target>
    </Bracket>
    <Bracket>
    <Quantity>2</Quantity>
    <StopLoss>35</StopLoss>
    <Target>14</Target>
    </Bracket>
    <Bracket>
    <Quantity>1</Quantity>
    <StopLoss>35</StopLoss>
    <Target>19</Target>
    </Bracket>
    <Bracket>
    <Quantity>1</Quantity>
    <StopLoss>35</StopLoss>
    <StopStrategy>
    <AutoBreakEvenPlus>11</AutoBreakEvenPlus>
    <AutoBreakEvenProfitTrigger>15</AutoBreakEvenProfitTrigger>
    <AutoTrailSteps>
    <AutoTrailStep>
    <Frequency>999</Frequency>
    <ProfitTrigger>19</ProfitTrigger>
    <StopLoss>6</StopLoss>
    </AutoTrailStep>
    <AutoTrailStep>
    <Frequency>4</Frequency>
    <ProfitTrigger>24</ProfitTrigger>
    <StopLoss>4</StopLoss>
    </AutoTrailStep>
    <AutoTrailStep>
    <Frequency>2</Frequency>
    <ProfitTrigger>35</ProfitTrigger>
    <StopLoss>2</StopLoss>
    </AutoTrailStep>
    </AutoTrailSteps>
    <IsSimStopEnabled>false</IsSimStopEnabled>
    <VolumeTrigger>0</VolumeTrigger>
    <Template>Tight Range TS NEW TIGHTER</Template>
    </StopStrategy>
    <Target>0</Target>
    </Bracket>
    </Brackets>
    <CalculationMode>Ticks</CalculationMode>
    <ChaseLimit>0</ChaseLimit>
    <EntryQuantity>5</EntryQuantity>
    <InitialTickSize>0</InitialTickSize>
    <IsChase>false</IsChase>
    <IsChaseIfTouched>false</IsChaseIfTouched>
    <IsTargetChase>false</IsTargetChase>
    <ReverseAtStop>false</ReverseAtStop>
    <ReverseAtTarget>false</ReverseAtTarget>
    <UseMitForProfit>false</UseMitForProfit>
    <UseStopLimitForStopLossOrders>false</UseStopLimitForStopLossOrders>
    </AtmStrategy>
    </NinjaTrader>​



    #2
    Hello FireWalker,

    Thanks for your post.

    To use ATM Strategies in a custom NinjaScript strategy, you must unlock the code of the strategy by clicking the 'Unlock code' button and then manually program the strategy to use Atm Strategy Methods.

    NinjaTrader comes with a reference sample called SampleAtmStrategy that you could view to see how to program a NinjaScript strategy to use Atm Strategy Methods. To view the script, open a New > NinjaScript Editor window, open the Strategies folder, and double-click on the SampleAtmStrategy file.

    For more information about Atm Strategy Methods and using ATM Strategies in NinjaScript, see the help guide documentation below.

    Atm Strategy Methods: https://ninjatrader.com/support/help...gy_methods.htm
    Using Atm Strategies in NinjaScript: https://ninjatrader.com/support/help...strategies.htm
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      Thank you for the reply Brandon. Is there a proposal to add ATM strategies into strategy builder? If so I would like or cast my vote in favor of it or if not, I would like to request it to be added. This would make things a lot easier in terms of building the strat if the stop strategy was built into the ATM.

      Another question: Is it possible to build a TS that will wait until the designated number of ticks and then start moving? The parabolic tends to move quickly and I need more time for the trade to run before it moves. What do you suggest for this? Is this in the plans to be added to strat builder?

      Finally: Is it possible to have the unrealized PnL be the trigger to change the trailing stop from one to another. Example: Trailing stop is set to wait until 20 ticks and then trail by 10. If unrealized PnL currency > $500 then trail by 2 ticks. Thoughts? Thanks in advance for your reply. We appreciate you guys.

      Comment


        #4
        Hello Firewalker,

        Thanks for your notes.

        We are tracking interest in an existing internal feature request ticket for the ability to use Atm Strategies in the Strategy Builder and I have added your vote to this feature request.

        This request is being tracked under the number SFT-1986.

        As with all feature requests, interest is tracked before implementation is considered, so we cannot offer an ETA or promise of fulfillment. If implemented, it will be noted on the Release Notes page of the Help Guide.

        Release Notes — https://ninjatrader.com/support/help...ease_notes.htm

        So I may accurately assist, what exactly are you referring to when you mention "TS"?

        Are you referring to a trailing stop?

        If so, you can use exit order methods and add coding logic in the Strategy Builder to accomplish this goal. Please note that you would not be able to use the exit methods and the stops in the stop and targets window as that creates a violation of the managed approach internal order handling rules, linked here: https://ninjatrader.com/support/help...d_approach.htm

        My colleague Chelsea has created educational examples of strategy builder breakeven and trailing stop in the strategy builder here:



        Unrealized PnL could be found in the Strategies folder > Unrealized PnL when creating conditions and you could compare this to a numeric value (Misc folder > Numeric value)

        Conditions: https://ninjatrader.com/support/help...on_builder.htm
        Actions: https://ninjatrader.com/support/help...​​
        Brandon H.NinjaTrader Customer Service

        Comment


          #5
          Yes, I was referring to trailing stop by using TS. I am quite new to builder so I don't know what is allowed or not. I am just trying to find a way to have a multi step exit strategy since it isn't as simple as clicking it in the builder. This seems like an easy option to add from the dev side of things. In the already existing trailing stop box in builder to add "move x number of ticks before trailing"

          I will take a look at what Chelsea came up with and see if it will do what I need to. Thanks again for the help.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by fx.practic, 10-15-2013, 12:53 AM
          5 responses
          5,404 views
          0 likes
          Last Post Bidder
          by Bidder
           
          Started by Shai Samuel, 07-02-2022, 02:46 PM
          4 responses
          95 views
          0 likes
          Last Post Bidder
          by Bidder
           
          Started by DJ888, Yesterday, 10:57 PM
          0 responses
          8 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by MacDad, 02-25-2024, 11:48 PM
          7 responses
          160 views
          0 likes
          Last Post loganjarosz123  
          Started by Belfortbucks, Yesterday, 09:29 PM
          0 responses
          9 views
          0 likes
          Last Post Belfortbucks  
          Working...
          X