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

Anyone familiar with Accumulation Distribution Strategy?

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

    Anyone familiar with Accumulation Distribution Strategy?

    Hi,

    Is anyone familiar with the Accumulation Distribution Strategy that it appears Jim may have code for an old Stocks and Commodities magazine article. The strategy looks really interesting but a little difficult for me to grasp as just learning C Sharp.

    I was wondering if it could be applied to futures contracts?

    I can't quite figure out how to add a EnterShort() section of code ?

    Right now it only goes long, for educational purposes only if anyone has given it a shot or can offer suggestions on adding code to also go short that would be great.

    Was also wondering if this would be an applicable strategy for non time based charts like renko/unirenko where volume is not available?

    Thanks for the help I wish I had a few days to really study this strategy but unfortunately barely keeping my head above water implementing a few automated trading strategies.

    Here is a portion of the code to see if it rings any bells?


    protected override void OnBarUpdate()
    {
    if (CurrentBar < Length || CurrentBar < 12 || CurrentBar < VolAvg || CurrentBar < VolDelay)
    return;

    // Persist previous Top and Bot
    Top[0] = Top[1];
    Bot[0] = Bot[1];

    Range_[0] = MAX(High, Length)[0] - MIN(Low, Length)[0];

    if (Range_[0] < ConsolidationFactor * Range_[Length])
    {
    Top[0] = MAX(High, Length)[0];
    Bot[0] = MIN(Low, Length)[0];
    }

    if (ToDay(Time[0]) > 20030101 && Close[0] > Top[0] && Bot[0] > Bot[12]
    && SMA(Volume, VolAvg)[VolDelay] > VolRatio * SMA(Volume, VolAvg)[VolAvg + VolDelay])
    {
    int ProfitQuantity = 0;
    if (TradeProfit)
    ProfitQuantity = (int)Math.Floor(SystemPerformance.RealTimeTrades.T radesPerformance.NetProfit / Close[0]);
    EnterLong((int)Math.Floor(AmountToBuy / Close[0]) + ProfitQuantity);
    }
    if (Position.MarketPosition == MarketPosition.Long && Close[0] < Bot[0])
    ExitLong();
    }

    #2
    Hello demarcog,

    Thanks for the post.

    I was wondering if it could be applied to futures contracts?
    Yes, you can apply this to a futures instrument and the methods to submit orders would work. I don't know if the script will be relevant to futures instruments, you would need to try it out and see if it suits your needs on the futures instruments you trade. If you need to you can modify this to work on the instrument you trade so its specific for that goal.

    I can't quite figure out how to add a EnterShort() section of code ?
    What part are you having difficulty with surrounding adding that? The script has no short logic at all so if you were going to add a EnterShort you would also need to figure out how the conditions to do that should work. Right now the script enters long and exits long only.

    Was also wondering if this would be an applicable strategy for non time based charts like renko/unirenko where volume is not available?
    You would still have access to a Volume series with those type of BarsTypes. Again I don't know how relevant that would be, you would need to give it a try and see how it performs in the specific use case where you wanted to use this code.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Jesse,

      Thanks very much for the very helpful response I really appreciate it.

      I should have been more clear, apologies.I was asking if anyone was familiar or has documentation on the logic so I could code the conditions to reverse the logic and go short. There are no comments in the code and having trouble figuring out what is going on to be able to code the EnterShort.


      I saw a reference to NinjaTrader_Jim and thought perhaps he could explain in a few sentences the logic to go long and short and how he is calculating position size as it's a technique I've never seen before, ie,. using RealTimeTradePerformance.

      It's a fascinating and IMHO brilliant coding technique was just hoping to learn enough about the trade entry criteria, the position sizing. This way I could code the short side and see what changes need to be made to trade one contract. I could probably just hard code position size but was interested in Jim's code.

      thank you

      glen
      Last edited by demarcog; 05-26-2021, 09:51 AM.

      Comment


        #4
        Hi demarcog,
        The article of Domenico D'Errico & Antonio Zaffino in Stocks & Commodities (August 2018) is really worth reading.
        The strategy discussed is long only and so are the code and the statistics, but the authors mention that investors might open short positions in the distribution phase.
        NT-Roland

        Comment


          #5
          Hi NT-Roland,

          Thanks very much for the information I will try and get the article.

          glen

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Brevo, Today, 01:45 AM
          0 responses
          2 views
          0 likes
          Last Post Brevo
          by Brevo
           
          Started by aussugardefender, Today, 01:07 AM
          0 responses
          3 views
          0 likes
          Last Post aussugardefender  
          Started by pvincent, 06-23-2022, 12:53 PM
          14 responses
          238 views
          0 likes
          Last Post Nyman
          by Nyman
           
          Started by TraderG23, 12-08-2023, 07:56 AM
          9 responses
          384 views
          1 like
          Last Post Gavini
          by Gavini
           
          Started by oviejo, Today, 12:28 AM
          0 responses
          4 views
          0 likes
          Last Post oviejo
          by oviejo
           
          Working...
          X