NexusFi: Find Your Edge


Home Menu

 





NinjaTrader strategy with wrong ADXVMA values


Discussion in NinjaTrader

Updated
    1. trending_up 5,406 views
    2. thumb_up 1 thanks given
    3. group 1 followers
    1. forum 1 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 
GentleTrader's Avatar
 GentleTrader 
Rio de Janeiro - Brazil
 
Experience: Advanced
Platform: Sierra Chart
Broker: Stage5/IQFeed
Trading: ES
Posts: 85 since Jun 2009
Thanks Given: 7
Thanks Received: 47

Hi.

I'm getting wrong ADXVMA values in my strategies. For debugging, I plotted the current values using Print and saw that it was far from the correct values. I've put this in my strategy:

protected override void OnBarUpdate()
{

Print("ADXVMA: " + ADXVMA(21).ADXVMAPlot[0] + " Close: " + Close[0]);
Print("ADXVMA[1]: " + ADXVMA(21).ADXVMAPlot[1] + " Close[1]: " + Close[1]);
Print("===============");
}

The values printed are wrong when I see the correct values of it plotted in the chart.


Follow me on X Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Saylors 41-Month HODL Breaks: Strategy Sells 32 BTC as $ …
Prediction Markets & Event Contracts
Irans Answer Due Today: Peace Surges to 33.5%, Invasion …
Prediction Markets & Event Contracts
April 2026 Jobs Report: +115k vs +65k Expected
Traders Hideout
El Clasico Draws $9.2M in Prediction Market Action -- Bi …
Prediction Markets & Event Contracts
$4.5M Floods Russia Nuclear Contract in 24 Hours -- Krem …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
8 thanks
Darmok and Jalad at Tanagra
1 thanks
  #2 (permalink)
 
GentleTrader's Avatar
 GentleTrader 
Rio de Janeiro - Brazil
 
Experience: Advanced
Platform: Sierra Chart
Broker: Stage5/IQFeed
Trading: ES
Posts: 85 since Jun 2009
Thanks Given: 7
Thanks Received: 47

I just solved the problem. There is an issue in ADXVMA code that is discussed in ADXVMA strategy problem? - NinjaTrader Support Forum .

Cut these lines from the Initalize() method:
Code:
WeightDX = ADXPeriod;
WeightDM = ADXPeriod;
WeightDI = ADXPeriod;
ChandeEMA = ADXPeriod;
Move them to the OnBarUpdate() method:
Code:
if (CurrentBar == 0)
{
WeightDX = ADXPeriod;
WeightDM = ADXPeriod;
WeightDI = ADXPeriod;
ChandeEMA = ADXPeriod;
}


Follow me on X Started this thread Reply With Quote
Thanked by:




Last Updated on August 16, 2009


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts