MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal

Automated Trading and Strategy Testing Forum

Interview with Boris Odintsov (ATC 2010) Interview with Boris Odintsov (ATC 2010) Subscribe to signal
Denver
533.75%, 19 012.41 USD
Screenshot
AUDJPY, M10
Demo
History of trade Script
History of trade
Author: satop
USDominator LineUSDominator Line Try product
USDominator Line
Author: MoneyJinn

// Envelope indicator upper/lower values are the same

To add comments, please log in or register
Ryan Leland
22
RyanLeland 2012.08.19 20:54

Hey all, I'm a total noob and just experimenting for now. Been playing with, and learning strategies, but I am having issues with using the envelopes indicator.

Given the following code, my upper and lower values are getting output as exactly the same. Any help would be really appreciated.

envelope_handle = iEnvelopes(_Symbol, PERIOD_M1, envelope_period, 0, MODE_LWMA, PRICE_MEDIAN, envelope_deviation);

double env_lower[3], env_upper[3];
   
if (CopyBuffer(envelope_handle, 0, 0, 2, env_lower) < 2 
    || CopyBuffer(envelope_handle, 1, 0, 2, env_upper) < 2) {
      
   Print("No data from CopyBuffer");
   return;
}
   
Comment("upper: ", env_upper[1], " lower: ", env_lower[1]);
Ryan Leland
22
RyanLeland 2012.08.19 21:50

Trying to call ArraySetAsSeries is also failing on both env_lower and env_upper.

ArraySetAsSeries(env_lower, true);
Shaharudin Ahmad
351
jelam 2012.08.20 00:22

hi ryanleland

try this

 

double      env_lower[];                     int  envelope_handle;
double      env_upper[];

 envelope_handle = iEnvelopes(_Symbol, PERIOD_M1, envelope_period, 0, MODE_LWMA, PRICE_MEDIAN, envelope_deviation);


      CopyBuffer(envelope_handle,1,0,2,env_upper);
      CopyBuffer(envelope_handle,0,0,2,env_lower);

      ArraySetAsSeries(env_upper,true);
      ArraySetAsSeries(env_lower,true);

 Comment("upper: ", env_upper[1], " lower: ", env_lower[1]);

 

 

Ryan Leland
22
RyanLeland 2012.08.20 03:00
Thanks jelam! That helps.
/
To add comments, please log in or register