Download MetaTrader 5
To add comments, please log in or register
Share your program via Code Base. Gain access to millions of traders!
scatttante2013
9
scatttante2013 2014.10.09 00:59 

I am using the ADX parameter to evaluate the strength in trends over a series of timeframes. The goal being to identify situations where the trend strength in the current period, PERIOD_H1 below, is supported by trend strength in the longer timeframes, PERIOD_H2, and PERIOD_H4. When I debug the cose below and querey the value associated with ADXValue[1,0], I find that it has a value of zero. I subsequently tried to calculate the ADX values for non-standard time frames available in  ENUM_TIMEFRAMES and found a similar result, i.e. ADX returns a zero value. When I say non-standard timeframes, I am referring to those timeframes EXCEPT M1, M5, M15, M30, H1, H4 etc., so a non-standard timeframe would be M10, M12, M20, H2, H3 etc.

Is this an limitation of the ADX routine, or have I over looked something? 

     ADXValue[0,0] = iADX(MyCurrency.Pair,PERIOD_H1,ADXAveragingPeriod,PRICE_CLOSE,MODE_MAIN,1);

     ADXValue[1,0] = iADX(MyCurrency.Pair,PERIOD_H2,ADXAveragingPeriod,PRICE_CLOSE,MODE_MAIN,1);

     ADXValue[2,0] = iADX(MyCurrency.Pair,PERIOD_H4,ADXAveragingPeriod,PRICE_CLOSE,MODE_MAIN,1); 

Keith Watford
Moderator
7873
Keith Watford 2014.10.09 01:17  
ADXValue[0,0] = iADX(MyCurrency.Pair,PERIOD_H1,ADXAveragingPeriod,PRICE_CLOSE,MODE_MAIN,1);

What is MyCurrency.Pair ? 

scatttante2013
9
scatttante2013 2014.10.09 10:44  

GumRai,

Rather than make multiple calls to the server for information about the currency on a specific chart I set up a structure that means I only need to request this information once per currency pair. I have done this with the future goal of trading multiple currencies and when I work through my order list to see the profit / loss values for trades, I want the code to flip between currencies quickly (as opposed to consume computational time make queries to the server). The structure is below, and once digits, pips and points are set (static values) then all I do is query the bid and ask prices once in the code, not multiple times as I found I was doing.

 

struct CurrencyData

       {

       string Pair;

       int    digits;

       double Pips;

       double point;

       double AskPrice;

       double BidPrice;

       }; 

/
To add comments, please log in or register