Download MetaTrader 5

EA not recognizing indicator number values

To add comments, please log in or register
aransier
424
aransier  

Hello everyone, i am having some trouble getting my EA to confirm a buy signal on Value 4 (green) and sell Value 8 (red)

 

 

 double  Murr_buy=NormalizeDouble(iCustom(NULL,0,"Murreys_Math_oscillator",Length,3,1),5);

double Murr_sell=NormalizeDouble(iCustom(NULL,0,"Murreys_Math_oscillator",Length,7,1),5);

 

This is the indicator part. i wrote as Murr_buy != EMPTY_VALUE

 

 

 

#property indicator_separate_window

#property indicator_buffers 8

#property indicator_color1 clrLime

#property indicator_color2 clrSpringGreen

#property indicator_color3 clrLimeGreen

#property indicator_color4 clrGreen

#property indicator_color5 clrSaddleBrown

#property indicator_color6 clrChocolate

#property indicator_color7 clrTan

#property indicator_color8 clrRed



extern int Length=100;

extern double Multiplier=0.125;

extern bool Show_Lines=true;



double OP1[], OP2[], OP3[], OP4[], ON1[], ON2[], ON3[], ON4[];



int init()

{

IndicatorShortName("Murreys Math oscillator");

IndicatorDigits(Digits);

SetIndexStyle(0,DRAW_HISTOGRAM);

SetIndexBuffer(0,OP1);

SetIndexStyle(1,DRAW_HISTOGRAM);

SetIndexBuffer(1,OP2);

SetIndexStyle(2,DRAW_HISTOGRAM);

SetIndexBuffer(2,OP3);

SetIndexStyle(3,DRAW_HISTOGRAM);

SetIndexBuffer(3,OP4);

SetIndexStyle(4,DRAW_HISTOGRAM);

SetIndexBuffer(4,ON1);

SetIndexStyle(5,DRAW_HISTOGRAM);

SetIndexBuffer(5,ON2);

SetIndexStyle(6,DRAW_HISTOGRAM);

SetIndexBuffer(6,ON3);

SetIndexStyle(7,DRAW_HISTOGRAM);

SetIndexBuffer(7,ON4);



if (Show_Lines)

{

  SetLevelValue(0, 2.*Multiplier);

  SetLevelValue(1, 4.*Multiplier);

  SetLevelValue(2, 6.*Multiplier);

  SetLevelValue(3, 8.*Multiplier);

  SetLevelValue(4, -2.*Multiplier);

  SetLevelValue(5, -4.*Multiplier);

  SetLevelValue(6, -6.*Multiplier);

  SetLevelValue(7, -8.*Multiplier);

}

Thank you for your help in advance
whroeder1
15913
whroeder1  
aransier: . i wrote as Murr_buy != EMPTY_VALUE
  1. Don't paste code
    Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. Do NOT use NormalizeDouble, EVER. For ANY Reason. It's a kludge, don't use it. It's use is always wrong

  3. Drop the Normalize and the compare may work.
  4. Print out your variables, and find out why.
Mladen Rakic
61854
Mladen Rakic  
aransier:

Hello everyone, i am having some trouble getting my EA to confirm a buy signal on Value 4 (green) and sell Value 8 (red)

 

 

 double  Murr_buy=NormalizeDouble(iCustom(NULL,0,"Murreys_Math_oscillator",Length,3,1),5);

double Murr_sell=NormalizeDouble(iCustom(NULL,0,"Murreys_Math_oscillator",Length,7,1),5);

 This is the indicator part. i wrote as Murr_buy != EMPTY_VALUE

...

 Thank you for your help in advance

"Murreys_Math_oscillator" indicator does not use EMPTY_VALUE for those cases. It uses 0

   OP2[pos]=0.; OP3[pos]=0.; OP4[pos]=0.; ON1[pos]=0.; ON2[pos]=0.; ON3[pos]=0.; ON4[pos]=0.;
Compare it to 0, and it should work
aransier
424
aransier  
whroeder1:
  1. Please edit your post.
    For large amounts of code, attach it.


  2. Drop the Normalize and the compare may work.
  3. Print out your variables, and find out why.
Thank you so much .
To add comments, please log in or register