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

"Ghost" Automated Strategy Doesn't Print to Charts

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

    "Ghost" Automated Strategy Doesn't Print to Charts

    Hello all, I have an automated strategy that actually trades, but the results of those trades are "invisible" to many measures within ninja trader. The following measures do not see the trades that this strategy makes:

    - charts do not show the entry and exit points
    - under the Strategy tab on the control panel, the "position" tab will show no position, even though under the position tab, it will show an open position, and the account performance tab will generate results for that strategy. It will show the trades made, but when I click on the trade in the table to bring up the chart, the chart will not show the trade.
    - backtesting shows zero trades happening, though I know conditions are met and it trades in real time.

    Kind of mysterious. Perhaps it has to do with the way the entry is printing. Here is the relevant code:

    Code:
    if (((Divergence(ergodicfastPeriod, "ergodic", positiveD, 1,ergodicslowPeriod).Plot0[0] == 2 && Divergence(cciPeriod, "cci", positiveD, 9,26).Plot0[0] == 2) ||
    				(Divergence(ergodicfastPeriod, "ergodic", positiveD, 1,ergodicslowPeriod).Plot0[0] == 2 && Divergence(macdfastPeriod, "macd", positiveD, macdsignalPeriod,macdslowPeriod).Plot0[0] == 2) ||
    				(Divergence(cciPeriod, "cci", positiveD, 9,26).Plot0[0] == 2 && Divergence(macdfastPeriod, "macd", positiveD, macdsignalPeriod,macdslowPeriod).Plot0[0] == 2)) &&
    				Position.MarketPosition == MarketPosition.Flat 
                    && LinRegSlope(300)[0] > 0 )
    				{
                    atmStrategyId = GetAtmStrategyUniqueId();
    				orderId = GetAtmStrategyUniqueId();
    				AtmStrategyCreate(Cbi.OrderAction.Buy, OrderType.Limit, Low[0], 0, TimeInForce.Day, orderId, "AtmStrategyTemplate", "Diverg Long ATM Entry");
                	}
                {
    			// Submits an entry limit order at the current low price to initiate an ATM Strategy if both order id and strategy id are in a reset state
                // **** YOU MUST HAVE AN ATM STRATEGY TEMPLATE NAMED 'AtmStrategyTemplate' CREATED IN NINJATRADER (SUPERDOM FOR EXAMPLE) FOR THIS TO WORK ****
    			if (orderId.Length == 0 && atmStrategyId.Length == 0 && Close[0] > Open[0])
    			{
    				atmStrategyId = GetAtmStrategyUniqueId();
    				orderId = GetAtmStrategyUniqueId();
    				AtmStrategyCreate(Cbi.OrderAction.Buy, OrderType.Limit, Low[0], 0, TimeInForce.Day, orderId, "AtmStrategyTemplate", "Diverg Long ATM Entry");
    			}
    As you can see, it is a hybrid of some propietary code and the SampleATMstrategy that comes default with NT.
    Last edited by outstretchedarm; 12-13-2012, 11:06 AM.

    #2
    Hello outstretchedarm,
    Thanks for your note.

    - charts do not show the entry and exit points
    Unfortunately it is expected.

    - under the Strategy tab on the control panel, the "position" tab will show no position, even though under the position tan, it will show an open position, and the accoutn performance tab will generate results for that strategy. It will show the trades made, but when I click on the trade int he table to bring up the chart, the chart will not show the trade.
    The Position class etc are not accessed by the Atm strategy. It is updated if the order is submitted by Managed or Unmanaged approach only.

    The chart will not display the plot executions.


    - backtesting shows zero trades happening, though I know conditions are met and it trades in real time.
    This is expected as an Atm strategy cannot be backtested.
    This method is not backtestable and will not execute on historical data
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      ok. thanks.

      But can you give me any tips on how to properly follow these strategies? I feel like I'm trading blind now.

      Comment


        #4
        Ok to be more clear. I think there are three issues:


        1) Strategies, once enabled, will always show green, and not yellow if the strategy would have been in mid trade (because ATM's don't process historical data). Please confirm.

        2) Strategies won't show open positions in the strategies tab, even if a trade is open. Please confirm.

        3) Question: is there a way to code ATMStrategyCreate() such that, in the orders tab, under "Strategy ID", it lists the actual name of the strategy, and not the numeric identifier such as "6f4846562-75858". I attempted to change:

        Code:
        AtmStrategyCreate(Cbi.OrderAction.Buy, OrderType.Limit, Low[0], 0, TimeInForce.Day, orderId, "AtmStrategyTemplate", "Diverg Long ATM Entry");
        to

        AtmStrategyCreate(Cbi.OrderAction.Buy, OrderType.Limit, Low[0], 0, TimeInForce.Day, "DVLong5", "AtmStrategyTemplate", "Diverg Long ATM Entry");
        but it had no effect; it still prints the numeric ID.

        Thanks again for your help

        Comment


          #5
          Hello outstretchedarm,
          1. Yes, the Atm strategies will be in green state only.

          2. Yes, the Strategies tab wont show the positions.

          3. Unfortunately I am not aware of any know methods to do it. The Atm strategy will display the Id only.
          JoydeepNinjaTrader Customer Service

          Comment


            #6
            ok,thanks for your upfrontness..


            I don't think there are any challenges I've enumerated here that can't be worked around. Especially since most data in NT is available in more than one place, and also since one is able to create a myriad of different sim accounts to isolate different strategies.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Salahinho99, 05-05-2024, 04:13 AM
            7 responses
            55 views
            0 likes
            Last Post Salahinho99  
            Started by knighty6508, 05-10-2024, 01:20 AM
            4 responses
            26 views
            0 likes
            Last Post knighty6508  
            Started by OllieFeraher, 05-09-2024, 11:14 AM
            6 responses
            19 views
            0 likes
            Last Post OllieFeraher  
            Started by PaulMohn, 05-02-2024, 06:59 PM
            2 responses
            44 views
            0 likes
            Last Post PaulMohn  
            Started by ETFVoyageur, Today, 02:10 AM
            0 responses
            19 views
            0 likes
            Last Post ETFVoyageur  
            Working...
            X